Same sku in different categories - woocommerce - php

I was wondering if anyone can help me with this head scratcher. I am trying to assign different categories to the same SKU in woocommerce.
You might be asking yourself, why does this idiot want do that?
There is a simple reason for that… I know that the categories one assigns to a product SKU determine the navigation to that SKU/Product.
The example that I will be using:
Lets pretend that the SKU is A95845 (Red Ridding Hoods red juicy apple – included in the basket choices below)
Baskets->Wooden->Varnished
Baskets->Wooden->Unvarnished
Baskets->Plastic->Red
I would like the user to get to the product A95845 for each instance. It is like Red Riding Hood taking alternate roads, but getting the happy ever after regardless of which road she chose. (Well that is my opinion. And a way better interactive experience for the user.)
Now for your opinions…

You are hundred percent correct Steve. What I did wrong was the way I imported the categories. I used csv import and did not separate subcategories. This should have looked like this.
Baskets->Wooden->Varnished|Baskets->Wooden->Unvarnished|Baskets->Plastic->Red

Related

Filtering within REST api

We're currently in the process of building a RESTful API. Now, it's a matter of what the best way of tackling filtering is.
We have /products. /products returns all given products you have access to. Now, let's say you want the products where the description matches exactly 'No description'. You'd get /products?description=No+description.
Now, ideally we would have more filter options. Show only products where the stock is more than or equal to 1, but less than 10. Show only products where the name ends in black, or starts with white. What is the best practice of doing this? Would we use logical operators in the URL, how would we escape wild cards?
Current state of affairs is:
/products?product_name=%25black will find all products with names ending in black.
or
/products?product_name=white%25 will find all products with names starting with white.
%25 is the encoded form of %. So far so good.
But what if someone wants to find a product where the name matches the literal % character? Or wants to find products with stock? Would it be best to introduce
min_stock and max_stock, or is it possible (or do we even want to?) to use logical operators (?stock=>=1&stock=<=5). Is there a standard for handling URLs or situations like this?
Are we overthinking? Is it possible? Should we not do filtering our end, but let users figure it out themselves?
REST paradigm is about ressources (all you access is ressource) and human understandability. That's why you make your listing url plural.
With that said, I do think, if you want to filter in two different ways (with =, like, regex...) you have two possibilitiees :
first create three different filters product_name_exact, product_name_like, product_name_regex. It looks like python.django way of filtering and it's quite elegant;
second way : create one query field, and then a query_mode it is quite the way bing api works.

Sorting products by name in Magento

I'm trying to sort my products alphabetically by name in Magento. The problem is, my products' names are in Japanese characters so for obvious reasons, the sorting would not work. Also, I have another name for products which I call name_en, which is basically the english name for the products for my english store view. My question is, how can I sort the products by name? I see 2 possible ways to approach this:
Sort the Japanese characters by bit (I believe this would be tedious)
Sort the product by name_en but I'm not sure which file I need to modify for this.
These are basically just ideas that come to mind on how I can accomplish what I want but I have no idea how I can implement this. Please help.
I don't think this is an immediate solution but instead, a workaround following the second option I came up with. I modified my name_en attribute to display english and japanese text on the frontend. Then set name_en as the criteria for sorting instead of name on the categories. So now, both my japanese and english sites sort products using the English name.

Structuring content in Expression Engine

