Post by toad78 » Wed Oct 08, 2014 4:20 am

Looking at this code in my OpenCart product.tpl file:

Code: Select all

<div class="price"><?php echo $text_price; ?>
        <?php if (!$special) { ?>
        <?php echo $price; ?>per lb bag
        <?php } else { ?>
        <span class="price-old"><?php echo $price; ?></span> <span class="price-new"><?php echo $special; ?></span>
        <?php } ?>
        <br />
I want to add under the <?php echo $price; ?> the "Option" values. One already does (the original product and price), which echos with the 'per lb bag' label. I want to add the additional Option values with their price.
For example, this is how it looks (use your imagination):

Title of Product
Share Buttons
Price: $23.00 per lb bag

(this is where the dropdown is to display the Option values)

(Add to Cart button)

What I would like is the Option values to appear under the 'Price: $23.00 per lb bag' text.

What I'd like for it to look like:

sample.jpg (98.38 KiB) Viewed 616 times

Does anyone know how this can be done in the product.tpl file?

New member


Sun Dec 08, 2013 8:30 am

Post by tacobandito » Wed Oct 08, 2014 6:36 am

This would require more work to do options other than select, but since that was the example you gave this is the example I gave. Hope this helps!

The below code was sampled from OpenCart 2.0 (i just downloaded it today), but appears the same as, so should work for both.

Code: Select all

<?php foreach ($options as $option) { ?>
  <?php if ($option['type'] == 'select') { ?>
    <?php foreach ($option['product_option_value'] as $option_value) { ?>
      <?php if ($option_value['price']) { ?>
        <p class="small"> add <?php echo $option_value['price_prefix'].$option_value['price']; ?> for <?php echo $option_value['name']; ?> </p><br>
<?php } } } } ?>

[module] PayPal Pro w/Recurring Profiles FREE
[module] 1 Click "Amazon Style" Checkout w/PayPal Pro FREE
[module] Adjustable PayPal Pro Fee FREE
[module] Add Sample To Cart LITE FREE
The guide to fixing just about everything wrong with OpenCart FREE!
Add INFINITE SCROLL to your homepage for FREE!
Live update product price for FREE!
Dynamic generation of Opencart coupon, FREE!
Hire me

User avatar
Active Member


Sat Mar 30, 2013 12:27 am
Location - Springfield, MA

Post by jahan » Sun Oct 12, 2014 2:58 am

Dear sir

I want to import product on opencart website.i tried to make proper excel sheet for import product.please see the attachment.and kindly help me by the check an solution.I

I want to add option and attributes,,but i can not do it?

please help me




Sun Oct 12, 2014 2:33 am
Who is online

Users browsing this forum: No registered users and 57 guests