6poD9Ira Posted February 1, 2011 Share Posted February 1, 2011 Hello all.Need to update the prices directly from the price supplier on the code manufacturers or supplier code.Example.This price supplier:supplier code | NAME ITEM | code manufacturer | price:1106734 | CPU Intel CDC E3400 2600/800/1M S775 (oem) SLGTZ | AT80571RG0641ML | 421111277 | CPU Intel CDC E3500 2700/800/1M S775 (oem) SLGTY | AT80571RG0681ML | 521110725 | CPU Intel PDC E5500 2800/800/2M S775 (oem) SLGTJ | AT80571PG0722ML | 56,51111275 | CPU Intel PDC E5700 3000/800/2M S775 (oem) SLGTH | AT80571PG0802ML | 59,51111865 | CPU Intel PDC E5700 3000/800/2M S775 (box) SLGTH | BX80571E5700 | 69Standard module imports do not allow this, because asks for the Product ID and group name. (import->combinations)Thank you for your answers.sorry for my english -----------------------------------------This: public static function GETInDatabasID($supplier_reference) { $row = Db::getInstance()->getRow( 'SELECT supplier_reference,id_product FROM '._DB_PREFIX_.'product WHERE supplier_reference = "'.$supplier_reference.'"'); return $row['id_product']; } insert in classes/product.phpThis: $ttttt=Product::GETInDatabasID($info['supplier_reference']); if ( $ttttt>0) { $info=array('id'=>$ttttt)+$info;; } Insert in (admin)/tabs/adminimport.php after: public function productImport() { ....... { if (Tools::getValue('convert')) $this->utf8_encode_array($line); $info = self::getMaskedRow($line); You can choose reference, supplier_reference and more.Tools -> import ->products and update Link to comment Share on other sites More sharing options...
mtanislav Posted April 18, 2011 Share Posted April 18, 2011 works, ty Link to comment Share on other sites More sharing options...
homesteadcastle Posted May 11, 2011 Share Posted May 11, 2011 Does this also allow updating of quantity? I'm not quite following how the code works or what to now use instead of the product id to link it the current database.I'm going to be importing a weekly update from one of my vendors. The csv file the send me won't have my product id, but it will have the name, which is exactly the same name I'm using in prestashop. Would anyone be able to explain how the above code could be used to achieve my goals or help me on tweaking the code? Thanks in advance. Link to comment Share on other sites More sharing options...
mtanislav Posted May 11, 2011 Share Posted May 11, 2011 instead of supplier_reference put name , or whatever the name of the field you want to match. Ex: I wanted to match the reference number and not the supplier , so I change supplier_reference to reference and it works. PS: please note that you must check and see what is the real name of the field , because there are many different names , depending on the language that you use. ex: for me the english name is "name_1" and the romanian name is "name_7". And please do a backup first of your DB and the entire shop before you will do this. Link to comment Share on other sites More sharing options...
homesteadcastle Posted May 11, 2011 Share Posted May 11, 2011 Excellent. Thanks. Link to comment Share on other sites More sharing options...
homesteadcastle Posted May 11, 2011 Share Posted May 11, 2011 Your example was perfect, since I'm from the US the name_1 is what I need to use. However, I've made the changes and the website goes down. I can go to the site after I've made changes to both of the files and I just get a white page (no errors showing).However, I can go in and restore the products.php back back to the original coding and the website comes back up. Here is the code that I changed (with a bit above and below the additions). What am I doing wrong? Thanks in advance. Your example was perfect, since I'm from the US the name_1 is what I need to use. However, I've made the changes and the website goes down. I can go to the site after I've made changes to both of the files and I just get a white page (no errors showing).However, I can go in and restore the products.php back back to the original coding and the website comes back up. Here is the code that I changed (with a bit above and below the additions). What am I doing wrong? Thanks in advance. 'categories' => array('resource' => 'category', 'fields' => array( 'id' => array('required' => true), )), 'images' => array('resource' => 'image','fields' => array('id' => array()) ), ), ); public static function GETInDatabasID($name_1){ $row = Db::getInstance()->getRow( 'SELECT name_1,id_product FROM '._DB_PREFIX_.'product WHERE name_1 = "'.$name_1.'"'); return $row['id_product'];}public function getCoverWs() { $result = $this->getCover($this->id); return $result['id_image']; } public function getWsImages() { Link to comment Share on other sites More sharing options...
outblast Posted June 5, 2011 Share Posted June 5, 2011 Great, this is what i need, works on 1.4.2.5 version?Txs Link to comment Share on other sites More sharing options...
mtanislav Posted June 5, 2011 Share Posted June 5, 2011 Great, this is what i need, works on 1.4.2.5 version?Txs Don't know, but you can try and let us know. Link to comment Share on other sites More sharing options...
ffrreedd Posted June 7, 2011 Share Posted June 7, 2011 Version 1.3.1.1 after changes a site doesn't work. Help as to correct? Link to comment Share on other sites More sharing options...
ffrreedd Posted June 7, 2011 Share Posted June 7, 2011 More precisely how to correct the code what goods update has earned under the article. Link to comment Share on other sites More sharing options...
Recommended Posts