Jump to content

[SOLVED] Quantity discount prices changing into single product prices


Shad86

Recommended Posts

Hey guys,

 

I hope you can help me.

 

In the attached screenshot you see my quantity discount list.

On the right is the price that gets off from the single product price.

But I want the single price for 100 pieces for example in the list.

Is this possible?

 

 

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

Hi Shad,

 

This will give problems if you have attributes that have impact on the price. The table should then also be updated, which isn't the case when showing the discounts (and this updating isn't currently done)

 

For example, in demo database:

iPod Nano comes in version 8GB hard disk and 16GB, each with different price.

When showing the discount (for example -5%,or -$20) this info is all the same for both 8 and 16GB. If you change it into a "Price to pay" value, you need to update this table when changing from 8 -> 16GB because the base price changes.

 

Of course can be done, but is much more work... (extra json/ajax code needed, calculations made etc)

 

 

My 2 cents,

pascal.

Link to comment
Share on other sites

Shad,

if you DON'T have any attribute that impacts the price, you might try to edit the function:

 

    protected function formatQuantityDiscounts

 

in

/controllers/front/ProductController.php   (Make backup! And best would be to override the file instead of directly edit this one. See developers guide on how to do this)

 

Code snippet from 1.5.6.2:

	protected function formatQuantityDiscounts($specific_prices, $price, $tax_rate, $ecotax_amount)
	{
		foreach ($specific_prices as $key => &$row)
		{
			$row['quantity'] = &$row['from_quantity'];
			if ($row['price'] >= 0) // The price may be directly set
			{
				$cur_price = (Product::$_taxCalculationMethod == PS_TAX_EXC ? $row['price'] : $row['price'] * (1 + $tax_rate / 100)) + (float)$ecotax_amount;
				if ($row['reduction_type'] == 'amount')
					$cur_price -= (Product::$_taxCalculationMethod == PS_TAX_INC ? $row['reduction'] : $row['reduction'] / (1 + $tax_rate / 100));
				else
					$cur_price *= 1 - $row['reduction'];
				$row['real_value'] = $price - $cur_price;
			}
			else
			{
				if ($row['reduction_type'] == 'amount')
					$row['real_value'] = Product::$_taxCalculationMethod == PS_TAX_INC ? $row['reduction'] : $row['reduction'] / (1 + $tax_rate / 100);
				else
					$row['real_value'] = $row['reduction'] * 100;
			}
			$row['nextQuantity'] = (isset($specific_prices[$key + 1]) ? (int)$specific_prices[$key + 1]['from_quantity'] : -1);
		}
		return $specific_prices;
	}

Here you should then change the calculation/showing from discount -> fixed price value. (Can be that you have to add a function parameter $baseprice or so as well...)

 

My 2 more cents,

pascal

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

  • 1 month later...
  • 2 weeks 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...