Everyone who added products online store opencart well aware that the editor of the goods in the admin present such fields as length, width, height, weight, but in most item card when you view these settings are not displayed, but we need to show them, well, let's Bring them to the card.
We will display the size and weight of the goods to the card, and if we have the weight or length is not specified - did not deduce anything in the box.
1. Open the file catalog/language/russian/product/product.php and amended as follows:
1 2 3 4 5 |
We are looking for the line: $_['text_error'] = 'Π’ΠΎΠ²Π°Ρ Π½Π΅ Π½Π°ΠΉΠ΄Π΅Π½!'; And add the following code $_['text_weight'] = 'ΠΠ΅Ρ:'; $_['text_dimension'] = 'Π Π°Π·ΠΌΠ΅ΡΡ (Π*Π¨*Π):'; |
2.Open the file catalog/language/english/product/product.php and we do the same but with the English language.
1 2 3 4 5 |
Find the line $_['text_error'] = 'Product not found!'; And add the code after it $_['text_weight'] = 'Weight:'; $_['text_dimension'] = 'Dimension:'; |
3. Open the file catalog/controller/product/product.php and change the code in it:
1 2 3 4 5 6 7 8 9 10 11 12 |
Find the line $this->data['text_tags'] = $this->language->get('text_tags'); And after adding it $this->data['text_weight'] = $this->language->get('text_weight'); $this->data['text_dimension'] = $this->language->get('text_dimension'); Next, look for $this->data['points'] = $product_info['points']; And add the following $this->data['weight'] = $this->weight->format($product_info['weight'], $product_info['weight_class_id']); $this->data['length'] = $this->length->format($product_info['length'], $product_info['length_class_id']); $this->data['width'] = $this->length->format($product_info['width'], $product_info['length_class_id']); $this->data['height'] = $this->length->format($product_info['height'], $product_info['length_class_id']); |
4. Open the file name of your theme, the example uses the default theme by default, so open the file catalog/view/theme/default/template/product/product.tpl and change the code:
1 2 3 4 5 6 7 8 9 10 |
Find the line <span><?php echo $text_stock; ?></span> <?php echo $stock; ?> And after adding it <br /> <?php if ($length > 0) { ?> <span><?php echo $text_dimension; ?></span> <?php echo $length; if(!empty($length)) echo " x "; echo $width; if(!empty($width)) echo " x "; echo $height; ?><br /> <?php } ?> <?php if ($weight > 0) { ?> <span><?php echo $text_weight; ?></span> <?php echo $weight; ?><br /> <?php } ?> |
All you now have will show the length, width, height, weight on the item card.
No Comment
You can post first response comment.