You are here:  » product to category mapping in admin.php

Support Forum



product to category mapping in admin.php

Submitted by tonypearce on Wed, 2011-07-20 14:41 in

Hi,

I am using the mod to create a category depending on keyword in the product title:

// create an array of keywords => categories
$kw = array();

$kw["electrode"] = "Kettle Electrodes";

What I want to do is use more keywords:

// create an array of keywords => categories
$kw = array();

$kw["breville electrode"] = "Breville Kettle Electrodes";
$kw["kenwood electrode"] = "Kenwood Kettle Electrodes";

The above words may be separated by another word.

So the standard problems I guess??

Thanks
Tony

Submitted by support on Wed, 2011-07-20 16:35

Hi Tony,

The original source for that code (still valid of course) came from an early version of Price Tapestry with a less sophisticated Category Mapping mechanism. With later versions, it's straight forward to make the category mapping alternatives apply also to the product names if that would satisfy your requirements.

To do this, in includes/admin.php look for the following code at line 222 (11/09A) or line 224 (12/10):

    if (strpos($importRecord["category"],$word) !== FALSE) $found++;

...and REPLACE with:

    if (
       (stripos($importRecord["category"],$word) !== FALSE)
       ||
       (stripos($importRecord["name"],$word) !== FALSE)
       )
       $found++;

(also change to stripos to make case insensitive)

Hope this helps!

Cheers,
David.
--
PriceTapestry.com