Xavier Vidal Posted March 16, 2009 Share Posted March 16, 2009 We had a category with five products. When we delete the category, the five products are deleted too. Is this a bug or a feature?The products never should be deleted if i not say so. If i delete a category, all the related products must go to "home" category by default and disabled. Link to comment Share on other sites More sharing options...
Dr. Benway Posted March 16, 2009 Share Posted March 16, 2009 not a bug or a feature, simply something missed to do ... so move products before delete category (actually products are not deleted but remains orphans)... or develope by yourself the behaviour you want ... and share it to the community ;-) Link to comment Share on other sites More sharing options...
Xavier Vidal Posted March 16, 2009 Author Share Posted March 16, 2009 Wrong ! Products are deleted. Just take a look at source code (Category.php Line 234)/* Delete products which were\'t in others categories */$result = Db::getInstance()->ExecuteS('SELECT `id_product`FROM `'._DB_PREFIX_.'product`WHERE `id_product` NOT IN (SELECT `id_product` FROM `'._DB_PREFIX_.'category_product`)');foreach ($result as $p){ $product = new Product(intval($p['id_product'])); if (Validate::isLoadedObject($product)) { $product->delete(); }} Link to comment Share on other sites More sharing options...
Dr. Benway Posted March 16, 2009 Share Posted March 16, 2009 Cool ! Now you know where write your code personalisation ;-)Instead of deleting product, move it to home root or where u like ... have a good work, and remember to share it Link to comment Share on other sites More sharing options...
Xavier Vidal Posted March 16, 2009 Author Share Posted March 16, 2009 Yeah, i know how to recode that part. I only wanted to know if this "bug/feature" was known by prestashop's coders.If i change the code i'll submit it to the bugtracker.Thanks Link to comment Share on other sites More sharing options...
Recommended Posts