Implementation of colorgid in magento - magento

As a part of a project I have to implement a color grid in magento. That is, Users have to find product of a particular color. Users will select a color from the grid and all products of that particular color or similar color will be shown as the output.
I implemented it by extracting and storing dominant colors of a product and retrieving products using an algorithm.
But can't retrieve many products for a color selected by the user. Issue is that we can pass only a single color code (say '#000000') as user selection but color stored in database may be any variant of selected color, so it is not possible to get many products as result.
If anyone implemented such a functionality, please update me with your suggestions.

If I understand the question correctly you could use the mysql syntax CONV(hex_val, 16, 10) to convert any hexadecimal number such as the color code to a decimal and then select with the between condition, like:
SELECT `prod_id` FROM `products` WHERE CONV(`color`, 16, 10) BETWEEN {$color_range_start} AND {$color_range_end}
This is from memory and syntax would need to be corrected, but you get the point. After getting the product IDs into an array you could use the standard Magento functions to fetch a product collection based on that.

Related

Magento: how to display the correct images for configurable products in search results

I'm building configurable products on my Magento site (a simple way of showing each of our textiles with the swatches of the different colors of the same item under the main product image) and I have associated simple products for each individual color.
I don't seem to be able to obtain the desired behavior from the site and I'm writing to ask if you have a suggestion that might solve my problem.
At the moment I experience this behavior: when filtering products through color-level attributes I get both the simple and configurable products in my result set. Once I do that if I click on a simple product I find myself the simple product detail page, which doesn't show the box with the other color swatches.. while I would like every product detail page to show the other colors of the same item.
The intended usage is very basic really but I can't figure out if Magento can achieve that on its own or if it will require extra code; what I need is:
1) all product detail pages to show all the color swatches
2) the result list when filtering by the color attribute (for example "whites") should show the correct color images of the individual colors, without duplicates (and not the main image for that product, which would probably be in the wrong color)
Do you have a suggestion of maybe know of a plugin to achieve this?
Thanks a lot,
Sergio
Sergio,
There are two features in particular that might help you solve your problem.
First:
Click to expand the Shopping Cart section. Then, set Configurable Product Image to one
of the following:
l Product Thumbnail Itself
l Parent Product Thumbnail
Second:
To prevent the associated products from being listed individually in the catalog, set Visibility to “Not Visible Individually.” Or in your case, you may decide to do it the other way around.
Please be aware that I was not able to get this feature to work myself.

develop custom extension in magento, which processes image of product and tags with prominent color codes

I have been struggling in figuring out how can I tag a product with a color and when a user selects color from color picker, user should get all the products tagged with particular color or near by hex codes.
A very simple solution is to create two product attribute like main_color and related_colors, main_color should be a single selection input type and should be searchable while related_color should be Multi-selectbut not searchable. you can then assign one main color to the product and multiple related color shades. On frontend you have to custom code, get the related_color attribute value,extract all related color codes and fetch all products having main_color with that value.
Hope this makes some sense.

display same configurable options on child product view page

I setup the configurable products using 4 options (color, size thickness, size width, size ball).
I want view color distinct items on the list.
When I click each items, the detail page will be same. (same color swatch and options views)
(please check my attached file.)
When I click a item has got blue color option, I want see the blue color selected on the product view page.
Please let me know the solution.
Thank you.
Interesting challenge you have there - the products are ideally suited for Magento, you should end up with a store vastly more convenient than the competitors where you cannot filter by gauge, colour etc.
As for the problem, don't put colour in the configurable product options, just the size options will do. For selecting colours the way you want, move the related product block to the main product page options area.
Your 'related products' will need thumbnails and some careful creation so they stay in the same sort order. To do this:
Presumably you are using SKU's that follow some pattern, e.g. SKU-SIZE1-SIZE2-COLOUR. Put together a module with an observer that runs on some sensible schedule, e.g. overnight. In that scheduled task get the product collection grouped by SKU and ordered by COLOUR. Put some sort order to your colours, e.g. spectrum, with Red = 100, Orange = 200 and everything sensible in between. The im of the task is to go through all the products, find 'related' products (same model code, sku). Then in that group create related product links. For the example above, with six colour variants you will need to put in 25 links (5^2) once you take all six configurable master products into consideration.
Now you will need some work on the template. Initially you may want to get anything to show, you will also need to put the currently selected product in the list in the correct place so that the colour thumbnails do not jump around when you go from one colour variant to the next.
This can be done by using an extension called Pre-Select Colors Plus Swatches. You can find a demo of said extension here:
http://preselectswatches.cjmcreativedesigns.com/products.html
There are 6 products shown in the demo. One is the configurable product and the other five are the simple products showing the various color options. Notice that each of the color options loads the parent product with the color option already selected. The configurable product can even be hidden from the category listings, if needed, so that you only show the color options on the category pages.

