Jump to content

PDF Invoice - sort products by name


Recommended Posts

Please, if someone knows, let me know is it possible to sort products by name on PDF invoices?

 

It would be great if we can sort them by name somehow on PDF Invoices because we prepare orders from that list. Currently, preparing is quite complicated because by default, product are sorted by ID and we have to go back to the one category (one part of our big store :)) XY times.

 

I guess I should change the file /classes/Order.php and maybe classes/OrderDetail.php - to add some ORDER by product_name line? Or maybe some file which generate PDF Invoice?

 

Any help will be greatly appreciated.

 

p.s. I use Prestashop version: 1.5.3.1

Edited by Little Fairy (see edit history)
Link to comment
Share on other sites

  • 2 months later...
  • 3 months later...
  • 3 months later...

This seem to work,

 

In Classes\Order\OrderInvoice.php 

line 114-124 change to:

public function getProductsDetail()
{
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT *
FROM `'._DB_PREFIX_.'order_detail` od
LEFT JOIN `'._DB_PREFIX_.'product` p
ON p.id_product = od.product_id
LEFT JOIN `'._DB_PREFIX_.'product_shop` ps ON (ps.id_product = p.id_product AND ps.id_shop = od.id_shop)
WHERE od.`id_order` = '.(int)$this->id_order.'
AND od.`id_order_invoice` = '.(int)$this->id.' ORDER BY od.product_name');
}
Link to comment
Share on other sites

×
×
  • Create New...