ramble Posted January 7, 2011 Share Posted January 7, 2011 Hi, does somebody find any solution what and where has to be changed to have posibility use negative quantities? If I want to sell item which is not in stock quantity stay on 0. After I restock that item the quantity is obviously wrong.Thanks for any advice! Link to comment Share on other sites More sharing options...
ramble Posted January 10, 2011 Author Share Posted January 10, 2011 Really nobody knows ? I found some french topic and negative quantity itself is working but button “Re-stock products” and “Cancel products” in Orders are not working at all.I would be glad for any help.This is the code from culte which is working (without re-stocking) for PS 1.3: public static function updateQuantity($product) { if (!is_array($product)) die (Tools::displayError()); if (Pack::isPack(intval($product['id_product']))) { $products_pack = Pack::getItems(intval($product['id_product']), intval(Configuration::get('PS_LANG_DEFAULT'))); foreach($products_pack AS $product_pack) { $tab_product_pack['id_product'] = intval($product_pack->id); $tab_product_pack['id_product_attribute'] = self::getDefaultAttribute($tab_product_pack['id_product'], 1); $tab_product_pack['cart_quantity'] = intval($product_pack->pack_quantity * $product['cart_quantity']); self::updateQuantity($tab_product_pack); } } $result = Db::getInstance()->getRow(' SELECT `quantity` FROM `'._DB_PREFIX_.($product['id_product_attribute'] ? 'product_attribute' : 'product').'` WHERE `id_product` = '.intval($product['id_product']).($product['id_product_attribute'] ? ' AND `id_product_attribute` = '.intval($product['id_product_attribute']) : '')); if (!Configuration::get('PS_STOCK_MANAGEMENT')) return true; Db::getInstance()->Execute(' UPDATE `'._DB_PREFIX_.'product'.($product['id_product_attribute'] ? '_attribute' : '').'` SET `quantity` = `quantity`-'.intval($product['cart_quantity']).' WHERE `id_product` = '.intval($product['id_product']). ($product['id_product_attribute'] ? ' AND `id_product_attribute` = '.intval($product['id_product_attribute']) : '')); if (self::isAvailableWhenOutOfStock($product['out_of_stock']) AND intval($result['quantity']) == 0) return -1; if ($result['quantity'] < $product['cart_quantity']) { return false; } return true; } Link to comment Share on other sites More sharing options...
ramble Posted January 17, 2011 Author Share Posted January 17, 2011 There is also necessary to change type of quantity also in class product.php 'quantity' => 'isUnsignedInt' to 'quantity' => 'isInt' and change type of column quantity in table ps_product in database. You have to remove "UNSIGNED".But restocking and canceling is still not possible. 1 Link to comment Share on other sites More sharing options...
jamshill Posted January 17, 2011 Share Posted January 17, 2011 Hi All,I need some help for my project. One of my customer has problem related to their inventory. A user enter item journal with type = Positive Adjustment for an item, but unfortunately she made mistake by entering negative quantity and post it.My question is, how can I fix this problem?Can I create item journal, and enter type = Positive adjustment and positive quantity and then apply it to the wrong line in item ledger entry? Will this solve the problem? Or will this scenario make thing worse? Is there any problem with the item cost if I do the scenario?Anyone has ever face the same problem? Please help me. Any suggestion will be very helpful. Thank you.Regards,James Link to comment Share on other sites More sharing options...
Recommended Posts