How (& where) does Magento decide the order of list items in the configurable product view dropdown?

image #1: https://picasaweb.google.com/lh/photo/gDCgo_SHMbnAOmHCh0LQCtMTjNZETYmyPJy0liipFm0?feat=directlink
When examining a Magento configurable test product (ski goggles with a color option), I see that the colors of the dropdown list (see image #1) are ordered like this: White, Blue, Red, Silver. However, when I examine the product in the admin view and select the "Associated Products" tab, there seems to be no correlation between the frontend list organization and the product ID numbers, price, or anything else for that matter.
To demonstrate, if I connect the product ID numbers to the above list, I get: White (170), Blue (169), Red (168), Silver (175) - see image #2 below.
image #2: https://picasaweb.google.com/lh/photo/ES0i3_wZsdiU35w4_MGLrdMTjNZETYmyPJy0liipFm0?feat=directlink
At the time I initially created the configurable product, I had added three color options (168, 169, 170) and they appeared to be displaying in descending order by ID in the dropdown on the frontend. But I just now added another individual product (the color Silver), with an ID of 175, and it doesn't follow this trend.
Question: What logic does Magento use to order these lists, and what file is this function located in? I'm looking for a way to arrange the config. product dropdown list(s) in ASCENDING order, regardless of price or any other factor, ex. from 168-175.
Thanks.
B
Someone with more experience or knowledge may override me on this, but I believe the order the attribute values appear in the drop down list is based on the order they are given on the attribute label definitions when you create the attribute.
Sort order of the attributes is determined in the attribute. The furthest column on the right is called Sort Order.
Otherwise it should sort alphabetically.
I think what you are looking for is to sort dropdown values (i.e. small, medium, large, extra-large) by some value, and not by its label. If this were done, sorting would make more sense. We would be able so sort by increasing or decreasing size, rather than alphabetical (which does not make sense).
In order for this to happen, we would need magento to support enumerations or oordinal values (https://magento.stackexchange.com/questions/20985/get-option-value-by-id-or-attribute-in-magento, Magento - Sort by Position and Name?). There are NUMEROUS requests for this, which are being ignored.
Please be aware, dropdown values can already be re-ordered. In the admin pages, you can simply drag a dropdown value in M2 in order to change its position (M 1.9 calls this "Sort Orer"). However, the question then becomes how to use the position or sort order [s=1 m=2 l=3 xl=4] of the attribute-value for sorting, rather than its label.

Magento grouped product options

I want to show a set of products as a table inside one product with these attributes.
Dimensions Width x Gusset x Height Code Price/Case Bags/Case Weight
So i chosen grouped product option but it does not match the requirement. How can i design a table like format from the grouped product option with radio button to choose only one product from it. So using grouped product or configurable product or by any way how can i achieve this.
Here am attaching the screen-shot which i actually wanted
I can think of two ways to represent this in code. If the dimensions tend to be from a limited set of choices, you could use a configurable product to represent this choice, simply displaying all possible sub-products in the table. This would let you reuse the existing catalog product page with a little retrofitting.
If they do not fit well, you could place the items in a category hidden from the public categories and loop through each of the products in the category to display the table. This would require more work to tie back to putting into the cart, etc.
Importantly, it looks like each of your options has an entirely uncorrelated price, so it seems to me that you need to have a simple product underpinning these options at some point. (I'm sure you could get more clever, I'm just not sure that's a good idea.)
You can easily solve this with a plugin for Magento. There is a plugin here which will do exactly what you want. It will display product options in a grid: http://www.magemechanics.com/product-grid-options.html

Resources