I want to add more info to products page like the MPN code, the weight of products etc, is that possible?
What's the abbreviation (like {{ text_manufacturer }} ) for MPN, EAN and weight?
Thank in advance!
What's the abbreviation (like {{ text_manufacturer }} ) for MPN, EAN and weight?
Thank in advance!
Last edited by storiqax on Mon Sep 24, 2018 6:38 pm, edited 1 time in total.
In catalog/controller/product/product.php file,
find:
add below:
In catalog/language/your_language_code/product/product.php file,
add at the bottom:
In your catalog/view/theme/<your_theme>/template/product/product.twig file, add:
where you want.
Then, ensure to apply these steps: viewtopic.php?f=176&p=725084#p718325
This should resolved the issue.
find:
Code: Select all
$data['points'] = $product_info['points'];
Code: Select all
$data['mpn'] = html_entity_decode($product_info['mpn'], ENT_QUOTES, 'UTF-8');
$data['ean'] = html_entity_decode($product_info['ean'], ENT_QUOTES, 'UTF-8');
$data['weight'] = $this->weight->format($product_info['weight'], $this->config->get('config_weight_class_id'), $this->language->get('decimal_point'), $this->language->get('thousand_point'));
add at the bottom:
Code: Select all
$_['text_mpn'] = 'MPN:';
$_['text_ean'] = 'EAN:';
$_['text_weight'] = 'Weight:';
Code: Select all
{% if mpn %}
{{ text_mpn}} {{ mpn }}
{% endif %}
{% if ean %}
{{text_ean}} {{ ean }}
{% endif %}
{% if weight %}
{{text_weight}} {{ weight }}
{% endif %}
Then, ensure to apply these steps: viewtopic.php?f=176&p=725084#p718325
This should resolved the issue.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Hi
Thanks for the post as this is an issue I am looking at and cannot resolve. Here is the code that I am applying in the different files in context:
I have done all the refreshes on Mods/Dashboard and even clear vqmod caches but nothing seems to work. Can you advise? Opencart 3.0.2.0. Thanks for your attention.
The result in product page is:
Thanks for the post as this is an issue I am looking at and cannot resolve. Here is the code that I am applying in the different files in context:
Code: Select all
$data['product_id'] = (int)$this->request->get['product_id'];
$data['manufacturer'] = $product_info['manufacturer'];
$data['manufacturers'] = $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $product_info['manufacturer_id']);
$data['model'] = $product_info['model'];
$data['reward'] = $product_info['reward'];
$data['points'] = $product_info['points'];
$data['mpn'] = html_entity_decode($product_info['mpn'], ENT_QUOTES, 'UTF-8');
$data['ean'] = html_entity_decode($product_info['ean'], ENT_QUOTES, 'UTF-8');
$data['description'] = html_entity_decode($product_info['description'], ENT_QUOTES,
$_['text_week'] = 'week';
$_['text_semi_month'] = 'half-month';
$_['text_month'] = 'month';
$_['text_year'] = 'year';
$_['text_mpn'] = 'MPN:';
{% if additionalfields %}
{% for key, additionalfield in additionalfields %}
<li id="customfield-{{ key }}">
<span class="text-bold">{{ additionalfield.title }}:</span> {{ additionalfield.text }}
</li>
{% endfor %}
{% endif %}
{% if mpn %}
{{ text_mpn}} {{ mpn }}
{% endif %}
{% if ean %}
{{text_ean}} {{ ean }}
{% endif %}
<li><span class="text-bold">{{ text_stock }}</span> <span class="{{ stock_color }}-text text-darken-1 text-bold">{{
stock }}</span></li>
{% if type_remainder == 'numerical' %}
<li><span class="text-bold">{{ text_remainder }}</span>: {{ remainder }}</li>
{% endif %}
The result in product page is:
Attachments
screen.png (12.07 KiB) Viewed 4480 times
Last edited by straightlight on Thu Mar 26, 2020 2:09 am, edited 1 time in total.
Reason: Added code tags.
Reason: Added code tags.
I don't see any relations between this topic request and the use of your: additionalfields array. You are setting the MPN, EAN and weight while conditioning the additionalfields array but not when it's excluded, according to your posted codes above.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Thanks for taking the time to reply.
I am trying to get the mpn etc to appear on product page as this thread suggests. I have followed your instructions. The additional fields are not my construction they were there as part of the theme I am using. I simply added the code as described in the thread.
I am trying to get the mpn etc to appear on product page as this thread suggests. I have followed your instructions. The additional fields are not my construction they were there as part of the theme I am using. I simply added the code as described in the thread.
If you were adding the code as described on the above's instructions, it wouldn't be between the additionalfields variable. It has to be outside of the condition.
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Who is online
Users browsing this forum: Amazon [Bot], Baidu [Spider] and 318 guests