Jump to content

Cart price reduction not working on products with attributes


carlroger

Recommended Posts

Hi,

 

I have two cart rules: 10% off when ordering 15 pcs. and 20% off ordering 30 pcs. All my products have several attributes that increase the price.

 

When I choose 15 or 30 pcs. with the standard product without selected attributes, the price is calculated correctly. But if I choose an attribute, the price is still calculated as if no attribute is chosen.

 

How do I fix this? IMO this is a very critical bug.

 

/Carl

Link to comment
Share on other sites

 

Very good but I'm experiencing another problem now. When I reach the discount amount, the price increases. In product.js, I added this:

$('#our_price_display').text(formatCurrency(priceWithDiscountsDisplay * $('#quantity_wanted').val(), currencyFormat, currencySign, currencyBlank)).trigger('change');

and this:

var combID = $('#idCombination').val();
var combination = combinationsFromController[combID];
if(typeof(combination) != 'undefined')
{
	// check if we need to subtract a % from the combo price
	if($(this).data('discount-type') == 'percentage')
	{
		var comboImpact = combination.price - (combination.price / 100 * $(this).data('discount'));
	} else {
		var comboImpact = combination.price;
	}
	newPrice = formatCurrency(($(this).data('discount-myvalue') + comboImpact) * $('#quantity_wanted').val(), currencyFormat, currencySign, currencyBlank);
}

And in product.tpl:

<tr id="quantityDiscount_{$quantity_discount.id_product_attribute}" class="quantityDiscount_{$quantity_discount.id_product_attribute}" data-real-discount-value="{convertPrice price = $realDiscountPrice}" data-discount-myvalue="{$realDiscountPrice}" data-discount-type="{$quantity_discount.reduction_type}" data-discount="{$quantity_discount.real_value|floatval}" data-discount-quantity="{$quantity_discount.quantity|intval}">

What am I doing wrong?

Link to comment
Share on other sites

Went over the code again and it's probably because I don't have a base price of the products. All the prices are defined by the attributes. If I change the last line (newPrice) to this, then it works:

newPrice = formatCurrency(comboImpact * $('#quantity_wanted').val(), currencyFormat, currencySign, currencyBlank);
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...