You are here:  » Category


Category

Submitted by MarcoCH on Sun, 2018-11-18 09:17 in

Hello

Most of the feeds I use from Affili.net, Awin, etc. have a category tree that looks mostly like this: Category1> Category 2> Category 3 or Category1 / Category2 / Category3 or Category1, Category2, Category3.

how can I just import the names or at least only the last category?

Thanks and Greetings
Marco

Submitted by support on Sun, 2018-11-18 10:32

Hi Marco,

Sure - you can use the Explode filter to do this, but you'll need to make a small modification first since the characters used to separate the categories are stripped before filters are applied. To do this, edit includes/admin.php and look for the following code at line 265:

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

...and REPLACE with:

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

With this in place, using > as an example, add a new Explode filter to the Category field using > as the "Explode Character or String" and -1 as the "Return Index" which returns the last item in the category list...

Cheers,
David.
--
PriceTapestry.com

Submitted by MarcoCH on Sun, 2018-11-18 16:26

Hello

Can you explain the second step to me, unfortunately my english is not that good.
Do I have to continue with "Category Hierarchy Mapping"?

Can you send me a screen?

Thank you very much!
regards
Marco

Submitted by support on Sun, 2018-11-18 16:36

Hi Marco,

It is not "Category Hierarchy Mapping" sorry for the confusion, I was just referring to the hierarchy in your feeds, that's all! I have removed some from the post above, let me know if you are still not sure of course..

Cheers,
David.
--
PriceTapestry.com

Submitted by MarcoCH on Sun, 2018-11-18 16:46

Yes, now I know even less :-)

I have adjusted the line in admin.php, but after importing I have the same problem? Can I send you an e-mail with screens, can I upload files in the forum?

Submitted by support on Sun, 2018-11-18 17:46

Hello Marco,

Of course, please email me I will check it out first thing tomorrow with you...

Cheers,
David.
--
PriceTapestry.com

Submitted by MarcoCH on Sun, 2018-11-18 18:34

Perfect ... it works. You are brilliant!

Greets
Marco

Submitted by MarcoCH on Mon, 2018-11-19 20:58

Hello again,

what is who the categories with a "," are separated. Do I have to put a backslash before?

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

or

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

regards
Marco

Submitted by support on Tue, 2018-11-20 08:18

Hi Marco,

The list isn't actually comma separated - the comma in the original code above is actually the comma to be allowed in the name...

The only character that needs to be escaped is forward slash, so the following should do the trick...

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

Cheers,
David.
--
PriceTapestry.com

Submitted by MarcoCH on Tue, 2018-11-20 11:30

Hello,

Thank you very much!

I have a feed that has an enumeration at the Brand: "Apple, Samsung, Huawei, etc."

Can I also use it with Explore Filter (-1) at Brand?

regards
Marco

Submitted by support on Tue, 2018-11-20 11:39

Hi Marco,

Sure - all the filters can be used against any field as required...

Cheers,
David.
--
PriceTapestry.com

Submitted by MarcoCH on Tue, 2018-11-20 16:44

Hello

I also need to customize the

"$ importRecord [" brand "]" ?

because I just remove the "," and paste them all together, like this:

AcerAmazonAppleAsusBlackberryFitbitFossilGarminGoogleHTCHuaweiLe

regards
Marco

Submitted by support on Tue, 2018-11-20 17:02

Hi Marco,

Ah sorry I didn't mention that, the same modification to normalisation of brand will be required. To do this, edit includes/admin.php and look for the following code at line 222:

      $importRecord["brand"] = tapestry_normalise($importRecord["brand"]);

...and REPLACE with:

      $importRecord["brand"] = tapestry_normalise($importRecord["brand"],",");

Cheers,
David.
--
PriceTapestry.com

Submitted by MarcoCH on Tue, 2018-11-20 17:21

Hello

It's not "Brand".
Can I send you the feed link to test?

regards
Marco

Submitted by support on Tue, 2018-11-20 17:31

Hello Marco,

Sure, if you're having problems with a specific feed you can email me a link (or attached /zipped if not too large) and I will check it out on my test server for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by MarcoCH on Tue, 2018-11-20 18:43

Hello

worked, had to empty the cache again, sorry :-)

Greets
Marco

Submitted by MarcoCH on Thu, 2022-03-24 18:37

Hallo David

I have the following category in the feed: "Wohnen & Haushalt - Papeterie - Bürobedarf - Korrektur"

If I use the filter " - " and Explode "-1" then there is only: "Wohnen & Haushalt Papeterie Bürobedarf Korrektur"

But I only want the category: "Korrektur".

Do you have a solution?

regards
Marco

Submitted by support on Fri, 2022-03-25 08:10

Hi Marco,

"-" is stripped by the normalisation so by the time filters are applied it is no longer in the category value to explode using.

What you can do is move the category normalisation to after the filters have been applied. To do this, edit includes/admin.php and look for the following code at line 198:

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

...and comment out by replacing with:

      /* $importRecord["category"] = tapestry_normalise($importRecord["category"]); */

Then look for the following code at line 259:

    if ($filter_dropRecordFlag) return;

...and REPLACE with:

    if ($filter_dropRecordFlag) return;
    $importRecord["category"] = tapestry_normalise($importRecord["category"]);

Cheers,
David.
--
PriceTapestry.com

Submitted by MarcoCH on Fri, 2022-03-25 12:53

It works ... many thanks David :-)

regards
Marco