Jump to content
Sign in to follow this  
w1ck3d

Вывод массы/веса товара

Recommended Posts

Не выводится вес, как его вывести? прошу помощи.

 

319185844b0839e825812ebdf9c528a3.png

 

446296edbd25c2269daab62f0f7d12f9.png

Share this post


Link to post
Share on other sites

в product.php найти указанный блок и добавить строку:

$this->data['model'] = $product_info['model'];
$this->data['reward'] = $product_info['reward'];
$this->data['points'] = $product_info['points'];

$this->data['weight] = $product_info['weight']; // добавляем вес

в product.tpl в нужном месте делаем отображение

<?php echo $weight; ?>

Share this post


Link to post
Share on other sites

в product.php найти указанный блок и добавить строку:

$this->data['model'] = $product_info['model'];

$this->data['reward'] = $product_info['reward'];

$this->data['points'] = $product_info['points'];

$this->data['weight] = $product_info['weight']; // добавляем вес

в product.tpl в нужном месте делаем отображение

<?php echo $weight; ?>

 

 

Премного благодарен! Как бы плюсануть...

есть ещё вопрос, вот там вес (есть в граммах и Килограммах) это бы тоже вывести и + допустим вес 2 кг, а он пишется Вес:2.00000000

Если всё это получится, я буду вам очень благодарен!

Share this post


Link to post
Share on other sites

Аналогичное, так же как и с весом, только после строк веса weight добавлять строки с weight_class в файлы, т.е.

 

$this->data['weight_class] = $product_info['weight_class'];

<?php echo $weight_class; ?>

 

для вывода числа знаков после запятой используйте number_format, например 2 знака выведет:

<?php echo number_format($weight, 2, '.', ''); ?>

Edited by AlexDW

Share this post


Link to post
Share on other sites

Notice: Undefined index: weight_class in /home/.../www/.../catalog/controller/product/product.php on line 302

Share this post


Link to post
Share on other sites

попробуйте изменить на

$this->data['weight_class] = $product_info['weight_class_id'];

Share this post


Link to post
Share on other sites

попробуйте изменить на

$this->data['weight_class] = $product_info['weight_class_id'];

Ошибки нет, но выводится либо 1 либо 2 .

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.