I need some help figuring out the best way to sctructure content using Expression Engine. I've red the documentation, looked at all information I could find but I haven't found the answer. I hope someone here could help.
What I want to create is a product catalogue that would look like this:
/bikes (product category, displays the product families, two-wheelers, three wheelers etc.)
/bikes/two-wheelers (product family, displays the products in the family)
/bikes/two-wheelers/red-bike (product)
/bikes/two-wheelers/red-bike/wheels (optional product details page)
I understand that EE URI's are template-group/template based and that the content is in channels. I'm not yet sure how categories can be used in this.
Essentially I would like to create "simple" parent-child relationschips between the entries and I found a plug-in called Structure that does something like that. Unfortunately, this project needs to be done without additional (payed) plug-ins.
Is it possible for the product to be the channel, and product-family and product-category to be attributes of the product in EE? Would that work? Is there a better way to structure that?
I realise that this isn't a straight-forward question, but I'm still hoping to be pointed in the right direction.
Thanks for reading!
Probably what you'll want to do is use categories to break your products up into families. You can nest the categories like so:
Bikes
Two Wheelers
Three Wheelers
Tall
You'd then assign your "Red Bike" channel entry the category of "Bikes" and "Two Wheelers".
For the extra product detail page, you could probably use related entries. Set up a channel called "Wheel Types", then publish entries for all the different kinds of wheels. Then use a relationship field type in your "Products" channel to associate a specific wheel type to your "Red Bike" entry. You can then link to that detail page using a related entries tag in your template.
The Structure module would really help you easily craft the URLs you are looking for, but if you can't use it then the Freebie extension should help. But of course the time it takes you to figure out how to use Freebie for your needs would probably be worth far more than the cost of a Structure license.

How to match similar products for a price comparison website

I am working on a small price/product comparison website, it's a niche website related to laptops and tablets, built in php.
My problem/question is how to do the following :"matching similar products from different merchants". I mean, when the product has EAN/ISBN, a simple %LIKE% can do it. But the datafeeds I get have a lot of products missing the ean or any other unique ID. How do price comparison websites deal with this?
I'm thinking of searching for string similarity between products names, but I don't want to match : Acer iconia tab a500
and acer iconia tab a500 case as similar products. any ideas?
Thank you !
To implement the comparison you have to put some tags for the products.And when a person search for a product, list the other products which have the same tag.
eg: for a laptop tags are like laptop, acer, 14", 500$(price), etc.
So when someone search laptop, list all the laptops. so that he can choose 2 of them. and make comparison.
Hope you got the concept.
I faced a similar problem. There are different solutions.
You can find similar items with some search technology (full text search engines can be helpful) or by using some data mining methods (have a look at named entity recognition for recognizing brand, model, color..etc. and especially machine learning methods for text mining). Latter can be much more accurate if you do it well.
In both methods, then you can use some additional fuzzy logic for string comparison of the words that can be written in different ways. and general predefined rules to eliminate wrong items. for example, considering the prices can differentiate an item and its accessories although they have very similar titles.

Drupal views structure

i've a Drupal theory/strategy related question. First i want to say that i'm very new to the drupalling world, so this question can be quiet stupid. I'm trying to develop/make a part of a site that has the following structure:
(level one) virtual_exhibitions: shows an overview of exhibition categories.
(level two) themes, places, people: which is an exhibition category.
(level three) love, belgium, napoleon: which are exhibitions, every one of there will give a list of photos related to the exhibition subject.
now i created a new node-type: virtual-exhibition.
and i created a vocabulary: exhibition-categories.
now to create the structure i used views:
one view to list all the nodes from a selected category with a link to the node.
one view to list all the categories.
now i was wondering if this is the drupal way to do this, or are there better alternatives. This is working, but i'm not sure if this is the right way.
Another question related to this, i want to use clean urls:
virtual_exhibitions
virtual_exhibitions/themes, virtual_exhibitions/places, ...
virtual_exhibitions/themes/love, virtual_exhibitions/places/belgium, ...
The first one is easy, i can configure this in the views UI. The second one is a bit harder because the categories can have special characters like a ' or a , etc. So i need a raw version (as can be used in path auto) in fact it would be best that my default link of the vocabulary term redirects to this view. because the url of the vocabulary term is very easy to configure using path auto and then i can just use the vocabulary term url in stead of always building it manually.
The reason why i'm using a view for the second level is because it needs a custom layout and as far as i know it isn't possible to style a vocabulary-term of a specific vocabulary. When you style it this style will be used for all the vocabulary-terms.
i hope my description is a bit clear and that somebody can give me some remarks on how i best do this.
I think you might want to take a look on views arguments.

Categories