Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sort packingslip by products_sort_order


pordoeb

Recommended Posts

Posted

Hi,

 

i want to display the products in packingslip.php sorted by products_sort_order from the table TABLE_PRODUCTS.

 

I have tried it with this query, but it shows nothing :huh:

 

$orders_products_query = 
tep_db_query("SELECT op.orders_products_id, op.products_id, op.products_name, 
op.products_model, op.products_price, op.products_tax, 
op.products_quantity, op.final_price,
p.products_id, p.products_sort_order
FROM " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_PRODUCTS . " p
WHERE op.products_id = '" . (int)$order_id . "' AND p.products_id = '" . (int)$order_id . "'
ORDER BY p.products_sort_order ASC");

 

I hope someone can help me to integrate this.

 

 

lg pordoeb

Posted

Hi,

 

i have found this thread bevor but the articels in my warehouse are sorted like the products_sort_order from the table TABLE_PRODUCTS.

 

All products in my shop have a following number (products_sort_order in TABLE_PRODUCTS) - each by each.

 

 

greets pordoeb

Posted
All products in my shop have a following number (products_sort_order in TABLE_PRODUCTS) - each by each.
And ?

 

So you can't change the order_query in admin/includes/classes/order.php (around line 82) to:

	  $orders_products_query = tep_db_query("select op.orders_products_id, op.products_name, op.products_model, op.products_price, op.products_tax, op.products_quantity, op.final_price, p.products_sort_order from " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_PRODUCTS . " p where orders_id = '" . (int)$order_id . "' and op.orders_products_id = p.products_sort_order");
  while ($orders_products = tep_db_fetch_array($orders_products_query)) {
	$this->products[$index] = array('qty' => $orders_products['products_quantity'],
									'name' => $orders_products['products_name'],
									'model' => $orders_products['products_model'],
									'tax' => $orders_products['products_tax'],
									'price' => $orders_products['products_price'],
								   'products_sort_order' => $orders_products['products_sort_order'],
									'final_price' => $orders_products['final_price']);

and then change that line in packingslip.php to:

   $order->products = columnSort($order->products, 'products_sort_order');

?

Posted

Yeah your my man, great job. you brought me on the right way :)

 

This code makes it for me:

 

$orders_products_query = tep_db_query("select op.orders_products_id, op.products_name, op.products_model, op.products_price, op.products_tax, op.products_quantity, op.final_price, p.products_id, p.products_sort_order from orders_products op, products p where op.orders_id = '" . (int)$order_id . "' and op.products_id = p.products_id ORDER BY p.products_sort_order DESC");

while ($orders_products = tep_db_fetch_array($orders_products_query)) {
$this->products[$index] = array('qty' => $orders_products['products_quantity'],
'name' => $orders_products['products_name'],
'model' => $orders_products['products_model'],
'tax' => $orders_products['products_tax'],
'price' => $orders_products['products_price'],
'final_price' => $orders_products['final_price'],
'products_sort_order' => $orders_products['products_sort_order']);

 

thanks a lot - this night i will sleep a lot better than the 4 nights bevor :D

 

lg pordoeb

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...