You are here:  » 2 Filters Needed

Support Forum



2 Filters Needed

Submitted by Langdon on Mon, 2009-07-13 04:57 in

Hi David,

I have two filters that I need to apply. One should be simple for you, the other might not be possible.

1.) I have a feed that contains some ZERO priced items as 0.00 in the price field. I would like to drop these records upon import. I actually haven't tried it yet but I believe the drop record on price like 0.00 would drop the records but also drop other records that end in 0.00 ... like 10.00 and 20.00 etc. Am I correct or can I just use the existing filter? Also, I came across something you had written specifically for Amazon.com, but I couldn't apply this to my feed.

2.) This one appears a bit harder... I'm currently importing a feed using the filter "Drop Record If Not RegExp" with (Boots|Casual Shoes|Dress Shoes|High Heels|Sandals) on the description field. I would like to be able to set the category field equal to one of these values also. Therefore, I'm predetermining my categories and only importing products that relate to those categories. I don't have to rely on other peoples category names and don't have to use your category mapping feature which seems difficult on a site with 1,000,000+ items. I'm hoping I can do this at import time with a custom filter, without having to reprocess the records.

Thank You for any help you can provide with this!

Lang

Submitted by support on Mon, 2009-07-13 07:45

Hello Lang,

Regarding 1), that would be easy to implement within the import record handler function in includes/admin.php. To do this, look for the following code on line 168:

$record[$admin_importFeed["field_price"]] = tapestry_decimalise($record[$admin_importFeed["field_price"]]);

...and REPLACE this with:

$record[$admin_importFeed["field_price"]] = tapestry_decimalise($record[$admin_importFeed["field_price"]]);
if ($record[$admin_importFeed["field_price"]]=="0.00") return;

Regarding 2), The Category Mapping feature should enable you to do this, as the user filters are applied before the mapping. Taking the above example, if you wanted all products in those categories to be imported as "Footwear", then create a new master category called "Footwear" (in Admin > Category Mapping), and on the configuration page, enter the same values (one per line) as you are using in the filter...

Hope this helps!

Cheers,
David.

Submitted by Langdon on Tue, 2009-07-28 00:52

David,
Just wanted to say thanks for your response. Both worked for me!

Lang

Submitted by philstone on Mon, 2010-02-15 14:25

hi dave

hope all is well with yourself,
just wondering how this '0.00 stop import process' works in the latest script?

cant seem to find the lines in the includes/admin.php file

regards

Phil Stone
www.buy24-7.net

Submitted by support on Mon, 2010-02-15 14:33

Hi Phil,

In the latest version; look for the following code starting at line 274:

    /* decimalise price */
    $importRecord["price"] = tapestry_decimalise($importRecord["price"]);

...and REPLACE with:

    /* decimalise price */
    $importRecord["price"] = tapestry_decimalise($importRecord["price"]);
    if ($importRecord["price"]=="0.00") return;

Hope this helps!

Cheers,
David.

Submitted by philstone on Mon, 2010-02-15 14:44

thanks dave

i tried this but was wondering as i am using delivery costs would this be preventing this working?

Code at present is

/* decimalise price */
    $importRecord["price"] = tapestry_decimalise($importRecord["price"]);
    if ($importRecord["price"]=="0.00") return;
    $importRecord["delivery"] = tapestry_decimalise($importRecord["delivery"]);
    $importRecord["price"] = $importRecord["price"] + $importRecord["delivery"];
regards

Phil Stone
www.buy24-7.net

Submitted by support on Mon, 2010-02-15 14:50

Hi Phil,

That looks fine - after a re-import (this part of the code is only applied at import time) are you still getting prices as 0.00 for the merchant just imported?

Cheers,
David.

Submitted by philstone on Mon, 2010-02-15 15:29

yeah i reimported a feed but the 0.00 results still imported with the feed

regards

Phil Stone
www.buy24-7.net

Submitted by support on Mon, 2010-02-15 15:35

Hi Phil,

Could you email me with the site URL and the name of the feed and I'll download it from your /feeds/ folder and check the mod out on my test server...

Cheers,
David.