Post by up4surf » Thu Apr 23, 2015 11:00 pm

Hello,

I have tried to implement the same code that I had with 1.5.6.4 in the catalog.tpl with my new install of 2.0.2.0. in order to replace a $0.00 price with text.

I used
<div class="price">
<?php if ($product['price'] == "$0.00") { ?>
<?php echo "Click for Price Options"; ?>
<?php } else { ?>
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>

the code looks to be the same in this section of 2.0.2.0 in the catagory.tpl, however, when I implement the change, I cannot get the page to load.

Not sure where the error is happening, or if there is a better way to replace a $0.00 price with text

Thank you

Newbie

Posts

Joined
Tue Dec 18, 2012 12:33 pm

Post by up4surf » Fri Apr 24, 2015 3:21 am

OK, I found a solution that works (Thank you Qphoria) and I wanted to post, or should I say re-post from:

http://forum.opencart.com/viewtopic.php ... 895#p37192

Re: Displaying something other than $0 when no price is give
Postby Qphoria » Sat Nov 14, 2009 3:46 pm

A little trick to make this a lot easier for you..
Remember all prices pass through the currency->format() function, even if they are 0

1. EDIT: system/library/currency.php (or system/helper/currency.php for certain versions)

2. FIND:
CODE: SELECT ALL
$string = '';


3. BEFORE, ADD:
CODE: SELECT ALL
if ($format && (float)$value == 0) {
return 'FREE';
}


That's it! One file handles ALL places.. even custom mods are automatically changed

Newbie

Posts

Joined
Tue Dec 18, 2012 12:33 pm
Who is online

Users browsing this forum: No registered users and 22 guests