Jump to content

Ordinare i prodotti in fattura in ordine alfabetico


freuxbang

Recommended Posts

  • 2 weeks later...

È necessario creare una funzione di ordinamento per $this->order_invoice->getProducts() array. Vedere funzione getContent() nel file HTMLTemplateInvoice.php.
You must create a sort function for $this->order_invoice->getProducts() array. See getContent() function in HTMLTemplateInvoice.php file.

 

Oppure utilizzando il modulo M4 PDF Extensions s è possibile ordinare per nome del prodotto in questo modo (un esempio dal modello m4_invoice_pack_group.tpl):

Or using the M4 PDF Extensions module you can sort by product name this way (an example from m4_invoice_pack_group.tpl template):

{foreach from=$order[orders].order_detail|@sortby:"product_name" item=order_detail}
Link to comment
Share on other sites

Grazie, cmq ho risolto modificando la funzione getProductsDetail che si trova in Classes\Order\OrderInvoice.php

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 an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...