Jan Jansen
Members-
Posts
51 -
Joined
-
Last visited
Profile Information
-
Activity
Developer
Jan Jansen's Achievements
Newbie (1/14)
10
Reputation
-
Change quantity with buttons
Jan Jansen replied to Petike_baba's topic in Configuring and using PrestaShop
This is getting even more complex. The attributes are also not working with this solution. Only the original product price gets doubled by adding quantities. Now this feature need support for: - Quantity discounts - Attributes It's still a must have feature for my shop, and I think for a lot of other Prestashop-shop-owners too.- 30 replies
-
Change quantity with buttons
Jan Jansen replied to Petike_baba's topic in Configuring and using PrestaShop
A other question: How can I move the € sign in front the price-display? When I click on the quantity buttons now the € sign jumps to the back of the price display. I think I need to change these 2 lines: $("#our_price_display").html(((productPrice*$("#quantity_wanted").val()).toFixed(2)+" "+currencySign).replace('.',','));} and $("#our_price_display").html(((productPrice*$("#quantity_wanted").val()).toFixed(2)+" "+currencySign).replace('.',','));[spam-filter] Any information regarding the € sign and, of course ! the calculation of the product discounts in the final price display is highly appreciated. Thanks everyone!- 30 replies
-
Quantity auto updates price on product page
Jan Jansen replied to lttyrrell's topic in Ecommerce x PrestaShop [ARCHIVE BOARD]
Thank you Vekia, but this price display lacks the calculation of the product discounts in the price display. I'm still searching for the solution / the right line of javascript code. Any input is welcome !- 7 replies
-
- quantity
- prestashop 1.5
-
(and 1 more)
Tagged with:
-
upgrade price when you change the amount
Jan Jansen replied to Sito Lab's topic in Ecommerce x PrestaShop [ARCHIVE BOARD]
Bedankt voor je interesse Pascal, Ik ben ook Nederlands Leuk land btw; Thailand. We zitten op het Engelstalige forumgedeelte, dus even verder in 't Engels: We (me and my companions) like to keep the shop private until our launch. The code of the product page is almost stock-code (product.tpl / product.js), so if you could provide us the (javascript?) code for the right pricing display calculation with the discounts caclulated, then that would be great ! Oftewel, we zouden dat zéér op prijsstellen !! -
upgrade price when you change the amount
Jan Jansen replied to Sito Lab's topic in Ecommerce x PrestaShop [ARCHIVE BOARD]
Hi Pascal, Thank you for your input! The provided code by lonlywolf got the job done for 50%, the other code was incomplete. 50% because everything works besides that most important thing!: the product price discounts are not calculated in the final price. And the product discounts were the only reason that I wanted this feature. Thanks again, if you have a solution please post it in the following topic: http://www.prestashop.com/forums/topic/239317-change-quantity-with-buttons/ -
Change quantity with buttons
Jan Jansen replied to Petike_baba's topic in Configuring and using PrestaShop
Hi lonlywolf, Thanks a lot !! We've came a lot closer to the solution ! I can now get the total price displayed BUT without the product discounts applied. And the discounts were the main reason for me to get this done... Example: I give discount to my products when people buy an "x amount" of my product. I want to have the discount applied to the final displayed product price. The price that is displayed now is incorrect; because discounts are not calculated / included in the final price. Any input is much appreciated!! Thx all !- 30 replies
-
Change quantity with buttons
Jan Jansen replied to Petike_baba's topic in Configuring and using PrestaShop
This doesn't work: http://www.prestashop.com/forums/topic/299907-upgrade-price-when-you-change-the-amount/ lui1969 got exactly the same problem. And those people too: http://www.prestashop.com/forums/topic/290525-quantity-auto-updates-price-on-product-page/ http://www.prestashop.com/forums/topic/247557-product-quantity-increase-or-decrease-on-click-on-product-page/ http://www.prestashop.com/forums/topic/276869-change-quantity-wanted-also-change-price-on-product-page/ This subject remains unsolved.. I need it fixed before I launch my store. All my products got quantity discounts.. If you could look into the problem Vekia; I would really appreciate it !! (and with me more people!) If I was a coder I would have done it myself (of course) but this is something that I'm not able to do.. it would be helpfull for so many merchants, because this is a "must have feature" for every Prestashop shop owner. Edit: The weirdest of this whole case is, imo, that the shopping-cart-page already got this feature! So the code could be copied / enhanced in some way to get it working for the product pages.- 30 replies
-
upgrade price when you change the amount
Jan Jansen replied to Sito Lab's topic in Ecommerce x PrestaShop [ARCHIVE BOARD]
I got the same problem ! I'm trying to find a solution, but I'm not able to get it solved. I hope that Vekia can help us out or someone else. It must be doable, but I don't know anything about coding. Any input about this subject is more then welcome ! Thanks in advance. -
Change quantity with buttons
Jan Jansen replied to Petike_baba's topic in Configuring and using PrestaShop
Update: I tried it now with the original default theme 1.5.6.1.: the original product.tpl file and with the original product.js file. This made no difference ! I have force compile on, cache off, cleaned smarty and autoload cache. I tried it with 3 different browsers, FF, Chrome, IE with also empty cache. Does the price display update for anyone else on the product page with this code?? Or does it not work at all? If you have it working: please provide me a link, maybe I can see there what I'm doing wrong. Thanks in advance !- 30 replies
-
Change quantity with buttons
Jan Jansen replied to Petike_baba's topic in Configuring and using PrestaShop
Thank you for the reply! No I'm sorry, I don't have my shop opened yet, the shop remains in maintenance mode for SEO reasons. Everything is still in development. To make it clear: I want to have the price display (so the price of the product, on the product page) updated when I change the quantity field on the product page with the discounts that I made for a certain amount of my product in the back office. Example; i have a discount of 1 euro for my product which applies the customer buys more than 5 pieces. The original product price per piece is 10 euro. So when I change the quantity field on the product page, the displayed price should for 1 until 4 units be: 10 euro. But with 5 pieces or more in the quantity field, the price display should change to: 9 euro. In the cart this works flawlessly ! The price updates automatically but I try to get the same thing done at the product page. In the product page the price only updates when I change attributes, not when I change quantity. Did I misread anything? I mean: is your line of code made for this purpose? Is there any extra code that I should provide? Do you have any idea what could be missing / what I could be doing wrong? Thx!- 30 replies
-
Use Ajax Cart Script To Product Page
Jan Jansen replied to gtsagat's topic in Configuring and using PrestaShop
Yes this error is related to this topic, I tried to add the function that gtsagat provided to my product page. I see this error near the place where the quantity box is located. I have debug mode enabled in PS. -
Change quantity with buttons
Jan Jansen replied to Petike_baba's topic in Configuring and using PrestaShop
Hi Vekia! Thank you for the reply's, but I can't get this solution to work. The price doesn't update. I added the following code to my product.tpl, in the correct themes folder: <!-- 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}> {literal} <script type="text/javascript"> $(document).ready(function(){ $('#quantity_wanted').val(1); $('.qty_up img').on('click',function(){ if (isNaN(parseInt($('#quantity_wanted').val()))){$('#quantity_wanted').val(1);} else {$('#quantity_wanted').val(parseInt($('#quantity_wanted').val())+1);} }); $('.qty_down img').on('click',function(){ if (isNaN(parseInt($('#quantity_wanted').val()))){$('#quantity_wanted').val(1);} else { if(parseInt($('#quantity_wanted').val())<=1){ } else {$('#quantity_wanted').val(parseInt($('#quantity_wanted').val())-1);[spam-filter] }); }); </script> {/literal} <label> {l s='Quantity:'} </label> <span class="qty_down floatleft"> <img src="{$img_dir}/minus.jpg" width="12" height="12" alt="" title="" /> </span> <input type="text" name="qty" id="quantity_wanted" class="text" 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} /> <span class="qty_up floatleft"> <img src="{$img_dir}/plus.jpg" width="12" height="12" alt="" title="" /> </span> </p> And I added this code to my product.js in the correct themes folder: $(document).ready(function(){ $("#quantity_wanted").change(function(){ $("#our_price_display").html(currencySign+" "+(productPrice*$("#quantity_wanted").val())); }); }); The quantity buttons do work (but i already had them), but the price doesn't update. I use PS 1.5.6.1. What did I do wrong? Thanks all !!- 30 replies
-
Use Ajax Cart Script To Product Page
Jan Jansen replied to gtsagat's topic in Configuring and using PrestaShop
I can't get it to work at all. Any input is welcome ! I get the following error message on my product page, what did I do wrong? I use Prestashop 1.5.6.1. The error: getRow($sql); return $query; } function getMaxPointer($db,$id_product, $quantity) { $sql = " SELECT * FROM `ps_specific_price` WHERE `from_quantity` >= $quantity and `id_product` = ".(int)$id_product." order by `from_quantity` asc" ; $query = Db::getInstance()->getRow($sql); return $query; } function getPreviousPointer($db,$id_product, $quantity) { $sql = " SELECT * FROM `ps_specific_price` WHERE `from_quantity` < $quantity and `id_product` = ".(int)$id_product." order by `from_quantity` desc" ; $query = Db::getInstance()->getRow($sql); return $query; } function getMaxQuantity($db,$id_product) { $sql = " SELECT * FROM `ps_specific_price` WHERE `id_product` = ".(int)$id_product." order by `from_quantity` desc" ; $query = Db::getInstance()->getRow($sql); return $query; } function getMinQuantity($db,$id_product) { $sql = " SELECT * FROM `ps_specific_price` WHERE `id_product` = ".(int)$id_product." order by `from_quantity` asc" ; $query = Db::getInstance()->getRow($sql); return $query; } function getMinQuantityCount($db,$id_product) { $sql = " SELECT COUNT(*) FROM `ps_specific_price` WHERE `id_product` = ".(int)$id_product." order by `from_quantity` asc" ; $query = Db::getInstance()->getValue($sql); return $query; } function specificPriceCustom($db, $id_product, $quantity, $standardPrice){ $standardPrice = str_replace (",",".", $standardPrice); $row = getMaxPointer($db, (int)$id_product, $quantity); $from_quantity = $row["from_quantity"]; $maxrow = getMaxQuantity($db, (int)$id_product); $maxQuantity = $maxrow["from_quantity"]; $userCheck = $maxrow["id_customer"]; $minrow = getMinQuantity($db, (int)$id_product); $minQuantity = $minrow["from_quantity"]; $totalRows = getMinQuantityCount($db, (int)$id_product); if ( $from_quantity == $quantity && $from_quantity!=$maxQuantity ): if ( $row["price"] == "-1" ): if ( $row["reduction_type"] == "percentage" ): $price = $standardPrice - $standardPrice*$row["reduction"] ; elseif ( $row["reduction_type"] == "amount"): $price = $standardPrice - $row["reduction"] ; endif; else: $price = $row["price"] ; endif; $price = $quantity * number_format ( $price, 2 ); return $price; elseif ( $from_quantity > $quantity && $quantity > $minQuantity): $row = getPreviousPointer($db,(int)$id_product, $row["from_quantity"]); if ( $row["price"] == "-1" ): if ( $row["reduction_type"] == "percentage" ): $price = $standardPrice - $standardPrice*$row["reduction"] ; elseif ( $row["reduction_type"] == "amount"): $price = $standardPrice - $row["reduction"] ; endif; else: $price = $row["price"] ; endif; $price = $quantity * number_format ( $price, 2 ); return $price; elseif ( $quantity >= $maxQuantity ): if ( $totalRows == "1" ): if ( $maxrow["price"] == "-1" ): if ( $maxrow["reduction_type"] == "percentage" ): $price = $standardPrice - $standardPrice*$maxrow["reduction"] ; elseif ( $maxrow["reduction_type"] == "amount"): $price = $standardPrice - $maxrow["reduction"] ; endif; else: $price = $maxrow["price"] ; endif; $price = $quantity * number_format ( $price, 2 ); return $price; elseif ( $userCheck == 0): if ( $maxrow["price"] == "-1" ): if ( $maxrow["reduction_type"] == "percentage" ): $price = $standardPrice - $standardPrice*$maxrow["reduction"] ; elseif ( $maxrow["reduction_type"] == "amount"): $price = $standardPrice - $maxrow["reduction"] ; endif; else: $price = $maxrow["price"] ; endif; $price = $quantity * number_format ( $price, 2 ); return $price; else: $row = getPreviousPointer($db,(int)$id_product, $maxQuantity); endif; if ( $row["price"] == "-1" ): if ( $row["reduction_type"] == "percentage" ): $price = $standardPrice - $standardPrice*$row["reduction"] ; elseif ( $row["reduction_type"] == "amount"): $price = $standardPrice - $row["reduction"] ; endif; else: $price = $row["price"] ; endif; $price = $quantity * number_format ( $price, 2 ); return $price; else: $price = $quantity * $standardPrice; return $price; endif; } function specificPricePlain($db, $id_product, $quantity, $standardPrice){ $price = $quantity * $standardPrice; return $price; } if ( $check_quantity_discounts != ""): echo specificPriceCustom($db, $id_product, $quantity, $standardPrice); else: echo specificPricePlain($db, $id_product, $quantity, $standardPrice); endif; ?> € tax incl.