Post by storiqax » Sat Jun 23, 2018 5:50 pm

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!

Newbie

Posts

Joined
Tue May 29, 2018 10:19 pm

Post by straightlight » Sat Jun 23, 2018 7:50 pm

In catalog/controller/product/product.php file,

find:

Code: Select all

$data['points'] = $product_info['points'];
add below:

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'));
In catalog/language/your_language_code/product/product.php file,

add at the bottom:

Code: Select all

$_['text_mpn'] = 'MPN:';
$_['text_ean'] = 'EAN:';
$_['text_weight'] = 'Weight:';
In your catalog/view/theme/<your_theme>/template/product/product.twig file, add:

Code: Select all

{% if mpn %}
{{ text_mpn}} {{ mpn }}
{% endif %}

{% if ean %}
{{text_ean}} {{ ean }}
{% endif %}

{% if weight %}
{{text_weight}} {{ weight }}
{% endif %}
where you want.

Then, ensure to apply these steps: viewtopic.php?f=176&p=725084#p718325

This should resolved the issue.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by storiqax » Mon Jun 25, 2018 1:41 am

Much appreciated, thank for your time!

Newbie

Posts

Joined
Tue May 29, 2018 10:19 pm
Who is online

Users browsing this forum: No registered users and 16 guests