prestatent Posted June 20, 2012 Share Posted June 20, 2012 Hi I'm fairly new to Prestashop and am a developer. I have setup customer groups with a discount for each group. For example: Group 1 - 35% discount Group 2 - 40% discount Group 3 - 45% discount My question is fairly simple. When I log in as a customer in one of these groups, I would expect to see the non-discounted price as well as the discounted price shown on the product page, but only the reduced price is shown. Does anyone have any idea of how to achieve this? I have looked at various answers but the solutions either do not work, or are not applicable. Any help would be much appreciated. Thanks David Link to comment Share on other sites More sharing options...
prestatent Posted June 20, 2012 Author Share Posted June 20, 2012 Possibly this is a bug and I should report it as such. Does anyone else think this is a bug? I should point out I'm using: Prestashop 1.4.8.2 PHP 5.2 Apache 2.0 MySQL 5.3 Windows 7 Link to comment Share on other sites More sharing options...
halennoor Posted June 21, 2012 Share Posted June 21, 2012 Not sure if there is already a module ready to display the group prices. Seems the price displayed is dependent on the "default customer group" chosen. I have also tried grouping customer into 1. Group 1- Distributors - 30% discount 2. Group 2- Retailers - 15% discount 3. Group 3 - no discount if checked the box next to both customer groups e.g. Group 1 and Group 3 but only the one you chose on the default drop down box is displayed ( after any current specific prices rule in the product page tab is taken into account). It would be great if all product price information can be displayed to the customer account according to their groups in a glance as well just like the stats dashboard. In other word, for employees/admins they can see these info in the back office easily and for customers ( e.g. distributors and retailers) they can see those in front office ( through account information) somewhere that specific products are with all relevant pricing/discount for them. These prices are also displayed together on their front office when they logged in according to their customer group e.g. distributor or retailer. Link to comment Share on other sites More sharing options...
prestatent Posted June 21, 2012 Author Share Posted June 21, 2012 This should be a fairly simple issue to resolve. Currently if you put an individual product on sale, on the product page you see the original price with a line through it and also the sale price. All I'm looking to do is the same for group prices. When the user is logged in, they will see the original price with a line through and their group price. Should be as simple as that. As I'm new to Prestashop, I'm not sure if this the default behaviour, or I have to set a configuration option in the Backoffice to turn this on in the frontend. Otherwise I'm thinking I will have to create an override to display this original price. Link to comment Share on other sites More sharing options...
olea Posted June 21, 2012 Share Posted June 21, 2012 If you use the discount proposed in the group configuration, the prices are changed, for the given group, without stroked price information, nor recution information. If you want these information, dont' set discount in the group configuration and for each product, go into the prices tab, then add a reduction for the given group. You will then have the price, the original stroked price and the recduction percent. You have to do this with all products. Note that the group discount is cumualtive with the reduction you set in the prices tab of a product Link to comment Share on other sites More sharing options...
prestatent Posted June 21, 2012 Author Share Posted June 21, 2012 Thanks Olea. Unfortunately this solution is not very practical, as this means that if you had three groups (three reduction percentages), and 100 products, you would have to define three reductions for each product to get the desired effect of a stroked price. There must be another solution to this, as this must be a fairly common request. My thoughts are that I will create an override for the Product class to return the correct price and apply stylng myself. Thank you again for your answer. Link to comment Share on other sites More sharing options...
halennoor Posted June 21, 2012 Share Posted June 21, 2012 If you use the discount proposed in the group configuration, the prices are changed, for the given group, without stroked price information, nor recution information. If you want these information, dont' set discount in the group configuration and for each product, go into the prices tab, then add a reduction for the given group. You will then have the price, the original stroked price and the recduction percent. You have to do this with all products. Note that the group discount is cumualtive with the reduction you set in the prices tab of a product the trouble with doing that is we have to go to each product individually to effect the price reduction for the group through the price tab. Would be convenient that we have an option to set for all products a reduced price for the specific groups and they can automatically see the prices on their front office display according to their groups. Link to comment Share on other sites More sharing options...
prestatent Posted June 22, 2012 Author Share Posted June 22, 2012 Agree with Halennoor, there must be a simple way to do this, without applying a discount to all products Link to comment Share on other sites More sharing options...
prestatent Posted July 2, 2012 Author Share Posted July 2, 2012 SOLVED. To resolve this issue, as there did not seem to be any easy way via the backoffice to do this, I created - an override for the Product class - cloned the relevant functions and renamed them to something else - modified my template to call in these new functions and display the price depending on whether a user is logged in or not. Link to comment Share on other sites More sharing options...
halennoor Posted July 2, 2012 Share Posted July 2, 2012 SOLVED. To resolve this issue, as there did not seem to be any easy way via the backoffice to do this, I created - an override for the Product class - cloned the relevant functions and renamed them to something else - modified my template to call in these new functions and display the price depending on whether a user is logged in or not. prestatent, would it be possible to share how this is solved or how it looks like on your site Link to comment Share on other sites More sharing options...
prestatent Posted July 2, 2012 Author Share Posted July 2, 2012 Halennoor Unfortunately I have not uploaded this to my server yet, but attached code as follows: - priceFullCalculation function in /overrides/classes/Product.php - returns full price with tax. - within your theme product.tpl file you will have some code similar to: {if $priceDisplay >= 0 && $priceDisplay <= 2} {if $cookie->isLogged(true)} <p class="srp">SRP: <span id="old_price_display" class="srp">{convertPrice price=$product->getFullPrice(true, $smarty.const.NULL,2)}</span></p> <p class="vip">VIP Price: <span id="our_price_display" class="vip">{convertPrice price=$product->getPrice(true, $smarty.const.NULL,2)}</span></p> {else} <p class="srp">SRP:<span id="our_price_display" class="srp">{convertPrice price=$product->getPrice(true, $smarty.const.NULL,2)}</span></p> {/if} {/if} The function $product->getFullPrice returns the price from the override class in Product.php. You can then style this however you like, eg, to put a line through the price. The SRP is the full price if not logged in. The VIP price is the logged in price for the customer group. Hope this helps. Product.php 2 Link to comment Share on other sites More sharing options...
rashidobs Posted January 15, 2013 Share Posted January 15, 2013 How can it be accessible in product-list.tpl ? Link to comment Share on other sites More sharing options...
rashidobs Posted January 15, 2013 Share Posted January 15, 2013 (edited) just call it like this in product-list.tpl {convertprice price=Product::getFullPrice(...... } Edited January 16, 2013 by rashidobs (see edit history) Link to comment Share on other sites More sharing options...
avdarie Posted January 28, 2013 Share Posted January 28, 2013 Hey, I have same problem with Prestashop 1.4.8 . This overrides of Product.php I can use for my version ? I ask that because I've tried and I get smarty error. unknown tag "convertprice"' Regards, Link to comment Share on other sites More sharing options...
cesargalway Posted April 25, 2013 Share Posted April 25, 2013 Hi avdarie! Just change in "convertPrice"' Regards. 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...
w3bsolutions Posted November 28, 2013 Share Posted November 28, 2013 Does this work in PS 1.5.6 and show the baseprice (no discounts) with / without tax according to default group configuration of the user? It would not make much sense to show the base price tax included and discounted price tax excluded... Anyone tried in PS 1.5.6? Link to comment Share on other sites More sharing options...
GS VISION Posted June 10, 2014 Share Posted June 10, 2014 just call it like this in product-list.tpl {convertprice price=Product::getFullPrice(...... } Does not work for me on product-list.tpl. Link to comment Share on other sites More sharing options...
ayin Posted January 26, 2015 Share Posted January 26, 2015 (edited) Hey prestatent, Can you explain why does that method invokes another static method? The logic couldn't just be there? Thanks EDIT: Also i have the following error: Fatal error: Call to a member function getPrice() on a non-object in C:\xampp\apps\prestashop\htdocs\tools\smarty\sysplugins\smarty_internal_templatebase.php(157) : eval()'d code on line 186 HalennoorUnfortunately I have not uploaded this to my server yet, but attached code as follows:- priceFullCalculation function in /overrides/classes/Product.php - returns full price with tax.- within your theme product.tpl file you will have some code similar to: {if $priceDisplay >= 0 && $priceDisplay <= 2} {if $cookie->isLogged(true)} <p class="srp">SRP: <span id="old_price_display" class="srp">{convertPrice price=$product->getFullPrice(true, $smarty.const.NULL,2)}</span></p> <p class="vip">VIP Price: <span id="our_price_display" class="vip">{convertPrice price=$product->getPrice(true, $smarty.const.NULL,2)}</span></p> {else} <p class="srp">SRP:<span id="our_price_display" class="srp">{convertPrice price=$product->getPrice(true, $smarty.const.NULL,2)}</span></p> {/if} {/if} The function $product->getFullPrice returns the price from the override class in Product.php. You can then style this however you like, eg, to put a line through the price. The SRP is the full price if not logged in. The VIP price is the logged in price for the customer group.Hope this helps. Edited January 27, 2015 by ayin (see edit history) Link to comment Share on other sites More sharing options...
petrutz91 Posted April 7, 2017 Share Posted April 7, 2017 I did in this way: Assign a customer to a group which I want to display the price. (customer id=4) Add the folowing to / classes / Product.php public function getPriceGroup($id_product, $tax = true, $id_product_attribute = null, $decimals = 6, $divisor = null, $only_reduc = false, $usereduc = true, $quantity = 1, $force_associated_tax = false, $id_customer = 4, $id_cart = null, $id_address = null, &$specific_price_output = null, $with_ecotax = true, $use_group_reduction = true, Context $context = null, $use_customer_price = true) { return Product::getPriceStatic((int)$this->id, $tax, $id_product_attribute, $decimals, $divisor, $only_reduc, $usereduc, $quantity, $force_associated_tax, $id_customer, $id_cart, $id_address, $specific_price_output, $with_ecotax, $use_group_reduction, $context, $use_customer_price ); } And after add in the file / yourtheme / product.tpl Price group: {convertPrice price=$product->getPriceGroup()} It took some time to learn the structure, but at the end it work. Hope that it will work also for you. Best regards 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