Skip to content

Instantly share code, notes, and snippets.

@Hotfirenet
Created March 23, 2020 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hotfirenet/d51fc066329869ec17b3c033cd347794 to your computer and use it in GitHub Desktop.
Save Hotfirenet/d51fc066329869ec17b3c033cd347794 to your computer and use it in GitHub Desktop.
Article HFN - Classer par marque et référence les produits dans le BL et la facture Prestashop - https://hotfirenet.com/blog/2689-classer-par-marque-et-reference-les-produits-dans-le-bl-et-la-facture-prestasop/
<?php
class OrderInvoice extends OrderInvoiceCore {
public function getProductsDetail() {
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT od.*, p.*, ps.*
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)
LEFT JOIN `ps_manufacturer` m ON m.`id_manufacturer`= p.`id_manufacturer`
WHERE od.`id_order` = '.(int)$this->id_order.'
AND od.`id_order_invoice` = '.(int)$this->id .'
ORDER BY m.name, p.reference');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment