Guest Posted September 17, 2005 Posted September 17, 2005 I'm setting up a webshop with osCommerce. This shop will contain 4.000+ products, so adding and updating them by hand is impossible. Therefore, I use Easy Populate to get all the items from a CVS sheet in the database. I have a question about updating the products though. Every week, products will be updated using CVS sheet list. This list comes from our supplier. However, this list contains not only new or updated products, but ALL products. The name on this list is not the name we want in our shop, since it use abbreviations and such. Therefore, the name field should not be updated if the product already exists in the database. I tried just leaving the name column out of the CVS sheet, but that doesn't work if there are new products: they then have no name and are not shown, nor on the frontpage, nor in the admin area, and I can't add a name to them. I could ofcourse dive into PHPMyAdmin, but that's too much of a hassle. To get around this, I'd want to update the name field ONLY if the product is new. Easy Populate recognizes if a product is new out of the box, so I think it should be possible without too much trouble, but I don't know how I could do this. Someone has a piece of code or some other solution? Quote
Guest Posted September 17, 2005 Posted September 17, 2005 OK, I've found the solution already. I searched in the easypopulate.php for "New Product", since that is what it says when you add a new product. A little under that, there are the functions to insert a new product into the DB, or update the fields, if the product exists. Look for this code: $sql = "UPDATE ".TABLE_PRODUCTS_DESCRIPTION." SET products_name='$name', products_description='".$v_products_description[$key] . "', products_url='" . $v_products_url[$key] . "' And delete the line that syas "products_name='$name'," and your done :) I now have another problem though... Sometimes, items are discontinued and then removed from our suppliers list. So, if a product is no longer on the list, I want it removed from the DB. Again, this can be done manually, but that's a hell of a job: every week, maybe 10 of 4000+ products are removed. Scanning for discontinued products manually takes to long. Any way to do this? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.