Hi David
I am looking into category mapping so wondering if you can help/advise me.
I am using the below code in the side menu that shows all the categories:
Departments
<?php
$sql = "SELECT DISTINCT(category) as category FROM `".$config_databaseTablePrefix."products` ORDER BY category";
if (database_querySelect($sql,$rows))
{
echo "<ul>";
foreach($rows as $row)
{
if ($config_useRewrite)
{
$href = $config_baseHREF."category/".tapestry_hyphenate($row["category"])."/";
}
else
{
$href = $config_baseHREF."search.php?q=category:".urlencode($row["category"]).":";
}
if (strlen($row["category"])>30) { echo "<li><a href='".$href."' title='".$row["category"]."'>".substr($row["category"],0,30)."...</a></li>"; }
else {echo "<li><a href='".$href."' title='".$row["category"]."'>".$row["category"]."</a></li>";}
}
echo "</ul>";
}
?>
what i am trying to do is replace the above with new created categories i have created in tha admin, so for example if i create the new cateogies in the admin
Televisions
Shoes
Toys
then they show in the sidebar. But when i click on say; Televisions it then displays all the categories i have mapped in the admin to the Televisions folder.
hope you understand the above :
Paul
Hi David
I put the above in and now i see the main categories created in admin, but when i click on say toys it isnt showing the all the categories i have assigned under the main toys?
any ideas why
thanks
paul
Hi Paul,
Bear in mind that post-mapping the original categories don't exist anywhere in the database - but if it's not showing the products expected it may just be pending a full import - Category Mapping is applied at import time so that might be all it is - let me know if you're still not sure...
Cheers,
David.
--
PriceTapestry.com
hi david
im not sure its going to work as i think. Here is how i would like it to work
create a category in category mapping called toys, then search the categories for all categories that have toys in, ie games, rccars and so on. Then i add these to the right in the toys category.
Am i right in thinking on the front end when i click on the Toys category it should then underneath the toys categories it should show the games and rccars categories?
and if so at what point do i have to re import the feeds
thanks
paul
Hi Paul,
Price Tapestry only has a single category level - Category Mapping exists only to rename different merchant's categories into a preferred category name (as a convenient alternative to having to manage many filters!) so once a Category Mapping is set-up, as feeds are imported any product with a category field matching an alternative entry will have its category renamed to the preferred "master" category name....
Cheers,
David.
--
PriceTapestry.com
Hi
Ah ok so it is only 1 level, is there a way/code to have a second level category mapping.
Thanks
Paul
Hi Paul,
I'm afraid the script doesn't support a category hierarchy - there just isn't the data in affiliate product feeds to support it - but you might want to consider the categorised sub-installation method described first of all here but discussed extensively on the forum - search on "sub-category".
Cheers,
David.
--
PriceTapestry.com
hi
ok is this possible. i have added 2 categories in the mapped section in the admin.
Appliance:
Televisions:
Toys:
When i click on the appliance it shows the products in the search results on the right, is there a way for it to display a menu above the search results (from an external file, ie appliance_menu.php)so i can then create my own menu items ( Ovens | Cookers | Kettles ). so same for if i click on Toys again it looks at an external file toys_menu.php and displays them above the search results above the toys.
thanks
paul
Hello Paul,
Sure - you could insert the code at the top of html/searchresults.php - something like:
<?php
if ($parts[0]=="category")
{
$filename = $parts[1]."_menu.php";
if (file_exists($filename))
{
require($filename);
}
}
?>
Make sure the first part of your menu filenames match the category exactly - including capitalisation and spaces e.g.
Category Name_menu.php
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
Hi Paul,
It should be happening like that by default since once Category Mapping has been applied at import time the old categories no longer exist in the database, so clicking a "master" category name in your dynamic menu will return all products that originally had the categories that you included in that mapping.
If that's all working as expected, and you are working comprehensively on Category Mapping for this installation then it would be much quicker to generate your dynamic menu from the `categories` table directly rather than `products`. To do this, simply REPLACE the first line of the mod as follows;
$sql = "SELECT name as category FROM `".$config_databaseTablePrefix."categories` ORDER BY category";
Cheers,
David.
--
PriceTapestry.com