News:

AbanteCart v1.4.2 is released.

Main Menu

Do you like AbanteCart? Please rate AbanteCart or share your experience with other eCommerce entrepreneurs. Go to Softaculous rating page to add your rating or write a review

hide price tag if product price is zero?

Started by cookie, January 06, 2014, 12:23:17 PM

Previous topic - Next topic

cookie

Hi,

I have an other question...

I am setting up a product where the price is given based on options and combinations only, so the initial product price is actually zero...

How can I hide that price tag that appears near the image on the top part of the product layout if the price is zero?

Even better would be to have the final price show there, the way it us bui,t with one price on the top one at bottom is confusing for the users who may not know anymore which is what...

Thank you!

abantecart

Look at the template file: storefront/view/default_html5/template/pages/product/product_listing.tpl
Assuming you use HTML5 template

here:

<?php if ($display_price) { ?>
<div class="pricetag">


You can add to if condition for check the price of 0
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

cookie

Thanks a lot for the tip !
I tried, but I don't really know how to actually use the conditional ...

I tried this:

<?php if ($display_price == "0,00EUR") { ?> ...
but than the price vanishes for all products, not only those with a zero price tag ...

Can you help?
THx

abantecart


<?php if ($display_price || $product['price'] == 0) { ?>
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

cookie

Thank you!

Actually after playing around a bit got it working with smth. like:

<?php if ($price == 0) {
echo "olala";
} else {
echo $price;
} ?>

maniz

#5
Quote from: cookie on January 08, 2014, 06:15:42 AM
Thank you!

Actually after playing around a bit got it working with smth. like:

<?php if ($price == 0) {
echo "olala";
} else {
echo $price;
} ?>
Very interest i like to use in my shop to

Can we have more details

eCommerce Core

Quote from: cookie on January 08, 2014, 06:15:42 AM
Thank you!

Actually after playing around a bit got it working with smth. like:

<?php if ($price == 0) {
echo "olala";
} else {
echo $price;
} ?>

It can be $price variable or $product['price'] array. All depends on the template you look at. You need to read code above in the template you edit.
"If you're in the luckiest one per cent of humanity, you owe it to the rest of humanity to think about the other 99 per cent."
― Warren Buffett

cookie

I've used the above code in the product.tpl file.

henrypinks

 :'(Not working for me, I just add the code you provide to hide price if zero, price is still there any idea?

yonghan

#9
Hello,welcome aboard.Have you cleared the cache?

http://docs.abantecart.com/pages/tips/cache.html

shawnlg777

#10
For the Product page in the Default Template for 1.2.13 in the

storefront/view/default/template/pages/product/product.tpl

FIND
<div class="productfilneprice">
<?php echo $price . $tax_message; ?>
</div>
                        
REPLACE WITH

<div class="productfilneprice">
<?php if ($displayprice == 0) {
echo "Call for Price";
} else {
echo $price . $tax_message;
} ?>
</div>

AND
For the Product listing page in the Default Template for 1.2.13
product_listing.tpl

FIND

<div class="oneprice"><?php echo $product['price'] . $tax_message; ?></div>

REPLACE WITH

<div class="oneprice">
<?php if ($displayprice == 0) {
echo "Call for Price";
} else {
echo $price . $tax_message;
} ?>
</div>

Featured and latest is done essentially the same way just change it from a div class to a span class. For the featured and lates on the home page change the product_list all in the block section

Basara


shawnlg777

Glad I could help. Its nice when I can give back a little. Many of you have been great when I needed help!

Shawn Larson

SonshineTN

I am trying to do this with bootstrap template but I can't seem to get it to work. Any ideas?

Forum Rules Code of conduct
AbanteCart.com 2010 -