Solution to: Display product dimensions as single line (Size: L x W x H) in both product view and category view...
In the file: catalog/controller/product/product.php
Find this code line (~line 140):
Code: Select all
$this->data['text_model'] = $this->language->get('text_model');
Add the following code after it:
Code: Select all
$this->data['text_dimensions'] = $this->language->get('text_dimensions');
$this->data['text_by'] = $this->language->get('text_by');
Find this code line (~line 183):
Code: Select all
$this->data['model'] = $product_info['model'];
Add the following code after it:
Code: Select all
$this->data['length'] = $product_info['length'];
$this->data['width'] = $product_info['width'];
$this->data['height'] = $product_info['height'];
In the file: catalog/language/english/product/product.php
Find this code line (~line 6):
Code: Select all
$_['text_model'] = 'Product Code:';
Add the following code after it:
Code: Select all
$_['text_dimensions'] = 'Size:';
$_['text_by'] = ' x ';
In the file: catalog/view/theme/default/template/product/product.tpl
Find this code line (~line 29):
Code: Select all
<span><?php echo $text_model; ?></span> <?php echo $model; ?><br />
Add the following code after it:
Code: Select all
<span><?php echo $text_dimensions; ?></span>
<?php echo $length; ?><?php echo $text_by; ?><?php echo $width; ?>
<?php echo $text_by; ?><?php echo $height; ?><br />
In the file: catalog/controller/product/category.php
Find this code line (~line 85):
Code: Select all
$this->data['text_model'] = $this->language->get('text_model');
Add the following code after it:
Code: Select all
$this->data['text_dimensions'] = $this->language->get('text_dimensions');
$this->data['text_by'] = $this->language->get('text_by');
Find this code line (~line 188):
Code: Select all
'description' => substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..',
Add the following code after it:
Code: Select all
'length' => number_format($result['length'], 1) . "''",
'width' => number_format($result['width'], 1) . "''",
'height' => number_format($result['height'], 1) . "''",
In the file: catalog/language/english/product/category.php
Find this code line (~line 9):
Code: Select all
$_['text_model'] = 'Product Code:';
Add the following code after it:
Code: Select all
$_['text_dimensions'] = 'Size:';
$_['text_by'] = ' x ';
In the file: catalog/view/theme/default/template/product/category.tpl
Find this code line (~line 83):
Code: Select all
<div class="description"><?php echo $product['description']; ?></div>
Add the following code after it:
Code: Select all
<div class="dimensions"><?php echo ($text_dimensions . $product['length'] . $text_by . $product['width'] . $text_by . $product['height']); ?></div>
Find this code line (~line 145):
Code: Select all
html += ' <div class="name">' + $(element).find('.name').html() + '</div>';
Add the following code after it:
Code: Select all
html += ' <div class="dimensions">' + $(element).find('.dimensions').html() + '</div>';
Find this code line (~line 177):
Code: Select all
html += '<div class="name">' + $(element).find('.name').html() + '</div>';
Add the following code after it:
Code: Select all
html += '<div class="dimensions">' + $(element).find('.dimensions').html() + '</div>';
This worked for me... hope it works for everyone else....
