You are here:  » Small Dilema


Small Dilema

Submitted by stevewales20 on Sat, 2008-04-19 13:39 in

Hi david. Would like to say thanks firstly, the script has significantly reduced the time needed to create a price comparison site.

Right, the problem i have is i've gone about creating my own categories/subcategories I've also created a duplicate of the products table "Site_Products". I've heavily modified the "Site_Products" table by manually updating the category/subcategories or the products.

What i'm looking to do is have the script import without removing the existing products within the "products" table unless of course there no longer in the feed. Basically i want to use the "products" table to create the dupe_hash which im hoping i can use on the "Site_Products" table to update it from the old table.

Basically in a nutshell with all of my gibberish removed, im looking to import the data from one table to another, only updating the price field and url.

I hope this makes sense. If it doesn't i'll try clarify things further.

Kind reguards
Steve

Submitted by support on Sat, 2008-04-19 17:48

Hi Steve,

As it sounds like you're reasonably confident with database modifications etc.; the way this is usually achieved is by using a "delete me" flag on the table.

As it stands, the all products (for a particular merchant) are deleted before import; and therefore after import all products are as per the latest version of the feed.

If you want to preserve the products table in order to keep additional information; the trick is to add a field called "deleteme", and then set it to 1 for all products before import....

UPDATE products SET deleteme=1 WHERE merchant='Merchant Name'

Next, the import procedure is modified to first check for an existing product; and then UPDATE if it exists setting deleteme to 0, or INSERT if it is a new product (with deleteme defaulting to 0).

After import, products no longer valid will still have the deleteme flag set, so they can be removed with:

DELETE FROM products WHERE deleteme=1 AND merchant='Merchant Name'

Hope this helps!

Cheers,
David.

Submitted by stevewales20 on Sun, 2008-04-20 18:01

Thanks david,

I'll have a go at doing this shortly. I assumed something like this could be done, i've not really gone into the import script as of yet. Been busy with other parts of the script.

Cheers,
steve