MohammadAmine Posted May 12, 2013 Share Posted May 12, 2013 Hello guys, i have multi-store activated, i have 3 stores. - when i change Qty in ps_products table, Qty doesn't change in prestashop backend. - when i change Qty in backend, Qty in ps_products table doesn't change, in fact, i get a new row in ps_stock_available table with the product that i change Qty for. - can someone tell me exactly what to do to change all product's Qty in 3 stores to "1" ? Thank you Link to comment Share on other sites More sharing options...
vekia Posted May 12, 2013 Share Posted May 12, 2013 you should apply changes to the ps_stock_available table, mysql query: UPDATE ps_stock_available SET quantity=1 Link to comment Share on other sites More sharing options...
MohammadAmine Posted May 12, 2013 Author Share Posted May 12, 2013 thnx vekia, i already did, but ps_stock_available table doesn't contain all products, it contains only those products that already have Qty > 0, but all my product's Qty are set to "--", i don't know if -- means 0 or something. Link to comment Share on other sites More sharing options...
Trip Posted May 12, 2013 Share Posted May 12, 2013 This is not exact what you need but when you have basic knowledge you can put that in a self coded module and modify it to your needs. $products = Db::getInstance()->ExecuteS('SELECT id_product, quantity FROM `ps_product` WHERE advanced_stock_management=0' ); foreach ($products AS $product) { Db::getInstance()->Execute('INSERT INTO `ps_stock_available`(`id_product`, `id_product_attribute`, `id_shop`, `id_shop_group`, `quantity`, `depends_on_stock`, `out_of_stock`) VALUES ('.$product['id_product'].',0,0,1,'.$product['quantity'].',0,0)'); } The imo cleaner function is StockAvailable::setQuantity(Tools::getValue('id_product'), '', Tools::getValue('quantity')); . So but please modify it to your needs and test this on a test installation. Link to comment Share on other sites More sharing options...
MohammadAmine Posted May 12, 2013 Author Share Posted May 12, 2013 i don't get this, i want an easy query that i can type on mysql, where are prestashop developers and moderators ? i'm using 1.5.0.7 Link to comment Share on other sites More sharing options...
Trip Posted May 13, 2013 Share Posted May 13, 2013 There is no easy query. As you found out not all product id's are stored in the stock available from the beginning. Imo it is easier to generate the queries in php but I've seen you can make loops in MySQL too. http://dev.mysql.com/doc/refman/5.0/en/loop.htm The basic principle in my approach is loop through all products in ps_product and copy the id's and amount to product_available. I doubt that anybody here built a mysql query doing that. Good luck with that, trip Link to comment Share on other sites More sharing options...
MohammadAmine Posted May 13, 2013 Author Share Posted May 13, 2013 where are moderators ? is this a bug that ps developers can't fix or what ? Link to comment Share on other sites More sharing options...
vekia Posted May 13, 2013 Share Posted May 13, 2013 it isn't bug, this is how prestashop works. You probably have advanced stock management turned to on, am I right? Link to comment Share on other sites More sharing options...
MohammadAmine Posted May 13, 2013 Author Share Posted May 13, 2013 no, it is not turned to on Link to comment Share on other sites More sharing options...
prestashop-new Posted September 2, 2014 Share Posted September 2, 2014 Can any one suggest me on how to update product attributes from phpmyadmin. Like : for Product A which is in ps_product table with reference and id_product whose combination/attribute is in ps_stock_available For example : I have to update all the attributes for a product. I am unable to map id_product_attribute. Product A has 4 attributes : A1 A2 A3 A4 And for each I have to update Quantity so what will be the UPDATE Query assuming that we have ONLY reference and quantity. Please Guide. Link to comment Share on other sites More sharing options...
Recommended Posts