Jump to content

Price increase by group


userdeviant

Recommended Posts

Hi all,

 

I need to increase all prices of everything by 5% and for some customers I need to decrease prices by 30%. So first group of customers will have 105% when the second ones will have 70% of original prices.

 

I do not know where are prices calculated, I am not good programmer so my solution is add negative value (-5%) for group of customers which will have increased prices. I did it manually to ps_group table.

 

Eeverything seem to be ok and prestashop seems to by ok etc. so my question is not about solution but about "what I did by that". Did I something wrong when I added negative value to that table? Is any possibility to tell me if prestashop will crash or something when it will use that negative percent?

 

Thank you for any answers

 

Note: I have Prestashop 1.4.7.0

 

EDIT: Or, if somebody could tell me where exactly is calculated price vs. group discount and which way is result used for display and another actions. Maybe name of files and row in that files ... and I will try look myself if there could be any problem. Thank you

Edited by userdeviant (see edit history)
Link to comment
Share on other sites

You can configure group price reduction inside the group configuration. Just edit the group and enter the discount in percent.

You cannot enter an increase here however (like 105%). Why not just start with your prices 5% higher, and then reduce appropriately for the other group?

Link to comment
Share on other sites

Thank you for your reply

 

I can not do what you wrote. I need prices inside shop at their 100% value and then:

- one group have 5% higher (only way for me is place negative value to database, because at BO it can not be done)

- second group will have 30% discount

 

Problem is, that 30% discount is from 100% price. If I use prices at their 105% value as 100%, then 30% from that value is not same of course. If I want discount from 105% value same as described above, so it is in real 33.3333333.........%, but prestashop uses only 33.33% and when price is little higher, there is little difference ... and of course next problem is round of value with that 33.33% discount.

 

If you know which file I could check to decide if calculating of discount with -5% is or is not a problem for another parts of shop, I will look myself, thank you very much

Link to comment
Share on other sites

  • 1 year later...
  • 9 months later...

I think i may have found it in classes/product.php

 

You can try to edit the following code :

 

// Group reduction
if ($use_group_reduction)
{
$reduction_from_category = GroupReduction::getValueForProduct($id_product, $id_group);
if ($reduction_from_category !== false)
$price -= $price * (float)$reduction_from_category;
else // apply group reduction if there is no group reduction for this category
$price *= ((100 - Group::getReductionByIdGroup($id_group)) / 100);
}
 
simply reverse + / -
Try changing last line to   $price *= ((100 - Group::getReductionByIdGroup($id_group)) / 100);.
 
For me this works and works in product lists and should also work in product page. However for me i am using a attribute grid module on the product page and it's not working there.
 
But hope this helps for you guys!.....
  • Like 1
Link to comment
Share on other sites

  • 6 months later...

 

I think i may have found it in classes/product.php

 

You can try to edit the following code :

 

// Group reduction
if ($use_group_reduction)
{
$reduction_from_category = GroupReduction::getValueForProduct($id_product, $id_group);
if ($reduction_from_category !== false)
$price -= $price * (float)$reduction_from_category;
else // apply group reduction if there is no group reduction for this category
$price *= ((100 - Group::getReductionByIdGroup($id_group)) / 100);
}
 
simply reverse + / -
Try changing last line to   $price *= ((100 - Group::getReductionByIdGroup($id_group)) / 100);.
 
For me this works and works in product lists and should also work in product page. However for me i am using a attribute grid module on the product page and it's not working there.
 
But hope this helps for you guys!.....

 

 

Life saver to add margin for all prices imported via dropship wholesale integration!

Link to comment
Share on other sites

  • 2 weeks later...
  • 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
×
×
  • Create New...