Hiya guys
Ive been through all the posts I can find, bascially on my product.tpl I would like to display 'unavailable' if the price=0
I found the post regarding changing the currency file, but this also causes an empty checkout to display unavailable.
Im trying this line of code to no avail, any help most appreciated
<?php if ((float)str_replace('£', '', $price) == 0) { echo "Unavailable"; } else { ?>show the price <?php }?>
thankyou
Ive been through all the posts I can find, bascially on my product.tpl I would like to display 'unavailable' if the price=0
I found the post regarding changing the currency file, but this also causes an empty checkout to display unavailable.
Im trying this line of code to no avail, any help most appreciated
<?php if ((float)str_replace('£', '', $price) == 0) { echo "Unavailable"; } else { ?>show the price <?php }?>
thankyou
1. Edit catalog/view/theme/YOUR-THEME/template/product/product.tpl
2. Find (line 37)
replace with
BUT do note the '$' sign. Change accordingly to your currency. If you allow a change of currency on your website, then it will be a little more complicated.
2. Find (line 37)
Code: Select all
<?php echo $price; ?>
Code: Select all
<?php if($price == "$0.00") { echo "Unavailable"; } else { echo $price;} ?>
Or try those two modules:
http://www.opencart.com/index.php?route ... on_id=4067
http://www.opencart.com/index.php?route ... on_id=4139
If you got the idea, but want some modifications on those modules, feel free to PM
http://www.opencart.com/index.php?route ... on_id=4067
http://www.opencart.com/index.php?route ... on_id=4139
If you got the idea, but want some modifications on those modules, feel free to PM

See all my extensions: https://www.opencart.com/index.php?rout ... 20OpenCart
Hi I am trying to make this into a range of prices.MarketInSG wrote:1. Edit catalog/view/theme/YOUR-THEME/template/product/product.tpl
2. Find (line 37)replace withCode: Select all
<?php echo $price; ?>
BUT do note the '$' sign. Change accordingly to your currency. If you allow a change of currency on your website, then it will be a little more complicated.Code: Select all
<?php if($price == "$0.00") { echo "Unavailable"; } else { echo $price;} ?>
I have tried this with no luck:
Code: Select all
<?php if($price == "$99.00-$999.00") { echo "Unavailable"; } else { echo $price;} ?>
Discount Golf Clubs and Golf Equipment - Powered by Opencart
use greater than or less than signs
Code: Select all
<?php if($price > 99.00 && $price < 999.00) { echo "Unavailable"; } else { echo $price;} ?>
Thank you, that did it.
I tried that once with the $ and locked myself out of the admin with an error.
I tried that once with the $ and locked myself out of the admin with an error.
Discount Golf Clubs and Golf Equipment - Powered by Opencart
I got this working on the product pages. Is there any way to do the same thing on the category listings?
Actually I think I figured it out. In /template/product/category.tpl, I changed
to this
Code: Select all
<?php if ($product['price']) { ?>
<div class="price">
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
<?php } ?>
<?php if ($product['tax']) { ?>
<br />
<span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
<?php } ?>
Code: Select all
<?php if ($product['price']) { ?>
<div class="price">
<?php if ($product['price'] == "$0.00") { ?>
<?php echo "Customizable"; ?>
<?php } else { ?>
<?php if (!$product['special']) { ?>
<?php echo $product['price']; ?>
<?php } else { ?>
<span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
<?php } ?>
<?php if ($product['tax']) { ?>
<br />
<span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
<?php } ?>
<?php } ?>
Hi, the code you edited works in the Category page but only in the List View, not in the Grid View. Do you know how to further edit the category page to show customizable text (or no text at all) if the product price is $0.00 for both List View and Grid View?johnnynnhoj wrote: ↑Fri Jan 25, 2013 2:51 pmActually I think I figured it out. In /template/product/category.tpl, I changed
to thisCode: Select all
<?php if ($product['price']) { ?> <div class="price"> <?php if (!$product['special']) { ?> <?php echo $product['price']; ?> <?php } else { ?> <span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span> <?php } ?> <?php if ($product['tax']) { ?> <br /> <span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span> <?php } ?>
Code: Select all
<?php if ($product['price']) { ?> <div class="price"> <?php if ($product['price'] == "$0.00") { ?> <?php echo "Customizable"; ?> <?php } else { ?> <?php if (!$product['special']) { ?> <?php echo $product['price']; ?> <?php } else { ?> <span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span> <?php } ?> <?php if ($product['tax']) { ?> <br /> <span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span> <?php } ?> <?php } ?>
Marketln sg. i used your way to hide price and it does work fine on product page. but it can not hide price on main category page. how can u go about it.
i used it on product.tpl please suggest as per below
<?php if($price == "$0.00") { echo "Unavailable"; } else { echo $price;} ?>
i used it on product.tpl please suggest as per below
<?php if($price == "$0.00") { echo "Unavailable"; } else { echo $price;} ?>
category page, use $product['price'] instead of $pricegoodshop wrote: ↑Wed Jul 19, 2017 1:37 pmMarketln sg. i used your way to hide price and it does work fine on product page. but it can not hide price on main category page. how can u go about it.
i used it on product.tpl please suggest as per below
<?php if($price == "$0.00") { echo "Unavailable"; } else { echo $price;} ?>
is there a code modification that I can make in code manager in OC 2.0.3.1 so that I can type Call for Price in the price area or SOLD in the price area on the product page and it show Call for Price for the price or SOLD for the price in all areas?
Who is online
Users browsing this forum: Amazon [Bot] and 33 guests