movster Posted January 15, 2017 Share Posted January 15, 2017 I have 4 specific group members - I added specific prices for every group on products. Group 1 - 10$ Group 2 - 8$ Group 3 - 7$ Group 4 - 6$ I want to display all four prices on product page, not just only one for default user group.I did research but every topic in this case is left without a single word. Can't find the solution.Any ideas? Please help. Link to comment Share on other sites More sharing options...
movster Posted January 15, 2017 Author Share Posted January 15, 2017 Anyone? Link to comment Share on other sites More sharing options...
shokinro Posted January 15, 2017 Share Posted January 15, 2017 (edited) if you are not able to find a existing commercial module, you may consider to make custom changes. You can use following function call to the price for the product for each group and then show that on your product page public static function getPriceStatic($id_product, $usetax = true, $id_product_attribute = null, $decimals = 6, $divisor = null, $only_reduc = false, $usereduc = true, $quantity = 1, $force_associated_tax = false, $id_customer = null, $id_cart = null, $id_address = null, &$specific_price_output = null, $with_ecotax = true, $use_group_reduction = true, Context $context = null, $use_customer_price = true, $id_customization = null) Hope this helps. Edited January 16, 2017 by shokinro (see edit history) Link to comment Share on other sites More sharing options...
movster Posted January 16, 2017 Author Share Posted January 16, 2017 Too bad it doesn't help me at all. I do mainly front-end changes. I thought it would be pretty easy like adding {somecode.groupPrice=1,lol}... I did big research of modules and didn't find this functionality in any of them. If someone would give his time, and try to help me with code it would be great because this functionality was never solved yet (as far as I search). And if you can give me some advice where I can find some more knowledge of doing things like this it would be great too. Link to comment Share on other sites More sharing options...
shokinro Posted January 16, 2017 Share Posted January 16, 2017 you can try to use override of front product controller in following method in file /override/controllers/front/ProductController.php (you need create one if it does not have a override yet) and then pass price info to theme file , you will be able to use that in product.tpl file Below is just a guidance, you need implement and test it by your own. public function initContent() { parent::initContent(); $id_customer1 = (int)Db::getInstance()->getValue('SELECT id_customer FROM ' ._DB_PREFIX_ . 'customer WHERE id_default_group = 1 limit 1') $price_group1 = Product::getPriceStatic($id_product, true, null, 6, null, false, true, 1, false, $id_customer1) $id_customer2 = (int)Db::getInstance()->getValue('SELECT id_customer FROM ' ._DB_PREFIX_ . 'customer WHERE id_default_group = 2 limit 1') $price_group2 = Product::getPriceStatic($id_product, true, null, 6, null, false, true, 1, false, $id_customer2); ..... $this->context->smarty->assign(array( 'price_group1' => $price_group1 ,'price_group2' => $price_group2 ,..... )); } In your theme file you can use like this Group 1 price: {$price_group1} Group 2 price: {$price_group2} .... Link to comment Share on other sites More sharing options...
petrutz91 Posted April 6, 2017 Share Posted April 6, 2017 Can you please share the working script, I understand the logic and try to adapt for 1.6 but without success. Thank you in advance! Link to comment Share on other sites More sharing options...
petrutz91 Posted April 7, 2017 Share Posted April 7, 2017 (edited) 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 Edited April 7, 2017 by petrutz91 (see edit history) Link to comment Share on other sites More sharing options...
Darko Posted December 12, 2018 Share Posted December 12, 2018 Hi petrutz91, any chance that you migrate this solution to Presta 1.7? In case you did, pls. could you explain how? Thank you! 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