frosticek Posted November 15, 2010 Share Posted November 15, 2010 Hi!I have one big problem. In my shop, when I order som quantity of product (i.e. 10 and in stock there ist 500 pieces of this product), everything is all right until I want to see details of order, there is not quantity of bought product, but quantity in stock, how can i fix it ?? ... My version is PS 1.3.1. See image in attachement and pdf.Thanks for any help !!!/sorry for my english, i am slovak 000011.pdf Link to comment Share on other sites More sharing options...
rocky Posted November 16, 2010 Share Posted November 16, 2010 This is an old bug that was fixed a long time ago. I'm not sure why it is affecting you. Is the quantity correct on the shopping cart summary? If so, then it must be the payment module. Check it's TPL code and make sure that cart_quantity is being used and not stock_quantity or just quantity. Link to comment Share on other sites More sharing options...
frosticek Posted November 16, 2010 Author Share Posted November 16, 2010 Ok, you were right, problem is somewhere in .php file, not tpl, i think problem is in this piece of code: /* Query */ /* end foreach ($products) */ $query = rtrim($query, ','); $result = $db->Execute($query); /* Insert discounts from cart into order_discount table */ $discounts = $cart->getDiscounts(); $discountsList = ''; foreach ($discounts AS $discount) { $objDiscount = new Discount(intval($discount['id_discount'])); $value = $objDiscount->getValue(sizeof($discounts), $cart->getOrderTotal(true, 1), $order->total_shipping, $cart->id); $order->addDiscount($objDiscount->id, $objDiscount->name, $value); if ($id_order_state != _PS_OS_ERROR_ AND $id_order_state != _PS_OS_CANCELED_) $objDiscount->quantity = $objDiscount->quantity - 1; $objDiscount->update(); $discountsList .= ' '.$this->l('Voucher code:').' '.$objDiscount->name.' -'.Tools::displayPrice($value, $currency, false, false).' '; } /* Specify order id for message */ $oldMessage = Message::getMessageByCartId(intval($cart->id)); if ($oldMessage) { $message = new Message(intval($oldMessage['id_message'])); $message->id_order = intval($order->id); $message->update(); } /* Hook new order */ $orderStatus = new OrderState(intval($id_order_state)); if (Validate::isLoadedObject($orderStatus)) { Hook::newOrder($cart, $order, $customer, $currency, $orderStatus); foreach ($cart->getProducts() as $product) if ($orderStatus->logable) ProductSale::addProductSale($product['id_product'], $product['quantity']); } But I cant find any error. I re cashondeliverywithfee.php Link to comment Share on other sites More sharing options...
rocky Posted November 16, 2010 Share Posted November 16, 2010 Yep, the module is using old buggy code. You should change all: $product['quantity'] to: $product['cart_quantity'] Link to comment Share on other sites More sharing options...
frosticek Posted November 17, 2010 Author Share Posted November 17, 2010 Absoulutely great !! Thank you very much !! Link to comment Share on other sites More sharing options...
Recommended Posts