Jump to content

[SOLVED] How to change the method of calculation of the final price


And63

Recommended Posts

We have in Prestashop weight as possible in terms of promotions, discounts for groups of customers for a given product category.

 

My question relates to a method of calculating the final price - where is it made​​?

 

Namely, we have the product for retail 1000€ D, but our regular customers we give him 10% (discount for group in category) off R

- Price displayed about -900 €.

We're doing great promotion and lowering prices for the week for only one product of 200 € (special price) S

 

K now the final price is calculated according to the formula:

 

K = (D-(D * R)) - (S-(S * R)) is:

K = (1000 - (1000 * 10%) - (200 - (200 * 10%))

K = 900 - 180

K = 720€

 

But I want to make the price of this product was on special offer

K = D-S

K = 1000€ - 200€

K = 800€

 

 

An example of the output price € 1000

 


 

prestashop 1.5.4.1

 

Sorry for my english

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

Hi Pascal.

I'm in my store 10 groups of customers with various discounts categories.
Counting every week that I have set the price for which the group would be too cumbersome.
So I modified the core system already for their needs and hopes as I want to.
 
Since the problem solved - Mark Topic as resolved :)
Link to comment
Share on other sites

Hi Pascal.

The solution that I used is not universal.
Assumptions were the:
The store does not and will not be used as a special price reduction %
Discounts for groups of clients assigned to a category of products do not affect the special price.
Price added in the BO as a special price is displayed as the reduction in price, so far is an added reduction.
Price of the product added in this way is valid in store for client groups which has been allocated.
The reduction applies only to the specific product.
Each product can be assigned a different price special.
Discounts for groups of clients assigned to a category of products do not affect the special price.
 
 
Solution:
 
In file /classes/Product.php:
change code from:
if ($use_group_reduction)
		{
			if ($reduction_from_category = (float)GroupReduction::getValueForProduct($id_product, $id_group))
				$price -= $price * $reduction_from_category;
			else // apply group reduction if there is no group reduction for this category
				$price *= ((100 - Group::getReductionByIdGroup($id_group)) / 100);
		}

to:

if ($use_group_reduction)
		{ 
                        if ($specific_price)
                            $price = $specific_price['reduction'];
			else if ($reduction_from_category = (float)GroupReduction::getValueForProduct($id_product, $id_group))
				$price -= $price * $reduction_from_category;
			else // apply group reduction if there is no group reduction for this category
				$price *= ((100 - Group::getReductionByIdGroup($id_group)) / 100);
		}

That's it - goal achieved  :rolleyes:

 

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 months later...
I modified some patch and now it is added correctly. 

conditions: 

If the product has a discount category is not applicable it at a special price:

 



if ($use_group_reduction)
{
if ($specific_price)
$price += $price * $reduction_from_category = (float)GroupReduction::getValueForProduct($id_product, $id_group);
else if ($reduction_from_category = (float)GroupReduction::getValueForProduct($id_product, $id_group))
$price -= $price * $reduction_from_category;
else // apply group reduction if there is no group reduction for this category
$price *= ((100 - Group::getReductionByIdGroup($id_group)) / 100);
}

Link to comment
Share on other sites

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...