Hi David,
I have a niche site as you know and I'm looking to add multiple colours to advertise the fact that a specific product comes in more than 1 colour.
The only way I have thought about doing it is to add another table to the database and then add the additional colours along with links to the associated products
Database table as follows: -
id products_map_name colour
Am I on the right track or is there an easier way?
Thanks,
Simon
Hi David,
Thanks for your reply - I didn't know about the meta data feature :)
So if I add a new field
$config_productMeta["colours"] = "Colours";
I then populate the field with colour "Red". What if the product has 4 other colours?
Thanks,
Simon
You could use comma separated values
Red,Green,Blue
...and on your product pages (html/product.php) for example;
<?php $colours = tapestry_productMeta($product_main["name"],"colours"); ?>
<?php if ($colours): ?>
<p><strong>Available in:</strong> <?php print $colours; ?></p>
<?php endif; ?>
Cheers,
David.
--
PriceTapestry.com
Thanks David,
So at the moment I have seperate listings for the same product but different colours as sometimes the prices vary depending on colour.
With that in mind I don't think the meta feature would be suitable as I wouldn't then be able to link to the various products from the colours
Is my thinking right?
Thanks,
Simon
Hi Simon,
Would it be practical for you to (using filters etc.) set up a standard naming convention so that your products all contained the colour as the last word of the product name eg.
Widget Master Red
Widget Master Green
Widget Master Blue
If so, with a list of colours, it would be no problem to use the Related Products functionality to a) strip the colour from the product name of the product currently being viewed and b) use the base name as the SELECT query for Related Products (using a LIKE where clause) so that, in this example, if you were viewing "Widget Master Red", then Related Products would show "Widget Master Green" and "Widget Master Blue" to indicate the other colours available (and also show price from.. etc..)
What do you think?
Cheers,
David.
--
PriceTapestry.com
Hi David,
I think that could work and would also save me having to allocate all the alternative colours to each product.
Thank you!
Hi,
To give this a go, edit products.php and look for the following code beginning at line 92:
if ($product["products"][0]["category"])
{
$wheres[] = "category = '".database_safe($product["products"][0]["category"])."'";
$ignoreFullText = TRUE;
}
if ($product["products"][0]["brand"])
{
$wheres[] = "brand = '".database_safe($product["products"][0]["brand"])."'";
$ignoreFullText = TRUE;
}
...and REPLACE with:
$wheres[] = "name <> '".database_safe($product["products"][0]["name"])."'";
$colours = array("Red","Green","Blue");
$baseName = trim(str_replace($colours,"",$product["products"][0]["name"]));
$wheres[] = "name LIKE '".database_safe($baseName)."%'";
$ignoreFullText = TRUE;
Edit the colour list in the $colours array as required and that should do the trick...
Cheers,
David.
--
PriceTapestry.com
Hi Simon,
If you don't mind setting up the colours on a per-product basis (probably just as easy as making a table and mapping single colours to multiple products + management etc., you could use the Meta Data feature of Product Mapping (essentially, like custom fields, but without any database modifications required...)
Cheers,
David.
--
PriceTapestry.com