Display order product lines with 0 quantity units.

  • Posts: 634
  • Thank you received: 16
  • Hikashop Business
5 years 10 months ago #292812

-- HikaShop version -- : 3.4.0
-- HikaMarket version -- : 2.1.1
-- Joomla version -- : 3.8.7
-- PHP version -- : 7.1.0

Hi,

I'm using this code on a custom view to display an order:

$orderClass = hikashop_get('class.order');
$order = $orderClass->loadFullOrder($order_id, true, false);

But, if any product line in that order have quantity as 0 (because it's a product that doesn't have stock and we can't serve it), it simply doesn't being displayed.

We need that lines to be show.

Is there some way to display it?

Thanks in advance.

--
Victor

Please Log in or Create an account to join the conversation.

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
5 years 10 months ago #292821

Hi,

First, this code doesn't display anything. It only loads the data from the database for an order.
Second, the quantity of a product in the shop has nothing to do with the product in the order being in $order->products or not.
Only the order_product_quantity is taken into account and that's the quantity of the product in the order (the quantity of the product bought). If the order_product_quantity is equal to 0, then that means that the product was not bought and thus the information of that product is discarded in loadFullOrder. It's totally normal and that's what we want.
Otherwise, when you delete a product in an order, you would still get the row in the order, the invoice, etc.
If you really need them, then you need to run a MySQL query yourself on the hikashop_order_product table to load the products of the order yourself.

The following user(s) said Thank You: PeterChain

Please Log in or Create an account to join the conversation.

Time to create page: 0.052 seconds
Powered by Kunena Forum