Jump to content

[PS 1.6] Show ALL specific group prices in product page | Help!


movster
 Share

Recommended Posts

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.


ZtakZGj.jpg

post-991508-0-56240300-1484441291_thumb.jpg

Share this post


Link to post
Share on other sites

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 by shokinro (see edit history)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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}

....
 

Share this post


Link to post
Share on other sites

  • 2 months later...

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 by petrutz91 (see edit history)

Share this post


Link to post
Share on other sites

  • 1 year 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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More