Jump to content

How can i put no price and write "ask for price"


MyLibary

Recommended Posts

  • 2 months later...

Hi Rocky,

I have check your old post. However, I am wondering if the following instruction still valid for version 1.3.1. The line 176 in version 1.3.1 is the "static public function switchLanguage()"

Can you please kindly provide the latest instruction to change the "Price=0, return "Call for Price" for the new prestashop 1.3.1? Or in which section it should be located?

Many Thanks,
Marufish


Instruction from Rocky in the forum http://www.prestashop.com/forums/viewthread/30213/#163653

The way I would do it is to add the following at line 177 of classes/Tools.php (after the “$price =” line):

if ($price == 0)
   return 'Call for price';



and modify js/tools.js in your theme’s directory and add the following to the start of the formatCurrency function:

 if (price == 0)
   return 'Call for price';



This will change all $0.00 to ‘Call for price’, but on the product page, it will display as ‘Call for price tax incl.’, so you’ll have to modify product.tpl and the tpls of any other modules if necessary and write something like {if $price != 0}{l s=‘tax incl.’}{/if}. You’ll have to modify modules/blockcart/blockcart.php too, since the totals will display as ‘Call for price’ when nothing is in the cart.


   {if !$priceDisplay || $priceDisplay == 2}
{convertPrice price=$product->getPrice(true, $smarty.const.NULL, 2)}
           {if $product->getPrice(true, $smarty.const.NULL, 2) > 0}{l s='tax incl.'}{/if}
   {/if}
   {if $priceDisplay == 1}
{convertPrice price=$product->getPrice(false, $smarty.const.NULL, 2)}
           {if $product->getPrice(false, $smarty.const.NULL, 2) > 0}{l s='tax excl.'}{/if}
   {/if}

   {if $priceDisplay == 2}


{convertPrice price=$product->getPrice(false, $smarty.const.NULL, 2)}{if $product->getPrice(false, $smarty.const.NULL, 2) > 0} {l s='tax excl.'}{/if}
   {/if}



{if ($product->reduction_price != 0 || $product->reduction_percent != 0) && ($product->reduction_from == $product->reduction_to OR ($smarty.now|date_format:'%Y-%m-%d' <= $product->reduction_to && $smarty.now|date_format:'%Y-%m-%d' >= $product->reduction_from))}


   {if !$priceDisplay || $priceDisplay == 2}
{convertPrice price=$product->getPriceWithoutReduct()}
           {if $product->getPriceWithoutReduct() > 0}{l s='tax incl.'}{/if}
   {/if}
   {if $priceDisplay == 1}
{convertPrice price=$product->getPriceWithoutReduct(true)}
           {if $product->getPriceWithoutReduct(true) > 0}{l s='tax excl.'}{/if}
  {/if}



Link to comment
Share on other sites

Thanks Rocky for the fast response.

The first two action has worked properly, all the Price = 0 changed to "Call for Price". I attached here with the
Tools.php
tools.js

However, when I replace the following code in the line 268 of Product.tpl, some error occurred.
1. Missing product page of the items set to $0
2. The "Shipping" and "Total" items in the shopping cart still remain with "Call for Price"

I attached here with the product.tpl for the prestashop theme. May I know if I did it wrong with the location of the code?

Here is the coding that I paste into product.tpl

   {if !$priceDisplay || $priceDisplay == 2}
{convertPrice price=$product->getPrice(true, $smarty.const.NULL, 2)}
           {if $product->getPrice(true, $smarty.const.NULL, 2) > 0}{l s='tax incl.'}{/if}
   {/if}
   {if $priceDisplay == 1}
{convertPrice price=$product->getPrice(false, $smarty.const.NULL, 2)}
           {if $product->getPrice(false, $smarty.const.NULL, 2) > 0}{l s='tax excl.'}{/if}
   {/if}

   {if $priceDisplay == 2}


{convertPrice price=$product->getPrice(false, $smarty.const.NULL, 2)}{if $product->getPrice(false, $smarty.const.NULL, 2) > 0} {l s='tax excl.'}{/if}
   {/if}



{if ($product->reduction_price != 0 || $product->reduction_percent != 0) && ($product->reduction_from == $product->reduction_to OR ($smarty.now|date_format:'%Y-%m-%d' <= $product->reduction_to && $smarty.now|date_format:'%Y-%m-%d' >= $product->reduction_from))}


   {if !$priceDisplay || $priceDisplay == 2}
{convertPrice price=$product->getPriceWithoutReduct()}
           {if $product->getPriceWithoutReduct() > 0}{l s='tax incl.'}{/if}
   {/if}
   {if $priceDisplay == 1}
{convertPrice price=$product->getPriceWithoutReduct(true)}
           {if $product->getPriceWithoutReduct(true) > 0}{l s='tax excl.'}{/if}
  {/if}

tools.js

Tools.php

product.tpl.txt

Link to comment
Share on other sites

  • 2 months later...

Hi,

I have modified the file tool.js and tools.php and as you wrote the problem now is that it shows "call for price with VAT".

I tried to modify my product.tpl but without success. Could you explain better where and what I need to change to doesn't show "with VAT" when product price is set to zero?

Thanks

Nicola

Link to comment
Share on other sites

  • 8 months later...

I had a bit of an error pop up..

The cart when you have nothing in the cart it too says "call for price"

then you go to view another product and boom..

Fatal error: Uncaught exception ‘JSMinException’ with message ‘Unterminated string literal.’ in /home/tinao/public_html/tools/js_minify/jsmin.php:94 Stack trace: #0 /home/tinao/public_html/tools/js_minify/jsmin.php(235): JSMin->action(1) #1 /home/tinao/public_html/tools/js_minify/jsmin.php(64): JSMin->min() #2 /home/tinao/public_html/classes/Tools.php(1255): JSMin::minify(’// ??// PrestaS…’) #3 /home/tinao/public_html/classes/Tools.php(1242): ToolsCore::packJS(’// ??// PrestaS…’) #4 /home/tinao/public_html/classes/Tools.php(1233): ToolsCore::packJSinHTMLpregCallback(Array) #5 /home/tinao/public_html/config/smarty.config.inc.php(197): ToolsCore::packJSinHTML(’/\s*(<script\b[…’, Array, ‘<script type=“t…’) #6 /home/tinao/public_html/tools/smarty/sysplugins/smarty_internal_filter_handler.php(57): smartyPackJSinHTML(’<script type=“t…’) #7 /home/tinao/public_html/tools/smarty/Smarty.class.php(337): Smarty_Internal_Filter_Handler::runFilter(’<script type=“t…’, Object(Smarty_Internal_Template)) #8 /home/tinao/public_h in /home/tinao/public_html/tools/js_minify/jsmin.php on line 94

I need to do this action but without the error.. can you help pretty please?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...