rob84 Posted May 27, 2014 Share Posted May 27, 2014 Hello. I'm trying to update products with CSV import function. After creating the CSV and imported it, all works fine. Now the problem is the our suppliers update some informations in CSV 4 times a day, and i'm finding a way to update quantity in stock, and pricing. Unfortunately when I import only 2 columns (ignoring all the others), the quantiy and pricing update succesfully, but I lost all other informations. I use the key as product reference, 'cause I can't use the product ID's which is different from the supplier ID's. Now the goal is to import and update only interested columns, keeping all others information that are not imported. I found this code in adminimport.php if (Tools::getValue('match_ref') == 1 AND $product->reference AND Product::existsRefInDatabase($product->reference)) { $datas = Db::getInstance()->getRow('SELECT `date_add`, `id_product` FROM `'._DB_PREFIX_.'product` WHERE `reference` = "'.$product->reference.'"'); $product->id = pSQL($datas['id_product']); $product->date_add = pSQL($datas['date_add']); $res = $product->update(); } // Else If id product AND id product already in base, trying to update else if ($product->id AND Product::existsInDatabase((int)($product->id), 'product')) { $datas = Db::getInstance()->getRow('SELECT `date_add` FROM `'._DB_PREFIX_.'product` WHERE `id_product` = '.(int)($product->id)); $product->date_add = pSQL($datas['date_add']); $res = $product->update(); } Can someone help ? Thanks. Ps: 1.4.7.3 Link to comment Share on other sites More sharing options...
rob84 Posted May 28, 2014 Author Share Posted May 28, 2014 If I create CSV file with only 3 columns (Reference, name, quantity in stock), and using "use key as product reference", the problem still remain. How can I say to prestashop while importing a CSV that "if product reference already exist" and "if I select to ignore some other columns" other informations must remain the same and not drawn ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now