jfernandojr Posted June 6, 2013 Share Posted June 6, 2013 (edited) Hi, I've imported my products (about 400) from the CSV Importer, everything was perfect, I imported categories, descriptions, prices, features, everything was there when I finish (I had to split in 11 files beacuse the timeout). I checked the store yesterday and everything was there, but today I saw that several products are missing some features!!! Note that I'm the only user and adm, nobody touched in the admin panel and the only thing I did from yesterday to today was change some products descriptions, only! I executed some queries, please take a look: PS: ps_feature and ps_feature_lang are ok with all the records untouched I got one product with problem for example: SELECT * FROM `ps_feature_product` WHERE `id_product` =347 "3","347","729" "4","347","718" "5","347","797" "6","347","754" "7","347","719" Note that all features are there and also the feature values But, now check out the ps_feature_value and ps_feature_value_lang: Query: SELECT * FROM `ps_feature_value` WHERE `id_feature_value` >700 LIMIT 0 , 30 Result: "701","3","1" "702","5","1" "703","3","1" "704","3","1" "705","5","1" "706","5","1" "707","3","1" "708","5","1" "709","5","1" "710","3","1" "711","5","1" "712","5","1" "713","3","1" "714","5","1" "715","5","1" "717","3","1" "721","5","1" "722","3","1" "723","7","1" "724","6","1" "725","5","1" "727","6","1" . . . Where are the features: 718, 719, 720, 726 ??????? Query: SELECT * FROM `ps_feature_value_lang` WHERE `id_feature_value` >700 ORDER BY `id_feature_value` "717","1","10.5% ABV" "717","2","10.5% ABV" "717","3","10.5% ABV" "717","4","10.5% ABV" "717","5","10.5% ABV" "717","6","10.5% ABV" "721","1","Premium American Lager" "721","2","Premium American Lager" "721","3","Premium American Lager" "721","4","Premium American Lager" "721","5","Premium American Lager" "721","6","Premium American Lager" "722","1","4.8% ABV" "722","2","4.8% ABV" "722","3","4.8% ABV" "722","4","4.8% ABV" "722","5","4.8% ABV" "722","6","4.8% ABV" "723","1","0-4 °C" "723","2","0-4 °C" "723","3","0-4 °C" "723","4","0-4 °C" "723","5","0-4 °C" "723","6","0-4 °C" "724","1","Pilsner" "724","2","Pilsner" "724","3","Pilsner" "724","4","Pilsner" "724","5","Pilsner" "724","6","Pilsner" "725","1","Altbier" "725","2","Altbier" "725","3","Altbier" "725","4","Altbier" "725","5","Altbier" "725","6","Altbier" "727","1","Cilíndrico" "727","2","Cilíndrico" "727","3","Cilíndrico" "727","4","Cilíndrico" "727","5","Cilíndrico" "727","6","Cilíndrico" . . . Where are the features: 701,702,703....718, 719, 720....726?????? Please, anyone can help?? Thank you very much! Edited June 6, 2013 by jfernandojr (see edit history) Link to comment Share on other sites More sharing options...
jfernandojr Posted June 9, 2013 Author Share Posted June 9, 2013 no one? Link to comment Share on other sites More sharing options...
jfernandojr Posted July 10, 2013 Author Share Posted July 10, 2013 Well, when I save anything on a single product (ex.: price, description, quantity, etc...) it ruins all the features tables... it's sad, a Prestashop's BIG UGLY BUG! It's a shame... Link to comment Share on other sites More sharing options...
benjamin utterback Posted July 10, 2013 Share Posted July 10, 2013 Hi jfernandojr, are you receiving any errors in the SQL database or from PrestaShop? Have you turned on error reporting? Link to comment Share on other sites More sharing options...
jfernandojr Posted July 10, 2013 Author Share Posted July 10, 2013 Hi Benjamin, I got no errors in prestashop, I will check with the database host. Thanks. Link to comment Share on other sites More sharing options...
jfernandojr Posted July 29, 2013 Author Share Posted July 29, 2013 Bejamin, No errors in database too. Again, If I change anything using prestashop admin panel, the problem occurs. I'm being forced to use SQL to update prices, quantities, etc.......it's sad... Link to comment Share on other sites More sharing options...
benjamin utterback Posted July 29, 2013 Share Posted July 29, 2013 Bejamin, No errors in database too. Again, If I change anything using prestashop admin panel, the problem occurs. I'm being forced to use SQL to update prices, quantities, etc.......it's sad... Hi jfernandojr, the problem is most likely with the uploaded CSV. There is a certain way to add features in the CSV file. Please see this thread for more information and suggested solutions. http://www.prestashop.com/forums/topic/251434-solvedcsv-product-import-features-not-importing/ Link to comment Share on other sites More sharing options...
jfernandojr Posted July 29, 2013 Author Share Posted July 29, 2013 Hi Benjamin, Thank you very much for your attention, but, once again, there's no problem on the importing phase, my CSV is 100% according the right format. Everything is ok (my 400 products are perfectly listed and working very well)... until I save something in an existent product. Prestashop > Catalog > Products > nnnnn > Edit > Price > Save = Mess Actual solution: Update ps_product_shop set price = xxx where id_product = yyyy.....and more... I have not given up yet prestashop, because I know SQL very well, and update some info is easy, but I will have to quit this soon, because there's no way to include new products, unless you write a big sql script...too much work for my taste, it's a shame. Any solution for this bug? Thank you Link to comment Share on other sites More sharing options...
jfernandojr Posted August 12, 2013 Author Share Posted August 12, 2013 No solution at all, right? Link to comment Share on other sites More sharing options...
benjamin utterback Posted August 12, 2013 Share Posted August 12, 2013 When you edit and save a product, that's where the problem occurs. There must be an error somewhere that is being thrown to the database when this happens. Have you gone through the import process on a localhost? Or maybe you can go through the import process again on a duplicate store. Link to comment Share on other sites More sharing options...
wpy Posted August 29, 2013 Share Posted August 29, 2013 Hello, I have exactly the same problem : - Prestashop 1.5.4.1 - Features imported by CSV without problem. (in a localhost, wamp) - Duplication of prestashop on website (OVH). - Update product in administration. - Some feature values dissapears. - No database messages. have you found a solution ? Best regards, Link to comment Share on other sites More sharing options...
nortom Posted August 31, 2013 Share Posted August 31, 2013 i have the same problem after upgrade to 1.5.5 can it be a language problem or conflict with id? Link to comment Share on other sites More sharing options...
wpy Posted September 2, 2013 Share Posted September 2, 2013 (edited) In searching in prestasop code I have found the problem : When the features are imported, the method FeatureValue::addFeatureValueImport is called. All values are imported with "custom" set to 1, but if "id_feature_value" exists the value is not duplicated. Then some products have same feature value but the same id_feature_value too. Instead of two distinct id_feature_value. When you update your product, the features values are deleted and re-created. So in the first step all products which have the same feature values have the feature value deleted. I'm working on an override for the FeatureValue class. For solve the problem I have made this code to execute at root of prestashop : <?php require_once dirname(__FILE__).'/config/config.inc.php'; require_once dirname(__FILE__).'/init.php'; $lines = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'feature_product`;'); $cache = array(); foreach($lines as $line){ $key = $line['id_feature'].':'.$line['id_feature_value']; if(!isset($cache[$key])){ $cache[$key] = $line['id_product']; }else{ $o = new FeatureValue($line['id_feature_value']); $copy = $o->duplicateObject(); Product::addFeatureProductImport($line['id_product'], $line['id_feature'], $copy->id); } } Best regards, Edited September 2, 2013 by wpy (see edit history) Link to comment Share on other sites More sharing options...
seanloo Posted September 17, 2013 Share Posted September 17, 2013 Same problem here. I'm using PS 1.5.5.0 1) Import categories, products and combinations using CSV files -> After import csv, no errors, then check products randomly. OK. No problem. 2) Enable Multistore, add a new shop (same shop group, share Qty to sell) -> check products randomly. OK. No problem. 3) In new shop (multistore), edit a product (id_product=1) on price and Qty -> the second product (id_product=2), a feature's value is missing. The more products you have edit, the more other products' feature values are missing (id_product=2, 3, 4, ...) Remark 1: My "Features" has 4 custom values (height, length, width, weight), and 3 pre-defined values (material, printing, packaging). Remark 2: Two years ago, I have created a shop using PS 1.4.X. There are no such BIG BUG! Link to comment Share on other sites More sharing options...
seanloo Posted September 17, 2013 Share Posted September 17, 2013 Maybe this is solution:- http://forge.prestashop.com/browse/PSCFV-7907 Link to comment Share on other sites More sharing options...
seanloo Posted September 17, 2013 Share Posted September 17, 2013 (edited) I have confirmed that the problem occurs if you have at least one pre-defined values on "Features". If you use all customized values, there are no problems. Refer this solution http://forge.prestashop.com/browse/PSCFV-7907 In ROOT\classes\FeatureValue.php, addFeatureValueImport() function 1) Change feature_value->custom = 1;" to "$feature_value->custom = 0;" not work for me. 2) Regarding the revised code as per following:- a) $custom = 0; // the code still not work... $custom = 1; // it's work if you accept change all the pre-defined values to customized values (but SQL database file size becomes larger...) public static function addFeatureValueImport($id_feature, $name, $custom) // $custom true = NOT synchronized / $custom false = synchronized { $already_exists = false; $id_feature_value = null; $custom = 1; // Set this value $custom = 0 or 1; to choose pre-defined value or customized value if (!$custom) { $rq = Db::getInstance()->executeS(' SELECT fv.`id_feature_value` FROM '._DB_PREFIX_.'feature_value fv LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.`id_feature_value` = fv.`id_feature_value`) WHERE `value` = \''.pSQL($name).'\' AND fv.`id_feature` = '.(int)$id_feature.' GROUP BY fv.`id_feature_value` LIMIT 1 '); if (isset($rq[0]['id_feature_value']) && $rq[0]['id_feature_value'] ) { $id_feature_value = (int) $rq[0]['id_feature_value']; $already_exists = true; } } // If the feature value is custom for each product or if it is reused and doesn't already exist, we insert it if ($custom || !$already_exists) { $feature_value = new FeatureValue(); $languages = Language::getLanguages(); foreach ($languages as $language) $feature_value->value[$language['id_lang']] = strval($name); $feature_value->id_feature = (int)$id_feature; $feature_value->custom = $custom; $feature_value->add(); $id_feature_value = (int) $feature_value->id; } return $id_feature_value; } Edited September 17, 2013 by seanloo (see edit history) Link to comment Share on other sites More sharing options...
CoolTom Posted October 24, 2013 Share Posted October 24, 2013 So no solution?? Its quite serious problem. What if you have shop with thousants of products? U can not use BO for editing :{ Link to comment Share on other sites More sharing options...
benjamin utterback Posted October 24, 2013 Share Posted October 24, 2013 There was a Github fix here, https://github.com/PrestaShop/PrestaShop/commit/5d28d38a2250f497a78b4c6b7b855578aab4d7be I went ahead and attached the file that has the code changes in it. Please make sure to BACK UP before you touch any file via FTP How to Manually Back Up your PrestaShop Database and Files After you confirm the backup. Use this file to test on your dev/test store. If everything works out, you can use it on your live store. the classes/FeatureValue.php file is attached. If you have 1.5 you can replace your current classes/FeatureValue.php with this file. FeatureValue.php 1 Link to comment Share on other sites More sharing options...
CoolTom Posted October 24, 2013 Share Posted October 24, 2013 (edited) Hi, thank you for fast answer. I just found it in another topic. Sorry writting before reading 0:-] I am already trying new import. There are 2 file changed in: https://github.com/PrestaShop/PrestaShop/commit/5d28d38a2250f497a78b4c6b7b855578aab4d7be. Should I replace just this one or this one too ---> controllers/admin/AdminImportController.php ? I just installed last release 1.5.6.0 for this. Trying to move old data into now installation ... Edited October 24, 2013 by CoolTom (see edit history) Link to comment Share on other sites More sharing options...
CoolTom Posted October 24, 2013 Share Posted October 24, 2013 It looks like it works. no more double values after import. I replaced bouth files. PS v 1.5.6.0 Link to comment Share on other sites More sharing options...
promod Posted November 26, 2013 Share Posted November 26, 2013 Is that seanloo solution or https://github.com/PrestaShop/PrestaShop/commit/5d28d38a2250f497a78b4c6b7b855578aab4d7be allow a product import with predefined features in the backoffice ? I have 800 products in my import list, but I set my features in a backoffice... Approximately 10 and I need to import my products but I need to use predefined features for filters and search. For the moment all features in the CSV are imported as custom features and so for the country feature I have a lot of the same value. Somebody can help me ? Link to comment Share on other sites More sharing options...
frigaard Posted September 26, 2014 Share Posted September 26, 2014 I used the solution on Github (suggested by benjamin utterback)"There was a Github fix here, https://github.com/P...b855578aab4d7be " And it seamed to work fine. BUT... It have caused a different problem. I want to import just the price, via CSV import. When I do that all the features get reset. (I use PS 1.52) Link to comment Share on other sites More sharing options...
Recommended Posts