You are here:  » Displaying information based on product name


Displaying information based on product name

Submitted by paddyman on Tue, 2006-11-14 20:52 in

Hi,

I am using a datafeed which has a category called girls toys. So far I can display all girls toys from a menu with

"search.php?q=category:Girls+Toys:"

Would also like to display another menu item (subcategory)called Bratz Toys. The only reference to "Bratz Toys" in the datafeed is my product names field, as per below.

BRATZ: Formal Funk - Dana
BRATZ: Formal Funk - Jade
BRATZ: Formal Funk - Sasha
BRATZ: Formal Funk - Yasmin
BRATZ: Hair Stereo

Just wondering how I can take the word Bratz from my product name field and create a new field containing the word Bratz, either in my datafeed before parsing or in the PT database while filtering, and then perform a search of this new subcategory like

"search.php?q=subcategory:Bratz:"

Would then like to do the same for other products such as thunderbirds... from my datafeed.

Thunderbirds : Thunderbird Figure - 01 Scott Tracy
Thunderbirds : Thunderbird Figure - 02 Virgil Tracy
Thunderbirds : Thunderbird Figure - 03 The Hood

Hope this makes sense!!

Thanks

Paddyman

Submitted by support on Tue, 2006-11-14 22:58

Hi Paddyman,

I'm afraid Price Tapestry does not have any sub-category support - I have intentionally never supported this because unfortunately there just isn't the quality of data in affiliate product feeds required to facilitate it, and this would leave most users unhappy with the results.

It may be possible to use filters to create a copy of the Product Name filter and then split the text up and use the prefix as the category (but you would not be able to use any higher level category from the feed such as "Girls Toys"). I'll have a look into this for you...

Cheers,
David.

Submitted by paddyman on Tue, 2006-11-14 23:18

Thanks David for the quick reply.

That would be great. Actually I would get away without having the girls toys category and just have the Bratz... Product name prefix category.

Cheers.

Paddyman

Submitted by support on Wed, 2006-11-15 08:12

Hi again;

I've had a think and in order to do this, first you'll need to make a bit of a mod to the import process; and then add a couple of new filters to your installation.

Firstly, a mod is required in includes/admin.php to re-order the way filters are processed. You need to move the code around a little in order that user filters are applied before the standard filters (as the standard filters strip the : character). Look for the following comment on line 156:

/* apply standard filters */

..and lower down on line 178

/* apply user filters */

What you need to do is swap these sections of code around so that the user filters are applied first. If you're not sure about what to drop me an email and i'll make the changes and send the modified files over to you.

Secondly, you need to add 2 new filters (Split Before and Split After) to includes/filter.php. The code is in the following thread:

http://www.pricetapestry.com/node/339

Now.... having made the changes; onto how you can get the first part of the product name as the category.

Firstly, in order to do this you need to see if there is a field in your feed that is always empty. With most XML feeds; the first field which is the product container element is normally empty, for example "PRODUCT".

1) Register an empty field as the Category.

2) Register the Product Name as normal. Make a note of the field name used, for example "PRODUCTNAME".

3) Register the feed, but don't import.

4) Add a new "Text After" filter on the Category; and use the placeholders feature to append the product name using the %FIELDNAME% notation; for example "%PRODUCTNAME% (where PRODUCTNAME is the name of the field you registered in step 2).

What you have achieved so far is 2 fields with the same content - the product name. Now to split them up...

5) Add a new "Split Before" filter on the Product Name field. In the text to split upon, enter ":" (without the quotes).

6) Add a new "Split After" filter on the Category field. Again, in the text to split upon, enter ":".

If you then import, you should find that the product name field no longer contains the category; and your category field contains the values required.

Hope this helps!
Cheers,
David.

Submitted by paddyman on Wed, 2006-11-15 18:05

Hi David,

Thanks a million for that. Have just got home from work and given it a go.

What I now have are new categories.

When i click on one of these categories

/search.php?q=category:%3A+Formal+Funk+-+Cloe:

I get

"Product search results for category:: Formal Funk Cloe: (no results found)"

From the datafeed these are some of the products in the product name field

BRATZ: Formal Funk - Cloe
BRATZ: Formal Funk - Dana
BRATZ: Formal Funk - Jade
BRATZ: Formal Funk - Sasha
Thunderbirds : Thunderbird Figure - 01 Scott Tracy
Thunderbirds : Thunderbird Figure - 02 Virgil Tracy
Thunderbirds : Thunderbird Figure - 03 The Hood
Thunderbirds : Thunderbird Figure - 04 Brains
Thunderbirds : Thunderbird Figure - 05 Penelope
Thunderbirds : Thunderbird Figure - 06 Parker

The categories generated from this after following your instructions above are

: Formal Funk - Cloe

: Formal Funk - Dana

: Formal Funk - Jade

: Formal Funk - Sasha

: Thunderbird Figure - 01 Scott Tracy

: Thunderbird Figure - 02 Virgil Tracy

: Thunderbird Figure - 03 The Hood

: Thunderbird Figure - 04 Brains

: Thunderbird Figure - 05 Penelope

: Thunderbird Figure - 06 Parker

It seems to be displaying a list of categories based on what comes after ":". I think what I'm after is displaying what comes before ":" such as Bratz and Thunderbird Figure as categories, and then display all products which come under these categories.

Any ideas??

Hope this makes sense!!

Thanks

Paddyman

Submitted by support on Wed, 2006-11-15 18:09

Sorry - yes they're the wrong way round.

Split Before returns the text prior to the character (":" in this case) and so that should be used on the Category.

Split After is then used on the Product Name field to return the content after the ":".

Finally, it may also be worth registering an additional "Trim" filter against both category and product name which should remove any other spurious characters.

If it's still not working as intended perhaps you could email me the link to your feed on your server that has these products names... something like:

http://www.yoursite.com/feeds/merchant.xml

...and i'll download it and give it ago. Reply to your reg code or forum registration email is the easiest way...

Cheers,
David.

Submitted by paddyman on Wed, 2006-11-15 19:47

Thats working perfectly.

Thanks yet again, great support as ever :)

Cheers

Paddyman