Post by Valerina » Mon Apr 01, 2019 11:41 pm

Hello All

I am running oc v 3.0.3.1

Want to fix code so if product price is 0, then display `Call for Price` on both the category page and single product page.

What file(s) should I edit as the ones listed below are not in the installation I have

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 'Call for Price';
}
Last edited by straightlight on Tue Apr 14, 2020 9:04 am, edited 1 time in total.

Newbie

Posts

Joined
Mon Apr 01, 2019 7:34 pm

Post by cyclops12 » Tue Apr 02, 2019 1:08 am

There should be plenty of extensions for this in the marketplace

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by IP_CAM » Tue Apr 02, 2019 2:22 am


My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by mitrecyclers » Tue Apr 14, 2020 7:41 am

Valerina wrote:
Mon Apr 01, 2019 11:41 pm
Hello All

I am running oc v 3.0.3.1

Want to fix code so if product price is 0, then display `Call for Price` on both the category page and single product page.

What file(s) should I edit as the ones listed below are not in the installation I have

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 'Call for Price';
}
Can i return link to our contact us page?
return 'Call for Price'; and it just takes customer to contact us page?

For all of your Mobile phone needs.
https://mitrecyclers.com


Active Member

Posts

Joined
Tue Sep 25, 2018 5:34 pm

Post by straightlight » Tue Apr 14, 2020 9:11 am

In system/library/cart/currency.php file,

find:

Code: Select all

$this->language = $registry->get('language');
add below:

Code: Select all

$this->url = $registry->get('url');
Then, replace:

Code: Select all

return 'Call for Price';
with:

Code: Select all

return sprintf($this->language->get('text_call_for_price'), $this->url->link('information/contact'));
Then, in your catalog/language/<your_language_code>/<your_language_code>.php file,

add at the bottom:

Code: Select all

$_['text_call_for_price'] = '<a href="%s">Call for Price</a>';
Then, follow this FAQ: viewtopic.php?f=134&t=215776#p718325 . This should resolved the issue.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by mitrecyclers » Tue Apr 14, 2020 11:11 pm

straightlight wrote:
Tue Apr 14, 2020 9:11 am
In system/library/cart/currency.php file,

find:

Code: Select all

$this->language = $registry->get('language');
add below:

Code: Select all

$this->url = $registry->get('url');
Then, replace:

Code: Select all

return 'Call for Price';
with:

Code: Select all

return sprintf($this->language->get('text_call_for_price'), $this->url->link('information/contact'));
Then, in your catalog/language/<your_language_code>/<your_language_code>.php file,

add at the bottom:

Code: Select all

$_['text_call_for_price'] = '<a href="%s">Call for Price</a>';
Then, follow this FAQ: viewtopic.php?f=134&t=215776#p718325 . This should resolved the issue.
Brilliant. Thanks. Worked well.

For all of your Mobile phone needs.
https://mitrecyclers.com


Active Member

Posts

Joined
Tue Sep 25, 2018 5:34 pm
Who is online

Users browsing this forum: Majestic-12 [Bot] and 18 guests