Automating Related Products

I’m going to be selling over 10,000 different kinds of cabinet knobs and pulls in my store. I’m already using about 10 different filters (size, finish, brand etc.) to help my customers narrow down their search.



Many times a particular knob might be part of a collection of other similar knobs. So my customers might often want to purchase 2 or more of these similar knob types for their project (i.e. one kind for their cabinet doors and another kind for cabinet drawers).



I’ve already assigned a feature “Collection” to each of my knobs/pulls (giving each collection a unique name), so there might be anywhere from 2 to 10 similar knobs/pulls in a given collection.



As it stands now, I have to ask my customers to find a knob that they like, make note of its “collection name” in the features list and then go back and do a search for all knobs in that collection. While that would work, it’s cumbersome, confusing, and will probably cause a lot of would-be customers to look elsewhere. Obviously, it would be much better if whenever a customer chose a knob and went to its product page, any related knobs/pulls would be displayed automatically.



So here is what I’m asking for…. Whenever a customer views a product on the product details page, I want CS-Cart to automatically look to see if there are any other products with the same “collection name” and display them.



This is essentially doing an automatic search (and something I see on many of my competitors sites). Since the collection name would be supplied by me, and the sort functionality is already part of the CS Cart platform, it seems to me that all the heavy lifting has been done. All that’s missing is making the process automated.



If the above is asking too much or would take too long to implement, here’s another approach…



Make “related products” something that could be imported as part of a CSV file. Then, when my data is still in spreadsheet form, I could write a formula that would search for the product I.D. of any other products that were in it’s collection and insert those I.D.'s under the “related products” heading (just like how a product’s features are currently listed). Unfortunately, “related products” is not currently something that can be imported/exported.

There are addons that display similar items.

I use one - but you need to select the similar items manually for each product. They do cross-link though, which means you only need to select the association between two or more ONE time.

I also use a modification that makes the FEATURE a hyperlink so the customer can click the FEATURE and see all the items that have that same feature.



The addon is called Product Analogues - if you search the forum you will find it. If you can write your own insertion queries, you should be able to insert the values into the database table the addon uses and save yourself some time.



The mod for the Feature links is on this forum somewhere… I think it was written for v2, but I was able to apply it via a hook to my v3 store without too much trouble.

http://1clue.com/pro…-analogues.html - for the similar products.



Below is a mod I found and tweaked for my use that hyperlinks the features on the product's detail page. It ends up there is no hook for this modification, so the change is directly in the template.

Below is the contents of the “foreach” selection in skins/skinname/customer/views/products/components/product_features.tpl.

I don't have a copy of the original code to tell you WHAT exactly changes, but my changes are labelled with comments.


```php {foreach from=$product_features item=“feature”}

{if $feature.feature_type != “G”}


{if $feature.full_description|trim}{include file="common_templates/help.tpl" text=$feature.description content=$feature.full_description|unescape id=$feature.feature_id show_brackets=true wysiwyg=true}{/if}
{$feature.description|unescape}:
{if $feature.feature_type == "M"}
{assign var="hide_affix" value=true}
{else}
{assign var="hide_affix" value=false}
{/if}
{strip}

{if $feature.prefix && !$hide_affix}{$feature.prefix}{/if}
{if $feature.feature_type == "C"}
{$feature.value}
{elseif $feature.feature_type == "D"}
{$feature.value_int|date_format:"`$settings.Appearance.date_format`"}
{elseif $feature.feature_type == "M" && $feature.variants}

    {foreach from=$feature.variants item="var"}
    {assign var="hide_variant_affix" value=!$hide_affix}
    {if $var.selected}
  • {$var.variant} {if !$hide_variant_affix}{$feature.prefix}{/if}{$var.variant}{if !$hide_variant_affix}{$feature.suffix}{/if}
  • {/if}
    {/foreach}

{** MAGPIE CODE START **}
{elseif $feature.feature_type == "E"}
{foreach from=$feature.variants item="var"}
{if $var.selected}{if $var.image_pair}{include file="common_templates/image.tpl" images=$var.image_pair object_type="feature_variant"}   {/if}{/if}
{if $var.selected}{if !$var.image_pair}{if $hide_prefix}{$feature.prefix}{/if}{$var.variant}{if $hide_prefix}{$feature.suffix}{/if} {if $feature.suffix && !$hide_prefix}{$feature.suffix}{/if}   {/if}{/if}
{if $var.selected}{if $var.url} [view selection]{/if}{/if}
{/foreach}
{elseif $feature.feature_type == "S"}
{foreach from=$feature.variants item="var"}
{if $var.selected}{$var.variant}{/if}
{/foreach}
{** MAGPIE CODE END **}
{elseif $feature.feature_type == "N" || $feature.feature_type == "O"}
{$feature.value_int|floatval|default:"-"}
{else}
{$feature.value|default:"-"}
{/if}
{if $feature.feature_type != "E"}{if $feature.suffix && !$hide_affix}{$feature.suffix}{/if}{/if}

{/strip}

{/if}
{/foreach}
```

This change basically is saying: Hyperlink Feature type Select Box Extended image to the feature. This is VERY useful for a feature list of manufacturers with logos.
Hyperlink Feature type Select Box (any) to the feature.

I also use the URL field for an atypical use in this mod. The URL field is used to create a link to products that are related to the feature for Extended type features. For instance, a Extended type feature of an LCD TV is "Wall Mount", the URL field contains a link to the Wall Mounts available in the store. The page then displays the Wall Mount feature (linked to all the other LCD TV's that have the same feature) and the URL is applied to my nasty-hard-coded-directly-in-the-template-language "[view selection]". The URL (defined for each feature in its URL field) is the page name for the Wall Mounts category I offer in the store. Leave it blank and it doesn't show. (To clean this up, the language in the template should be a variable that is set up in the Languages database).

Thanks for all the info Don!



Another user here PM'd me, saying he was working on an add on which would automate the process for me. Says it'll be ready in a few weeks so we'll see what happens!