Forums / General Questions / Products quantity on order NOT ordered products quantity

Products quantity on order NOT ordered products quantity

Views: 579

Results 1 to 3 of 3
28 Sep 2015, 7:38 AM
#1
perfumbg avatar

perfumbg

Zen Follower

Join Date:
May 2010
Posts:
192
Plugin Contributions:
5

Products quantity on order NOT ordered products quantity

Hello, currently I am trying to show the products quantity on order right after $order->products[$i]['qty'] I want to see the exact quantity avaliable in stock.

Something like this:

Products Model Tax Price (ex) Price (inc) Total (ex) Total (inc)
1 from 25 x Russell Hobbs RH18521 / 1800W RH18521 0% 99,00$ 99,00$. 99,00$ 99,00$

The code I added to admin->orders.php is:

<?php $products_qty_raw = ("select p.products_quantity,o.orders_products_id, o.products_id, p.products_id
                                from " . TABLE_PRODUCTS . " p, " . TABLE_ORDERS_PRODUCTS . " o							
                                where p.products_id = o.products_id
                                and orders_id = " . (int)$order_id . ""
                                );
								$pqty = 'p.products_quantity';
								?>

and after that i used $pqty to show the current stock but nothing happens.

Any help is Appreciated.

My most recent work: magprom.net

28 Sep 2015, 8:08 AM
#2
perfumbg avatar

perfumbg

Zen Follower

Join Date:
May 2010
Posts:
192
Plugin Contributions:
5

Re: Products quantity on order NOT ordered products quantity

Mistery sold by me :)

If anybody want the same thing it can be achieved by adding this line

 $products_qty_raw = ("select products_quantity, products_id 
                                from " . TABLE_PRODUCTS . "                            
                                where products_id = " . $order->products[$i]['id'] . "" 
                                ); 
		$pqty = $db->Execute($products_qty_raw); 

just before

<td class="dataTableContent" valign="top">' . $order->products[$i]['name'];

and then put $pqty->fields['products_quantity'] wherever you want to show the product stock quantity on orders page.

My most recent work: magprom.net

28 Sep 2015, 3:48 PM
#3
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Products quantity on order NOT ordered products quantity

There's actually a ZC function that returns the quantity of a product remaining which if used becomes pretty much upgrade proof

echo zen_get_products_stock($order->products[$i]['id']);

This of course provides an indication of quantity ordered related to current stock on hand, not necessarily the stock that was on hand when the order was made... Care should be taken to not end up over stocking the warehouse because of possible administrative mistakes.

If reviewing orders weeks, months, etc. after the original order has been fullfilled, the additional information about current available quantity won't mean much.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...