hogo20 Posted January 23 Share Posted January 23 (edited) hello everyone I use Combination in my PrestaShop store. is it possible to show "manufacture product number" or "MPN" code, when select a combination? in PrestaShop 8.2 when assign MPN code (or UPC), it does not show anything about that in front office. ( In the attached picture, my wish is better determined.) Thank you for your help Edited January 31 by hogo20 (see edit history) Link to comment Share on other sites More sharing options...
Ewonta Posted January 23 Share Posted January 23 (edited) Hello Add the code {foreach from=$product.specific_references item=reference key=key} <dt class="name">{$key}</dt> <dd class="value">{$reference}</dd> {/foreach} to your theme file at themes/our_theme/templates/catalog/_partials/product-variants.tpl Edited January 23 by Ewonta (see edit history) Link to comment Share on other sites More sharing options...
hogo20 Posted January 23 Author Share Posted January 23 hello dear, thank you for your help. I added your recommendations to end of product variants file. but not show any new thing in front office. images attached Link to comment Share on other sites More sharing options...
hogo20 Posted January 23 Author Share Posted January 23 also, already assign mpn, upc, ean13 numbers in product combination Link to comment Share on other sites More sharing options...
Ewonta Posted January 23 Share Posted January 23 Try clearing the cache Link to comment Share on other sites More sharing options...
Ewonta Posted January 23 Share Posted January 23 That's how it should be displayed 1 Link to comment Share on other sites More sharing options...
hogo20 Posted January 23 Author Share Posted January 23 Hey, did you just do this? 🤔 I clear the cache from: 1- admin =advanced parameter >performance 2- host= var >cache But I didn't see any change. Strange! I have PrestaShop 8.2 with PHP 8.1. Should I install and test a new on LocalHost or is there a point? Thank you bro Link to comment Share on other sites More sharing options...
Ewonta Posted January 23 Share Posted January 23 I have the same version, are you sure that you did it in that folder of the theme, you need to do it in the active folder of the theme. Link to comment Share on other sites More sharing options...
hogo20 Posted January 23 Author Share Posted January 23 (edited) Your recommendations code is on: public_html/themes/classic/templates/catalog/_partials/product-variants.tpl (In this path, I added some codes to display the inventory of each combination of goods and works fine. So the folder is correct and runs from it.) It's also strange to me why it doesn't work. Edited January 23 by hogo20 (see edit history) Link to comment Share on other sites More sharing options...
Ewonta Posted January 23 Share Posted January 23 3 hours ago, Ewonta said: themes/our_theme/templates/catalog/_partials/product-variants.tpl Take a close look at the message, I fixed it right away because I didn't know what your theme was. our_theme Link to comment Share on other sites More sharing options...
hogo20 Posted January 23 Author Share Posted January 23 i use default classic theme. Link to comment Share on other sites More sharing options...
Ewonta Posted January 23 Share Posted January 23 Send the link to the product Link to comment Share on other sites More sharing options...
Ewonta Posted January 23 Share Posted January 23 You obviously have some kind of cache enabled on the server, with hard page caching. The product-quantity block is displayed, you have sent a screenshot that you have inserted the code into the required file. <div class="product-quantities" style="font-weight: bolder;"> <label class="label">In stock</label> <span data-stock="1" data-allow-oosp="1">1 Items</span> </div> 1) either the code was inserted into the wrong file. 2) Either the server has hard-coded the file Link to comment Share on other sites More sharing options...
hogo20 Posted January 23 Author Share Posted January 23 (edited) to show quantities, I copy some code fron other file and insert to product-variants.tpl file and works fine. about server side hard cache, I don't know. must be contact with host manager? Edited January 23 by hogo20 (see edit history) Link to comment Share on other sites More sharing options...
Ewonta Posted January 23 Share Posted January 23 Try asking the hosting manager. Link to comment Share on other sites More sharing options...
hogo20 Posted January 23 Author Share Posted January 23 I gave a ticket to the server administrator and they offered a way to remove the server cache. By doing that, it didn't work. I decided to install and test a fresh version on LocalHost. Thank you for your guidance. 🙏 Link to comment Share on other sites More sharing options...
hogo20 Posted January 24 Author Share Posted January 24 hello today, install prestashop 8.2.0 on localhost and live host > in both situation, that recommendation does not work. Link to comment Share on other sites More sharing options...
hogo20 Posted January 24 Author Share Posted January 24 (edited) hello, friends In Prestashop 8.2.0, open file: /controllers/front/ProductController.php and remove line 1207 (with this code): $product['cart_quantity'] = $this->context->cart->getProductQuantity($product['id_product'], $product['id_product_attribute'])['quantity']; then add this code to: /themes/[your theme]/templates/catalog/_partials/product-variants.tpl {block name='product_specific_reference'} <p class="product-specific-reference" style="font-weight: bolder;"> {foreach from=$product.specific_references item=reference key=key} <span class="name">{$key}: </span><span class="value" style="color:#005fff;">{$reference}</span><br/> {/foreach} </p> {/block} Edited January 24 by hogo20 (see edit history) Link to comment Share on other sites More sharing options...
Ewonta Posted January 24 Share Posted January 24 Changing the behavior of the system in this way is not the best option, deleting /controllers/front/ProductController.php has nothing to do with {block name='product_specific_reference'} <p class="product-specific-reference" style="font-weight: bolder;"> {foreach from=$product.specific_references item=reference key=key} <span class="name">{$key}: </span><span class="value" style="color:#005fff;">{$reference}</span><br/> {/foreach} </p> {/block} It is better not to delete directly, you always need to override classes and controllers. Link to comment Share on other sites More sharing options...
hogo20 Posted January 24 Author Share Posted January 24 yes, you're right. how can override productController.php from that path? thank you for your attention Link to comment Share on other sites More sharing options...
Ewonta Posted January 24 Share Posted January 24 (edited) The Override is described in the PrestaShop documentation https://devdocs.prestashop-project.org/8/modules/concepts/overrides/ Edited January 24 by Ewonta (see edit history) 1 Link to comment Share on other sites More sharing options...
hogo20 Posted January 24 Author Share Posted January 24 yes,find it 🙏 Link to comment Share on other sites More sharing options...
hogo20 Posted January 25 Author Share Posted January 25 (edited) On 1/24/2025 at 6:53 PM, hogo20 said: hello, friends In Prestashop 8.2.0, open file: /controllers/front/ProductController.php and remove line 1207 (with this code): $product['cart_quantity'] = $this->context->cart->getProductQuantity($product['id_product'], $product['id_product_attribute'])['quantity']; then add this code to: /themes/[your theme]/templates/catalog/_partials/product-variants.tpl {block name='product_specific_reference'} <p class="product-specific-reference" style="font-weight: bolder;"> {foreach from=$product.specific_references item=reference key=key} <span class="name">{$key}: </span><span class="value" style="color:#005fff;">{$reference}</span><br/> {/foreach} </p> {/block} hello, this method make new problem. When pre-order is active, The minimum order number is not automatically entered in the relevant box. However, this method can be used to solve it in the next version, hopefully. Edited January 25 by hogo20 (see edit history) Link to comment Share on other sites More sharing options...
Ewonta Posted January 26 Share Posted January 26 This feature has nothing to do with your question, it's a mistake. $product['cart_quantity'] = $this->context->cart->getProductQuantity($product['id_product'], $product['id_product_attribute'])['quantity']; Link to comment Share on other sites More sharing options...
njfurnituremart Posted January 28 Share Posted January 28 Yes, it's possible to display the MPN code when selecting a combination in PrestaShop, but it may require some custom development. You'll likely need to modify the product.tpl file in your theme and use PrestaShop's hooks to fetch and display the MPN dynamically in the front office. 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