[SOLVED] Discount Not Applied to Variants

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #8762

No, only the one which a few lines next to the other one

Please Log in or Create an account to join the conversation.

  • Posts: 242
  • Thank you received: 0
13 years 9 months ago #8766

Sorry, but I'm not sure I understand. I see that code on lines 902, 988 and 2208. Which of those are you referring to?

Thanks,
Ed

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #8767

You need to change :

			if(!empty($element->prices)){
				$this->selectDiscount($element,$discounts);
				if(!empty($element->prices)){
					foreach($element->prices as $k=>$price){
						$this->addDiscount($element->prices[$k],$element->discount,$discount_before_tax,$zone_id,$element->product_tax_id);
					}
				}
			}
			if(!empty($element->variants)){
				foreach($element->variants as $k => $row){
					if(!empty($row->prices)){
						$this->selectDiscount($element->variants[$k],$discounts);
						if(!empty($element->variants[$k]->discount)){
							foreach($row->prices as $k2=>$price){
								$this->addDiscount($element->variants[$k]->prices[$k2],$element->variants[$k]->discount,$discount_before_tax,$zone_id,$element->product_tax_id);
							}
						}
					}
				}
			}
by:
						if(empty($element->discount) && !empty($element->prices)){
				$this->selectDiscount($element,$discounts);
				if(!empty($element->discount)){
					foreach($element->prices as $k=>$price){
						$this->addDiscount($element->prices[$k],$element->discount,$discount_before_tax,$zone_id,$element->product_tax_id);
					}
				}
			}
			if(!empty($element->variants)){
				foreach($element->variants as $k => $row){
					if(empty($row->discount) && !empty($row->prices)){
						$this->selectDiscount($element->variants[$k],$discounts);
						if(!empty($element->variants[$k]->discount)){
							foreach($row->prices as $k2=>$price){
								$this->addDiscount($element->variants[$k]->prices[$k2],$element->variants[$k]->discount,$discount_before_tax,$zone_id,$element->product_tax_id);
							}
						}
					}
				}
			}

Last edit: 13 years 9 months ago by nicolas.

Please Log in or Create an account to join the conversation.

  • Posts: 242
  • Thank you received: 0
13 years 9 months ago #8775

One step forward and two steps back it seems. :unsure:

That seems to have fixed the discount on variants in both the cart module and in checkout, but now the discount is not applied to the default price, which was working before. It shows a -$5.00 in both, but the price does not get changed.

Ed

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #8778

On our end it works in all cases with that modification. In the cart/checkout but also on the product page.

Please Log in or Create an account to join the conversation.

  • Posts: 242
  • Thank you received: 0
13 years 9 months ago #8786

Please take a look at this product on my dev site. The standard price for that one is $30.00 and it has a $5.00 flat rate discount applied.

The HD variant is normally $40 and $35 with the discount. That looks OK, but not the SD version.

I'm going to be out for most of the day so will check back when back in the office.

Thanks,
Ed

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #8869

Since it works on our end and not on yours we will need an FTP access to your website in order to debug the problem.

Please Log in or Create an account to join the conversation.

  • Posts: 242
  • Thank you received: 0
13 years 9 months ago #8873

We're having a problem with the server right now but I'll set you up with FTP credentials as soon as we are back up.

Ed

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #8946

I just changed the code of #8767 as there was a typo. It might be why you don't get the expected result. Could y try again to apply that change with the new code ?

Please Log in or Create an account to join the conversation.

  • Posts: 242
  • Thank you received: 0
13 years 9 months ago #8950

I had a major problem on the server last night and my websites are still being restored from backups. I'll check it out as soon as all is back up and running.

Thanks,
Ed

Please Log in or Create an account to join the conversation.

  • Posts: 242
  • Thank you received: 0
13 years 9 months ago #9003

I finally got everything back online and inserted the revised patch above. The cart module and checkout now reflect the proper discounted variant prices, but now the variant price on the product page is incorrect (default price is correct). The regular HD variant was $40 and with $5 flat rate discount should display as $40 (lined out) and $35 with discount. Instead, it displays as $0.00 (lined out) and $40.00 for the discounted price. Placing that product in the cart shows the price as $35 with -$5, just as it should.

I'll set you up with FTP and user admin account tomorrow. I've been up too long now and need to get some sleep.

Ed

Please Log in or Create an account to join the conversation.

  • Posts: 242
  • Thank you received: 0
13 years 9 months ago #9018

Nicolas,

Admin and FTP credentials sent for development site here .

Thanks,
Ed

Last edit: 13 years 9 months ago by hdracing.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #9059

There was a glitch left in the code.
I modified it and it's working on your website too now.

Please Log in or Create an account to join the conversation.

  • Posts: 242
  • Thank you received: 0
13 years 9 months ago #9062

BITCHIN' - (for those too young or not familiar with American '60s slang, see www.merriam-webster.com/dictionary/bitchin%27 Definition #2 if no more problems found :laugh: )

Ed

Please Log in or Create an account to join the conversation.

Time to create page: 0.075 seconds
Powered by Kunena Forum