php - Show dimensions in product page for opencart -


i need display product dimensions in product page. here code not executed. added in catalog/controller/product/product.php

<?php $this->data['length'] = number_format($product_info['length'],2) .  ' cm';     $this->data['width'] = number_format($product_info['width'],2) .  ' cm';     $this->data['height'] = number_format($product_info['height'],2) .  ' cm'; 

and in same file

$this->data['text_dimensions'] = $this->language->get('text_dimensions');         $this->data['text_by'] = $this->language->get('text_by'); 

and in catalog/view/theme/default/template/product/product.tpl

<?php echo $length; ?><?php echo $text_by; ?><?php echo width; ?><?php echo $text_by; ?><?php echo $height; ?><?php echo $text_by; ?> 

and in catalog/language/english/product/product.php

$_['text_dimensions'] = 'dimensions:';         $_['text_by'] = 'x'; 

after try code dimension not showing in opencart.

here controller file version working on (oc 2.1.0.2)

$this->data no more used passing variables view in opencart 2.x . instead rendering method accepts second parameter, array of variables pass view

$this->load->view('default/template/error/not_found.tpl', $data) 

usually $data variable used.

you need insert variables array before passed rendering method.

another issue spot hardcoding dimensions (cm), can retrieved system well.

one more thing: not forget pass language variables created other variables via controller.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -