Jump to content

show real-time price in product page


Recommended Posts

Hi masters,

I'm PrestaShop Newbie and I'm not english, so excuse me If I will not be able to choose the best way to explain my problem... 

In product page I would like to show total price of a product, according to the quantity set by the user.

Untill now, instead, total price doesn't change in real time if I modify quantity value in product page and I don't understand if it is normal or not...

I hope I've been clear... anyhow I attach file of my problem

post-725749-0-33437200-1384033360_thumb.jpg

Sorry for my english and thanks in advance.

(I have 1.5.6.0 version of Prestashop)

Edited by faxlain (see edit history)
Link to comment
Share on other sites

Master of masters Vekia, It is an honor to host you in my topic  B)

Many thanks for your reply, I suppose that to do what I would like I should add some script in my tpl files (maybe in product.tpl...?). And I suppose the script to add is similar to some script in one file like shopping-cart.tpl... Maybe is it right?

Can you help me to find a solution? Unfortunately, I'm not a programmer and untill now I've worked only with WP, so I know PHP little better than TPL script (if I can say so)....

anyway thanks for read my problem!

Link to comment
Share on other sites

WOW! It work! Sir, you are an I-D-O-L!

if anybody cares I write down the string of code to change:

 

<!-- quantity wanted -->
<p id="quantity_wanted_p"{if (!$allow_oosp && $product->quantity <= 0) OR $virtual OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>
<label>{l s='Quantity:'}</label>
<input type="text" name="qty" id="quantity_wanted" class="text" onchange="$('#our_price_display').html(currencySign+' '+$('#quantity_wanted').val()*productPrice)"; value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}{/if}" size="2" maxlength="3" {if $product->minimal_quantity > 1}onkeyup="checkMinimalQuantity({$product->minimal_quantity});"{/if} />
</p>
 
Thank you very much Vekia, I hope to meet you again in the forum  ^_^
Link to comment
Share on other sites

Ops... I spoke too soon, because I have another issue....

In my product page I set two size of product, "sample" with a small price, and "product per square meter" with normal price.

Your string of code works great if I select quantity of "product per square meter"; instead if I select the other, "sample", the price that I can see always refers to "product per square meter", without consider the price difference... What is it wrong Sir?

Edited by faxlain (see edit history)
Link to comment
Share on other sites

Yesterday night I realized that I haven't said you another important thing (I'm like a Disel, I need more time to put my brain in motion...).

I get this error only if I add to "Quantity" more than one product; infact, if I select only one product, I can see the correct price difference between "Sample" and "Product per square meter"...

In substance, only the sum of product always refers to "Product per square meter"; can this suggest you something, Master?

Anyway, thanks for your time.

Link to comment
Share on other sites

...This problem is becoming more and more strange...

I've noted another unusual thing: in some case (and apparently in an illogical way) the total price shows a lot of decimal numbers, although there would be no need.

I attach file of this new problem (img. top is ok; img. down is sadly ko):

 

post-725749-0-56988600-1384281494_thumb.jpg

 

Master, what do you think about this? Is it a bug of PS?

 

p.s. I suspect you are starting to hate me...  :blush:
Edited by faxlain (see edit history)
Link to comment
Share on other sites

  • 10 months later...

Vekia

 

would you know how i can apply your fix to my dropdown quantity wanted, how can i insert your code?

 

 

onchange="$('#our_price_display').html(currencySign+' '+$('#quantity_wanted').val()*productPrice)";

 

my code:

 

    <!-- quantity wanted  drop-->   
                          
     <p id="quantity_wanted_p"{if (!$allow_oosp && $product->quantity <= 0) OR $virtual OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>          <label>quantité désirée</label>    {if $product->minimal_quantity > 1}               

 <select type="text" title="{l s='Quantity'}" name="qty" id="quantity_wanted" class="text" style="width:auto;">     


 <option value="{$product->minimal_quantity}">{$product->minimal_quantity}</option>                 <option value="{$product->minimal_quantity*2}">{$product->minimal_quantity*2}</option>                  <option value="{$product->minimal_quantity*3}">{$product->minimal_quantity*3}</option>                  <option value="{$product->minimal_quantity*4}">{$product->minimal_quantity*4}</option>                  <option value="{$product->minimal_quantity*5}">{$product->minimal_quantity*5}</option>                </select>                {else}{if $product->minimal_quantity <= 1}                <select type="text" title="{l s='Quantity'}" name="qty" id="quantity_wanted" class="text" style="width:auto;">                <option value="1">1</option>                <option value="2">2</option>                <option value="3">3</option>                <option value="4">4</option>                <option value="5">5</option>                <option value="6">6</option>                <option value="7">7</option>                <option value="8">8</option>                <option value="9">9</option>                <option value="10">10</option>
  </select>             

   {/if}   {/if}
<!-- quantity wanted drop -->        
          

 

Thanks!

Link to comment
Share on other sites

  • 4 weeks later...

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...