Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display product name and its attributes translated in order slips and invoices #7858

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 13 additions & 8 deletions classes/order/OrderInvoice.php
Expand Up @@ -140,14 +140,19 @@ public function getProductsDetail()
$id_lang = Context::getContext()->language->id;

return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT *, pl.`name` as product_name
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 `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product AND pl.id_lang = '.$id_lang.' AND pl.id_shop = od.id_shop)
WHERE od.`id_order` = '.(int)$this->id_order.'
'.($this->id && $this->number ? ' AND od.`id_order_invoice` = '.(int)$this->id : '').' ORDER BY pl.`name`');
SELECT *, CONCAT(pl.`name`," - ",GROUP_CONCAT(CONCAT(agl.`name`," : ",al.`name`))) as product_name
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 `' . _DB_PREFIX_ . 'product_lang` pl ON (pl.id_product = p.id_product AND pl.id_lang = ' . $id_lang . ' AND pl.id_shop = od.id_shop)
LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute_combination` pac ON (od.`product_attribute_id` = pac.`id_product_attribute`)
LEFT JOIN `' . _DB_PREFIX_ . 'attribute` a ON (a.`id_attribute` = pac.`id_attribute`)
LEFT JOIN `' . _DB_PREFIX_ . 'attribute_group_lang` agl ON (agl.`id_attribute_group` = a.`id_attribute_group` AND agl.`id_lang` = ' . $id_lang . ')
LEFT JOIN `' . _DB_PREFIX_ . 'attribute_lang` al ON (al.`id_attribute` = a.`id_attribute` AND al.`id_lang` = ' . $id_lang . ')
WHERE od.`id_order` = ' . (int)$this->id_order . '
' . ($this->id && $this->number ? ' AND od.`id_order_invoice` = ' . (int)$this->id : '') . '
GROUP BY od.product_id
ORDER BY pl.`name`');
}

public static function getInvoiceByNumber($id_invoice)
Expand Down