robb84 Posted November 14, 2020 Share Posted November 14, 2020 Hi ! I'm trying to use the location field in template, to enter some information at the combination level to show to customers (when they select a certain combination). The data is correctly inserted into the 'ps_product_attribute' table as seen in the screenshot attached. Is it possible to get the data out from the "location" field to show it in product_variants.tpl template ? Thanks 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.`location` FROM `' . _DB_PREFIX_ . 'product_attribute` pa WHERE id_product_attribute = ' . $this->getIdProductAttributeByGroupOrRequestOrDefault(); $product['product_attribute_location'] = ''; if ($results = Db::getInstance()->executeS($query)) { foreach ($results as $row) { $product['product_attribute_location'] = $row['location']; } } Then use {$product['product_attribute_location']} 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