You are here:  » Drop record below a certain price point


Drop record below a certain price point

Submitted by IG on Wed, 2018-10-17 09:23 in

Hi David

How can I drop all records during import that are below a certain price point? Is there a filter for this? Let's say, I want to drop all records below 100USD.

Kind regards,
IG

Submitted by support on Wed, 2018-10-17 09:37

Hello IG,

Sure, there is a Price Range filter in this post to do exactly that - you can specify a minimum, maximum or both to filter by...

Cheers,
David.
--
PriceTapestry.com

Submitted by IG on Thu, 2018-10-18 18:28

Hi David

This works perfectly. Thank you.

I trying to get my head around about the following problem and wonder if you have a solution for me:

Let's say I import all products with a price > 100USD of feed A. All these products have an EAN code. Now I would like to import all products < 100USD of feed B plus all products of feed B that are > 100USD, but have the same EAN code of the already imported products of feed A.

Probably, I would need a filter or a script that drops all products below a certain price level after they have been matched by EAN.

Can you think of a way that this would be possible?

Cheers,
IG

Submitted by support on Fri, 2018-10-19 08:57

Hello IG,

You could hard code this relatively easily into a post import query having imported all of feed B (so no price range filter). The easiest place to add post-import queries that run after every import method is in the admin_importReviews() function in includes/admin.php. To give this a go, look for the following code at line 748:

    global $config_databaseTablePrefix;

...and REPLACE with:

    global $config_databaseTablePrefix;
    $sql = "SELECT ean FROM `".$config_databaseTablePrefix."products` WHERE filename='feed A'";
    database_querySelect($sql,$rows);
    $ins = array();
    foreach($rows as $row)
    {
      $ins[] = "'".database_safe($row["ean"])."'";
    }
    $in = implode(",",$ins);
    $sql = "DELETE FROM `".$config_databaseTablePrefix."products` WHERE filename='feed B' AND price > '100.00' AND ean NOT IN (".$in.")";
    database_queryModify($sql,$result);

Just replace feed A and feed B with the actual filenames and that (memory permitting) should do the trick. If this doesn't work because feed A is huge and the ean list is too big to fit into memory let me know and I'll work it out as a buffered query for you...

Cheers,
David.
--
PriceTapestry.com