You are here:  » Problem using Explode Filter in the category field with ">" symbol


Problem using Explode Filter in the category field with ">" symbol

Submitted by Marcos on Sun, 2012-12-02 20:10 in

Hi all,

I'm quite new using pricetapestry and PHP in general.

I have a problem using the Explode filter in the category field. As I saw in other posts, some of my feeds uses the ">" symbol to separate the different category levels like : "Main category > Sub category 1 > Sub category 2"

If I understood well, I can have "Sub category 1" saved as category for a product using the Explode filter with ">" as Explode Character and "-2" as Return Index (both without the quotes). The problem is that if I do this, my categories page appears empty. If I use "-2" as Return Index the categories are listed like without using the Explode filter.

I tried to do a "search and replace" filter just for testing and it works for "_" but not for ">".

I also tried to add ">" to:

$importRecord["category"] = tapestry_normalise($importRecord["category"],">");

Like suggested here.

I also tried moving this line like explained here.

Did I miss any step or do you have any idea about how to solve it?

Thank you in advance for your help :)

Submitted by support on Mon, 2012-12-03 10:00

Hi Marco,

You made the correct modification at first glace - which is to permit ">" in the category field using:

  $importRecord["category"] = tapestry_normalise($importRecord["category"],">");

However, if that doesn't work it's possible that the ">" is actually entity encoded within your feed as ">" - in which case extend the above modification as follows:

  $importRecord["category"] = tapestry_normalise($importRecord["category"],">&;");

...and then edit your filter using ">" as the Explode Character or String instead of ">" and that might do the trick...!

Cheers,
David.
--
PriceTapestry.com

Submitted by philstone on Mon, 2014-09-15 23:06

Hi David

Hope your well

I am trying to explode a category with the " - " symbol, but for some reason its not working

this is the current code

      $importRecord["category"] = tapestry_normalise($importRecord["category"],"\/,>,~~,|");

i had thought this would work, but it hasn't

      $importRecord["category"] = tapestry_normalise($importRecord["category"],"\/,>,~~,-,|");

is there something else i need to change other than this line in the includes/admin.php?

Thanks in advance

regards

Phil Stone
www.buy24-7.net

Submitted by support on Tue, 2014-09-16 08:53

Hello Phil,

That should ordinarily work fine, so I'm wondering if it's a soft-hyphen from the UTF-8 character set rather than the ASCII character hyphen/minus. A soft hyphen is in the code block below:

Use Copy and Paste to copy from the above into the allow string in the call to the tapestry_normalise() function as you have done for the minus sign, and then into the Explode Character or String box in your filter and that might be all it is...

Cheers,
David.
--
PriceTapestry.com

Submitted by philstone on Wed, 2014-09-17 19:44

Thanks David

I tried that, but it didn't work, but just found the answer in this fantastic support forum! here - help with categories, and products within them

Thanks

Phil Stone
www.buy24-7.net