Post by peren6000 » Tue May 09, 2017 5:08 pm

hi every one
i want to change the price to simple text if my price equal to 0 zero show me this text "please call us" in product page
thank you for your supporting

Newbie

Posts

Joined
Tue May 09, 2017 5:03 pm

Post by paulfeakins » Tue May 09, 2017 5:38 pm

Well the price is output in /catalog/view/theme/default/template/product/product.tpl, line 141, so you could put an if statement in here.

For quick, professional OpenCart support please email info@antropy.co.uk


User avatar
Expert Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - Reigate, Surrey, United Kingdom

Post by peren6000 » Tue May 09, 2017 6:30 pm

i use this code
but didn`t change anything ! ?

Code: Select all

 <?php if ($price) { ?>
            <div class="price detail">
                <ul class="list-unstyled">
                    <?php if (!$special) { ?>
                        <li>
                            <span class="price-new"> <?php echo $price; ?> </span>
                        </li>
                    <?php } else { ?>

                        <li> <span class="price-new"> <?php echo $special; ?> </span> <span class="price-old"><?php
if ($price==0){ 
echo "contact us"
}else { 
echo $price;}
 ?></span> </li>
                    <?php } ?>
                </ul>
            </div>
        <?php } ?>

Newbie

Posts

Joined
Tue May 09, 2017 5:03 pm

Post by GoGo OpenCart » Tue May 09, 2017 6:45 pm

I have a module which does exactly what you want to achieve:

Call for Price: https://www.opencart.com/index.php?rout ... on_id=4067

(the Call for Price text can be changed to any other text you want)

And here's another one, a little bit more advanced, which will replace the 0 price with Ask for Price text link (or any other text you want), which will open the Ask a Question form for that product:

Ask for Price: https://www.opencart.com/index.php?rout ... on_id=4139

If have any questions, or if you want to see a live demo, or if you need any help with the installation, feel free to write me a PM ;)

See all my extensions: https://www.opencart.com/index.php?rout ... 20OpenCart


User avatar
Active Member

Posts

Joined
Mon Nov 14, 2011 11:30 pm

Post by peren6000 » Tue May 09, 2017 6:49 pm

i dont need that module bcs i have just 3 products with 0 price
thank you

Newbie

Posts

Joined
Tue May 09, 2017 5:03 pm

Post by bonkopencart » Wed May 10, 2017 1:10 pm

use if statement in controller php file.
and must be compared to bare variable $result['price'], not formatted variable $price or $data['products']['price'].

New member

Posts

Joined
Fri Mar 24, 2017 1:53 pm

Post by peren6000 » Wed May 10, 2017 2:41 pm

hi i used this but didn`t work

Code: Select all

if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {			

					$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
				} else{
					$price = false;
				}				
				if ($this->customer->isLogged() || !$this->config->get('config_customer_price') && $price= $this -> format ($this ->tax->calculate($result['price']==0))){					
				$price= $result['price']="call us";	
				} 
				 

Newbie

Posts

Joined
Tue May 09, 2017 5:03 pm

Post by peren6000 » Thu May 11, 2017 2:00 pm

no one knows this question or solution ?

Newbie

Posts

Joined
Tue May 09, 2017 5:03 pm

Post by bonkopencart » Fri May 12, 2017 11:03 am

Ups. I missed something.
hope this help.
file: /catalog/controller/product/product.php

Code: Select all

if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
	if ($product_info['price']) {
		$data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
	} else {
		$data['price'] = 'Call Us'
	}
} else {
	$data['price'] = false;
}

New member

Posts

Joined
Fri Mar 24, 2017 1:53 pm

Post by sheridangraphics » Sat Jul 28, 2018 12:26 pm

Hi all, I bought a plugin for this a while back so anywhere on the site with 00.00, I wanted to change to text "pick options" which it did nicely. However the problem I have is on check out anything 00.00 also changes so things like pricing for delivery, taxes come out as pick options which looks bad. Does anyone know how I can remedy this?

New member

Posts

Joined
Fri Feb 20, 2015 12:47 am

Post by Alina007 » Tue Aug 14, 2018 4:03 pm

Hello,

Anyone found a solution for this? I tried above code but didn't work...(OC3)

if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
if ($product_info['price']) {
$data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);
} else {
$data['price'] = 'Solicita Pret';
}
} else {
$data['price'] = false;
}


Thank you

Newbie

Posts

Joined
Mon Mar 13, 2017 10:52 pm
Who is online

Users browsing this forum: No registered users and 12 guests