davidchr Posted February 12, 2013 Share Posted February 12, 2013 I have PS 1.4.7. I have several different customers with different percentage discounts on my products, i.e GROUP 1: 10% discount , group 2: 20% discount and so on... I have managed to show the price with tax and without tax both in product-list and product page , however I would like to show "Original price" and then have the ORIGINAL price show without the group discount... I would also like to show the percentage discount given... For example a product which costs 100 and a customer whom has 10% discount because he is in group 1 would like it to show following: Original Price: 100 USD Discount: 10% Your price: 90 USD Please help, I have not found any information regarding this, and the solutions I have found ONLY work on product specific discounts , I need it to show original price ALWAYS , even when group discount customers are logged in. Thankyopu in advance. You may view my site: www.alexo.se Products are found by using the scroller at the top of the page. 1 Link to comment Share on other sites More sharing options...
davidchr Posted February 12, 2013 Author Share Posted February 12, 2013 Any help out there??? I could give a beer or two to the person whom solves my problem. :-) 1 Link to comment Share on other sites More sharing options...
davidchr Posted February 13, 2013 Author Share Posted February 13, 2013 pLEASE... someone...??? Link to comment Share on other sites More sharing options...
melriks Posted March 16, 2013 Share Posted March 16, 2013 (edited) Did you ever find a solution to this problem? I need this same functionality. *************************** Here's a step in the right direction: For product_list.tpl <p class="msrp_price">MSRP:<br /> {$msrp_price=($product.price_without_reduction*1.33333)} {$msrp_price|string_format:"$%.2f"}</p> where 1.33333 is the reverse of your group discount. I only have one active group. Ideally, we need a variable for the default group discount to generate a proper discount reversal calculation. Edited March 16, 2013 by melriks (see edit history) Link to comment Share on other sites More sharing options...
leofrog8 Posted March 23, 2013 Share Posted March 23, 2013 Is this what is needed? this is with discount customer logged in. Link to comment Share on other sites More sharing options...
davidchr Posted March 25, 2013 Author Share Posted March 25, 2013 Yes. That is exactly what I need. Is there a module for this? Thankyou. 1 Link to comment Share on other sites More sharing options...
leofrog8 Posted March 25, 2013 Share Posted March 25, 2013 Please don't laugh, but in investigating how to arrive at this, I have cleverly managed to disable it in my own. I am attempting exactly the same as you and finding the price setting a minefield as there are just so many different ways of changing it, I have, so far found 4 different places! I'm using 1.5.3.1 so I don't know if you have the same in 1.4.7. I suppose the only positive is that it is somewhere in the settings as I haven't changed any code so I just have to unravel it logically and see if I can make it work again. As soon as I find it I'll let you know or maybe worth posting on forge.prestashop.com, I'm already asking too many questions up there so I daren't ask any more - I have found it an excellent alternative source of information to the forum! Link to comment Share on other sites More sharing options...
Paul C Posted March 25, 2013 Share Posted March 25, 2013 (edited) Sorry I didn't see this post before as I have actually had to do this for someone a while back (PS 1.4) To display on the various product pages I had to override the Product class and add something like the following in Product::getProductProperties(): $row['price_member'] = Tools::ps_round(Product::getGroupPriceStatic((int)$row['id_product'], (bool)!Group::getPriceDisplayMethod(2), ((isset($row['id_product_attribute']) AND !empty($row['id_product_attribute'])) ? (int)($row['id_product_attribute']) : NULL), 6), 2); $row['price_rrp'] = Tools::ps_round(Product::getGroupPriceStatic((int)$row['id_product'], (bool)!Group::getPriceDisplayMethod(1), ((isset($row['id_product_attribute']) AND !empty($row['id_product_attribute'])) ? (int)($row['id_product_attribute']) : NULL), 6, 1), 2); This makes use of another function I added to the Product class (also in the same override file): /** * Get product group price * * @param integer $id_product Product id * @param boolean $usetax With taxes or not (optional) * @param integer $id_product_attribute Product attribute id (optional). If set to false, do not apply the combination price impact. NULL does apply the default combination price impact. * @param integer $decimals Number of decimals (optional) * @param integer $id_group group ID (for customer group specific price) * @param boolean $only_reduc Returns only the reduction amount * @param boolean $usereduc Set if the returned amount will include reduction * @param integer $quantity Required for quantity discount application (default value: 1) * @param boolean $forceAssociatedTax Force to apply the associated tax. Only works when the parameter $usetax is true * @param integer $id_cart Cart ID. Required when the cookie is not accessible (e.g., inside a payment module, a cron task...) * @param integer $id_address Customer address ID. Required for price (tax included) calculation regarding the guest localization * @param variable_reference $specificPriceOutput. If a specific price applies regarding the previous parameters, this variable is filled with the corresponding SpecificPrice object * @param boolean $with_ecotax insert ecotax in price output. * @return float Product price */ public static function getGroupPriceStatic($id_product, $usetax = true, $id_product_attribute = NULL, $decimals = 6, $id_group = 2, $only_reduc = false, $usereduc = true, $quantity = 1, $forceAssociatedTax = false, $id_cart = NULL, $id_address = NULL, &$specificPriceOutput = NULL, $with_ecotax = TRUE) { global $cookie, $cart; $cur_cart = $cart; if (!Validate::isBool($usetax) OR !Validate::isUnsignedId($id_product)) die(Tools::displayError()); // Initializations if (!is_object($cur_cart) OR (Validate::isUnsignedInt($id_cart) AND $id_cart)) { /* * When a user (e.g., guest, customer, Google...) is on PrestaShop, he has already its cart as the global (see /init.php) * When a non-user calls directly this method (e.g., payment module...) is on PrestaShop, he does not have already it BUT knows the cart ID */ if (!$id_cart AND !Validate::isCookie($cookie)) die(Tools::displayError()); $cur_cart = $id_cart ? new Cart((int)($id_cart)) : new Cart((int)($cookie->id_cart)); } if ((int)($id_cart)) { if (!isset(self::$_cart_quantity[(int)($id_cart).'_'.(int)($id_product)]) OR self::$_cart_quantity[(int)($id_cart).'_'.(int)($id_product)] != (int)($quantity)) self::$_cart_quantity[(int)($id_cart).'_'.(int)($id_product)] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT SUM(`quantity`) FROM `'._DB_PREFIX_.'cart_product` WHERE `id_product` = '.(int)($id_product).' AND `id_cart` = '.(int)($id_cart) ); $cart_quantity = self::$_cart_quantity[(int)($id_cart).'_'.(int)($id_product)]; } $quantity = ($id_cart AND $cart_quantity) ? $cart_quantity : $quantity; $id_currency = (int)(Validate::isLoadedObject($cur_cart) ? $cur_cart->id_currency : ((isset($cookie->id_currency) AND (int)($cookie->id_currency)) ? $cookie->id_currency : Configuration::get('PS_CURRENCY_DEFAULT'))); if (!$id_address) $id_address = $cur_cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}; if (Tax::excludeTaxeOption()) $usetax = false; $id_country = (int)Country::getDefaultCountryId(); $id_state = 0; $id_county = 0; $id_state = 0; $address_infos = Address::getCountryAndState($id_address); if ($address_infos['id_country']) { $id_country = (int)($address_infos['id_country']); $id_state = (int)($address_infos['id_state']); $id_county = (int)County::getIdCountyByZipCode($address_infos['id_state'], $address_infos['postcode']); } if ($usetax != false AND !empty($address_infos['vat_number']) AND $address_infos['id_country'] != Configuration::get('VATNUMBER_COUNTRY') AND Configuration::get('VATNUMBER_MANAGEMENT')) $usetax = false; $id_shop = (int)(Shop::getCurrentShop()); return Product::priceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $id_county, $id_currency, $id_group, $quantity, $usetax, $decimals, $only_reduc, $usereduc, $with_ecotax, $specificPriceOutput, true); } The 5th parameter in the above function is the group for which you want the price. In my case I only needed the standard price and one other group price which was for members. It has a default of 2 only because that was my member price group. I notice that I also had an override for the ProductController which I assume was a catch-all for cases where the product data didn't go through Product::getProductProperties() class ProductController extends ProductControllerCore { public function process() { parent::process(); if (Validate::isLoadedObject($this->product)) self::$smarty->assign(array( 'price_member' => Product::getGroupPriceStatic($this->product->id, false), 'price_rrp' => Product::getGroupPriceStatic($this->product->id, true, NULL, $decimals = 2, $id_group = 1) )); } } Edited March 25, 2013 by Paul C (see edit history) 1 Link to comment Share on other sites More sharing options...
leofrog8 Posted March 25, 2013 Share Posted March 25, 2013 WOW Paul!! - I have to say that my awe has most definitely been struck - and I thought it was just a case of BO settings, (quietly sneaks off to hide)!!! I don't know about david, the originator of the post but this is all a bit bum tightening for me - I have had a bit of a mess with code but nothing on this scale. Can I come back to you with requests for file names and line numbers where all this has to go? - or do you offer installation service - could it be a case of emailing a complete substitute amended file(s) to upload or is that oversimplification?? I would consider a request for remuneration?? Link to comment Share on other sites More sharing options...
leofrog8 Posted March 25, 2013 Share Posted March 25, 2013 Sorry, I just noticed I hadn't said 'thank you' so ............ Thank you very much indeed!! Link to comment Share on other sites More sharing options...
Paul C Posted March 25, 2013 Share Posted March 25, 2013 Haha I like the "this is all a bit bum tightening for me" comment I'm actually going to move the site that this code is used on to 1.5.3.1 so once that's done I can post back with how I solved it in 1.5.3 - the above was for 1.4 and I know for a fact that it won't work in 1.5+ In 1.5 it should be possible to write a module that can populate an array with all the prices per customer group so you can display/manipulate them as you wish in the product templates. The above is complicated because the group prices weren't just a discounted rate (they don't have to be) but specific pricing per product that is imported into the store. They also had different TAX rules (RRP included VAT and the member price was excluding VAT). I'll be working on this in the next few days. P.S. I was never particularly happy with the above solution but it worked (and still does)! Hoping to do it slightly more elegantly next time.... 1 Link to comment Share on other sites More sharing options...
leofrog8 Posted March 25, 2013 Share Posted March 25, 2013 Ha Ha it's just come back to me (the perils of age) what the expression was - of course it's "buttock clenching" isn't it??!! I have to say you're a complete hero. Personally I don't need anything complex just for it to do as in my screenshot (post 5 above - which I haven't managed to replicate just yet but haven't spent any time on it today - had to sort out ISA's lol), but to show full retail with a fixed price would also be good (so that the punters can see how much they are beating me down. I'm using 1.5.3.1 so I'm really pleased you clarified the issue before I took the bull by the horns and tried to graft it into my program - I think that would have been a case of "bum loosening" rather than tightening what? I've a feeling that I did see module somewhere that did something - but it was a little while ago and can't remember where it was, if I come up with it, may save you some time. I'll try and have a think, but as I'm sure it is with you, I have lot on for the next few days at least (maybe over Easter?) Be great to have it working for 1.5.3.1. - I wait with bated breath. Many thanks again! Link to comment Share on other sites More sharing options...
leofrog8 Posted March 26, 2013 Share Posted March 26, 2013 Hi david I think I may have sorted it to a degree - if you have the same settings in 1.4 as there are in 1.5x. If you let me have an email by PM I'll send you a dropbox reference to a screen video I did last night. Yes. That is exactly what I need. Is there a module for this? Thankyou. Link to comment Share on other sites More sharing options...
Since1953 Posted April 25, 2013 Share Posted April 25, 2013 (edited) Is this what is needed? this is with discount customer logged in. So were you able to do this in 1.5.3 without setting up discount pricing for everything? In other words, I would like everyone that goes to our website to be able to see a list price and our sell price (without having to login). It would be nice if this could be configured in the product page via the BO. Edited April 25, 2013 by Since1953 (see edit history) Link to comment Share on other sites More sharing options...
leofrog8 Posted April 26, 2013 Share Posted April 26, 2013 Have a look at my site www.customrubberstamp.co.uk and check that is how you want it to be. If so I have done a video which I can send a link to my dropbox if you PM me your email address. This is in 1.5.3 without any coding. It shows a net price with a "Reduced Price" banner until you get to the product page then it shows the RRP, the discount % and the final price. As you'll see from the video it can be configured in the BO and can be tailored to customer groups and categories. Pricing and Prestashop takes a little juggling because there are so many different places you can change, if you are working with your live site, check each step very carefully to avoid cumulative discounts putting out some silly prices. Link to comment Share on other sites More sharing options...
aldocampione Posted June 7, 2013 Share Posted June 7, 2013 Hallo Paul have you solved the problem when there are more tha one discount group ? And does it work on 1.5 ? Link to comment Share on other sites More sharing options...
lain Posted June 7, 2013 Share Posted June 7, 2013 (edited) Hello, what I did was to create a variable in frontcontroller.php which contains group id. Then in TPL files add an IF to check if customer belongs certain group and show custom content like percent group discount, stroked prices or anything For example, I only have 1 special group, so to show old price only on this group I use code above and this {convertPrice price=$product.price_without_reduction} in product-list.tpl to show group prices before discount. I could add -10% label too. On the same way, it is possible to add an IF ELSEIF for any groups you want and add custom "-10%", "-15%" labels. Anyway, I guess PS saves group discounts somewhere and you could get it using code. Edited June 7, 2013 by lain (see edit history) Link to comment Share on other sites More sharing options...
aldocampione Posted June 23, 2013 Share Posted June 23, 2013 I notice that I also had an override for the ProductController which I assume was a catch-all for cases where the product data didn't go through Product::getProductProperties() class ProductController extends ProductControllerCore { public function process() { parent::process(); if (Validate::isLoadedObject($this->product)) self::$smarty->assign(array( 'price_member' => Product::getGroupPriceStatic($this->product->id, false), 'price_rrp' => Product::getGroupPriceStatic($this->product->id, true, NULL, $decimals = 2, $id_group = 1) )); } } Hallo Paul thid code does'nt work when you have a combinations of attribute. Could you suggest us how to replace the 3rd parameter actualy set to NULL with the selected product id_attribute ? Link to comment Share on other sites More sharing options...
sanax Posted September 9, 2013 Share Posted September 9, 2013 discount price.png Is this what is needed? this is with discount customer logged in. Where and how did you set the setiings in 1.5.5.0? My first install 2 days ago could do it, my second install, today, does not show the original and discounted price! I can't remeber how to set it... Link to comment Share on other sites More sharing options...
leofrog8 Posted September 9, 2013 Share Posted September 9, 2013 I'm using 1.5.3.1 and haven't looked at 1.5.5.0 but the discounting can be set up in BO "Price Rules" > "Catalog Price Rules" >Add New then configure all the options as you wish If you need further then PM me your email address and I'll give you a link to the rubbish video I did on it!! Cheers bob Link to comment Share on other sites More sharing options...
maccio Posted October 31, 2013 Share Posted October 31, 2013 anyone explain me step by step how make this change on prestashop 1.5.4? Link to comment Share on other sites More sharing options...
maccio Posted November 12, 2013 Share Posted November 12, 2013 is there a module (also with fee) that does this? Link to comment Share on other sites More sharing options...
vekia Posted November 12, 2013 Share Posted November 12, 2013 there is no module for that because to use this feature it is necessary to modify template file. so you have to edit files manually. Link to comment Share on other sites More sharing options...
maccio Posted November 13, 2013 Share Posted November 13, 2013 Hi vekia, have you any suggestions? I can not make this change... Link to comment Share on other sites More sharing options...
vekia Posted November 13, 2013 Share Posted November 13, 2013 sry, i don't have any solution but i can give you tip about that. you can pass to the smarty array logged customer variable ($customer) than you will be able to display customer discount (group discount) Link to comment Share on other sites More sharing options...
leofrog8 Posted November 14, 2013 Share Posted November 14, 2013 Have a look at my site www.customrubberstamp.co.uk and check that is how you want it to be. If so I have done a really rubbish video which I can send a link to my dropbox if you PM me your email address. This is in 1.5.3 without any coding, I don't know if it works in later versions. It shows a net price with a "Reduced Price" banner until you get to the product page then it shows the RRP, the discount % and the final price. As you'll see from the video it can be configured in the BO and can be tailored to customer groups and categories. So you can have it so that it shows to a guest or a visitor or whichever group(s) you want. Pricing and Prestashop takes a little juggling because there are so many different places you can change, if you are working with your live site, check each step very carefully to avoid cumulative discounts which can show some silly prices. Link to comment Share on other sites More sharing options...
And63 Posted November 14, 2013 Share Posted November 14, 2013 (edited) maccio : the Solution you are looking to show the prices for product cart only, or also in the list of products and search? If only the data sheet - the solution is simple The original price shows variable $base_price Price after discount shows the $ProductPrice simply insert variables into templates and ready In product list, result search not is simply - new entry in controller and classes. I make this on my new project site - additional shows % reduction It look thisŁ Product cart: And product list: Gray price- regular price, red price after reduction for group for category, special price etc... Sorry for my english Edited November 14, 2013 by And63 (see edit history) Link to comment Share on other sites More sharing options...
maccio Posted November 18, 2013 Share Posted November 18, 2013 maccio : the Solution you are looking to show the prices for product cart only, or also in the list of products and search? If only the data sheet - the solution is simple The original price shows variable $base_price Price after discount shows the $ProductPrice simply insert variables into templates and ready In product list, result search not is simply - new entry in controller and classes. I make this on my new project site - additional shows % reduction It look thisŁ Product cart And product list: Gray price- regular price, red price after reduction for group for category, special price etc... Sorry for my english Don't work for me. When the customer is logged (the costumer is part of "GROUP A" which has 20% discount) is shown only the price discounted. 1 Link to comment Share on other sites More sharing options...
razzak Posted May 6, 2014 Share Posted May 6, 2014 Have a look at my site www.customrubberstamp.co.uk and check that is how you want it to be. If so I have done a video which I can send a link to my dropbox if you PM me your email address. This is in 1.5.3 without any coding. It shows a net price with a "Reduced Price" banner until you get to the product page then it shows the RRP, the discount % and the final price. As you'll see from the video it can be configured in the BO and can be tailored to customer groups and categories. Pricing and Prestashop takes a little juggling because there are so many different places you can change, if you are working with your live site, check each step very carefully to avoid cumulative discounts putting out some silly prices. Link to comment Share on other sites More sharing options...
Patrik Isaksson Posted May 23, 2014 Share Posted May 23, 2014 Anyone got this to work for PS 1.5.3.1 .. Looking for a solution to show a groups % discount only - the actual number : Your Discount = 20% of Reseller20group Want to show it on each specific product page and also in customers logged in personal information page. Any ideas ? Link to comment Share on other sites More sharing options...
futureshopping Posted May 27, 2014 Share Posted May 27, 2014 On my shop I have a "customer" group with 20% discount on all products and I want to show to this clients the original price inside the product page so, I add this code on product.tpl file: {if $logged == 1} {convertPrice price=$productPrice*1.25} {/if} this works good if you have only one group with fixed percentage discount Link to comment Share on other sites More sharing options...
precreate Posted June 22, 2014 Share Posted June 22, 2014 I needed to show both specific price and old price in category layout. Got it showing there by changing category products listing template file and adding this price: {convertPrice price=$product.price_without_reduction } Link to comment Share on other sites More sharing options...
CrossY Posted July 25, 2014 Share Posted July 25, 2014 I needed to show both specific price and old price in category layout. Got it showing there by changing category products listing template file and adding this price: {convertPrice price=$product.price_without_reduction } This works for me, but can you also disable showing this when there is no discount for a product? Currently it shows: 30,00 - 30,00 on many items for example. Link to comment Share on other sites More sharing options...
stweet Posted December 5, 2017 Share Posted December 5, 2017 any one know how to make this on 1.7 ? Link to comment Share on other sites More sharing options...
0kph Posted March 12, 2018 Share Posted March 12, 2018 (edited) On 28.05.2014 at 1:47 AM, futureshopping said: On my shop I have a "customer" group with 20% discount on all products and I want to show to this clients the original price inside the product page so, I add this code on product.tpl file: {if $logged == 1} {convertPrice price=$productPrice*1.25} {/if} this works good if you have only one group with fixed percentage discount For 1.7.2 I'm using simple solution. Works on logged customers and guests. <?php class ProductController extends ProductControllerCore { public function process() { parent::process(); $cenaKatalogowa = 0; $spec_price = 0; $cenaKatalogowa = $this->product->getPriceStatic($this->product->id, false, 0, 6, null, false, true, 1, false, null, null, null, $spec_price, false, false);// <------ this is what you need to see price without group discount $this->context->smarty->assign(array( 'cena_katalogowa' => $cenaKatalogowa, )); } } Change 'cena_katalogowa' to base_price or 'raw_price and in 'product.tpl' you can use {$base_price} or {$raw_price} Did not tested with other type of discount. How to use: 1) make new file ProductController.php (or open existing) in ps_root/override/controllers/front/ 2) put content inside (or add it if you already have controler) Edited March 12, 2018 by 0kph (see edit history) Link to comment Share on other sites More sharing options...
cushdum Posted February 9, 2019 Share Posted February 9, 2019 Can somebody help me... <p class="msrp_price">CREDIT: {$msrp_price=($product.price_without_reduction*1.26/12)} {$msrp_price|string_format:"$%.2f"} months rate / total 12 months</p> this are a good code to show 2 prices in product.tlp I need the same code, but just for shopping cart, total price to use to create months rate. Thanks a lot... Link to comment Share on other sites More sharing options...
Panther.software Posted October 12, 2021 Share Posted October 12, 2021 If you want to show regular price and without discounts, you should use formula like this: {($product.price_without_reduction/(1-$product.customer_group_discount) )|round:2}{$currency.sign}) 1 Link to comment Share on other sites More sharing options...
taniacr Posted March 23, 2023 Share Posted March 23, 2023 On 10/12/2021 at 12:59 PM, Panther.software said: If you want to show regular price and without discounts, you should use formula like this: {($product.price_without_reduction/(1-$product.customer_group_discount) )|round:2}{$currency.sign}) You Sir, are the real MVP. Link to comment Share on other sites More sharing options...
thn_ Posted March 14 Share Posted March 14 On 10/12/2021 at 1:59 PM, Panther.software said: If you want to show regular price and without discounts, you should use formula like this: {($product.price_without_reduction/(1-$product.customer_group_discount) )|round:2}{$currency.sign}) solution works perfectly in product details, but how to achieve same thing on product list (eg categories)? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now