OpenCart 2.0: Display Product Size underneath Product Price.

OpenCart has a very useful and functional attribute system that allows you add just about anything you wish to the product description. However, the added attribute is added in an extra tab. This hack lets you add the product size directly under the product price.
Screen Shot 2015-06-11 at 2.17.50 PM

This hack will also add the product size to the item in the shopping cart.
Screen Shot 2015-06-11 at 2.27.51 PM

This technique is a hack because it uses an already existing field, ‘jan’ in the oc_product table to store the product size. However, the technique is easy to do because the admin already is set up to add data to the field. See admin>products>edit your product>data>JAN . (If you sell in Japan and need that field you can perhaps use the EAN field instead). *It would also be less of a hack when I get this converted to OCMOD.

Step 1:
Open catalog/controller/product/product.php. Find about line 271

$data['points'] = $product_info['points'];

Insert directly beneath

$data['jan'] = $product_info['jan'];

Step 2:
Open catalog/view/theme/my template/template/product/product.tpl find about line 75

<?php if ($tax) { ?>
            <li><?php echo $text_tax; ?> <?php echo $tax; ?></li>
            <?php } ?>

Insert directly beneath:

<li>size: <?php echo $jan; ?></li>

These two steps will display the value entered into admin>products>edit your product>data>JAN directly beneath the price on the products page.

Step 3:
Open system/library/cart.php find about line 245

'model'           => $product_query->row['model'],

insert directly below:

'jan'           => $product_query->row['jan'],

Step 4:
Open catalog/view/theme/your template/template/checkout/ and find

<?php if ($product['option']) { ?>
                  <?php foreach ($product['option'] as $option) { ?>
                  <br />
                  <small><?php echo $option['name']; ?>: <?php echo $option['value']; ?></small>
                  <?php } ?>
                  <?php } ?>

Insert directly beneath:

<br /><small><?php echo $product['jan']; ?></small>

Now any value display in JAN will display beneath the product name in the shopping cart.

Finally open admin/language/english/catalog/product.php and change

$_['entry_jan']              = 'JAN';


$_['entry_jan']              = 'Retail Size';