robb84 Posted November 14, 2020 Share Posted November 14, 2020 Hi. I'm trying to show in product page the supplier reference according to combination selected (like the default reference sku does). I assigned the supplier and the supplier reference in BO for each combination attribute (in product option TAB). With code: {$product.supplier_reference} in product.tpl and product-variants.tpl, nothing show up . Any clue for this ? Thanks Ps: 1.7.2 Link to comment Share on other sites More sharing options...
rrataj Posted December 4, 2020 Share Posted December 4, 2020 You should modify /controllers/front/ProductController.php and in line ~1073 (method getTemplateVarProduct()) add: $query = 'SELECT pa.`supplier_reference` FROM `' . _DB_PREFIX_ . 'product_attribute` pa WHERE id_product_attribute = ' . $this->getIdProductAttributeByGroupOrRequestOrDefault(); $product['product_attribute_supplier_reference'] = ''; if ($results = Db::getInstance()->executeS($query)) { foreach ($results as $row) { $product['product_attribute_supplier_reference'] = $row['supplier_reference']; } } Then use {$product['product_attribute_supplier_reference']} variable on template you want. For example /themes/your_theme/templates/catalog/_partials/product_details.tpl If it works, then I would move those changes to override folder to prevent from being lost after prestashop core upgrade. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now