Error when discounted products

  • Posts: 54
  • Thank you received: 2
  • Hikaserial Subscription Hikashop Business
11 years 6 months ago #105097

error on cart process when some categories are discounted and buyer entering a valid coupon :

administrator/components/com_hikashop/classes/currency.php on line 1717 (invalid argument on each)

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 6 months ago #105109

Hi,

We need more information about your configuration and your error.
Which version of HikaShop are you using ?
What's your currency configuration ?
What coupon are you using ? What is his configuration ?

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 54
  • Thank you received: 2
  • Hikaserial Subscription Hikashop Business
11 years 6 months ago #105285

Hi

sorry for my late reply and thank you for your support :

Hikashop Business version in production now, only one currency (euro) is in use, other currency are not actived, several coupons code are in use;

one coupon code with pourcentage dreduction limited in time with 1 quota per buyer, for all products, categories and zone and with option to ignore products with discount .
one discount with pourcentage reduction limited too in time but only for one category



thank-you.

Attachments:
Last edit: 11 years 6 months ago by consultech.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 6 months ago #105302

Hi,

The first thing I see it not the error with the "foreach" but the division by zero line 1711

$discount->discount_percent_amount_calculated = $price->price_value_with_tax*$discount->discount_percent_amount_calculated_without_tax/$price->price_value_with_tax;
Which means that your price with tax is zero.

Would it be possible to have a link to your store in order to test it directly (you can send it by private message) or have more screenshots about my previous questions ? (screenshots contains quite more information).

Thanks,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 54
  • Thank you received: 2
  • Hikaserial Subscription Hikashop Business
11 years 6 months ago #105306

thanks jérome, see MP please.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 6 months ago #105333

Hi,

I tried your discount coupon in your store with the product "Fauteil La Baule" (first product I saw) and the coupon works good.
No error, no warning message, no processing problem.

Total
652,00 €
Coupon -130,40 €
Livraison 69,00 €
TVA 96,79 €
Total final 590,60 €


Sorry, I can't reproduce you're problem in your store.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 54
  • Thank you received: 2
  • Hikaserial Subscription Hikashop Business
11 years 6 months ago #105409

Hi,

Unfortunately, my client had completed the promotion of one of the categories. I therefore create a special product test so that you can reproduce the error. see mp instructions.

regards,

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 6 months ago #105436

Hi,

Thanks, I now see the error message.

Would it be possible to see (screenshot or access) the configuration of the product and the configurations of the discount on this product and the coupon code ?
I want to reproduce your problem in my local website in order to fix it.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 54
  • Thank you received: 2
  • Hikaserial Subscription Hikashop Business
11 years 6 months ago #105442

please see mp

thank you

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 6 months ago #105475

Hi,

We have a recent fix in the discount system but I don't have to right to update HikaShop in your website for checking it.
Can you please update the file "administrator/components/com_hikashop/classes/discount.php" and replace the code:

		if ($discountmode == 1) {
			$coupon2->total->prices[0]->price_value_without_discount_with_tax += ($totalprice_with_tax - $totalnondiscount_with_tax);
			$coupon2->total->prices[0]->price_value_without_discount += ($totalprice - $totalnondiscount);
			$coupon2->total->prices[0]->price_value_with_tax += ($totalprice_with_tax - $totalnondiscount_with_tax);
			$coupon2->total->prices[0]->price_value += ($totalprice - $totalnondiscount);
			$coupon2->total->prices[0]->price_value_with_tax -= $totaldiscount_with_tax;
			$coupon2->total->prices[0]->price_value -= $totaldiscount;
		}
By:
		if ($discountmode == 1) {
			$coupon2->total->prices[0]->price_value_without_discount_with_tax = $totalprice_with_tax;
			$coupon2->total->prices[0]->price_value_without_discount = $totalprice;
			$coupon2->total->prices[0]->price_value_with_tax -= $coupon2->discount_value;
			$coupon2->total->prices[0]->price_value -= $coupon2->discount_value_without_tax;
		}
Best regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 54
  • Thank you received: 2
  • Hikaserial Subscription Hikashop Business
11 years 6 months ago #105478

many thanks for your support.

Sincerly yours,

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

  • Posts: 54
  • Thank you received: 2
  • Hikaserial Subscription Hikashop Business
11 years 6 months ago #105482

can you check again please code is modified... but still not working

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 6 months ago #105517

Bonsoir,

En effet, le problème est toujours là.
Malheureusement je suis un peu bloqué pour faire des tests ou des correctifs sur votre site.

Edit: Je suis en train de faire des tests en local mais je ne reproduit pas exactement le même comportement.

Cordialement,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 11 years 6 months ago by Jerome.

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

  • Posts: 54
  • Thank you received: 2
  • Hikaserial Subscription Hikashop Business
11 years 6 months ago #105573

Hi jérome

Ok, thanks a lot... waiting for a fix now...

Best regards,

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
11 years 6 months ago #105582

Bonjour,

Dans le fichier "administrator/components/com_hikashop/classes/currency.php", remplacer:

						$discount->discount_value_without_tax = $discount->discount_percent_amount_calculated_without_tax = $discount->discount_percent_amount_calculated = ($price->price_value*floatval($discount->discount_percent_amount)/100.0);
						$discount->discount_percent_amount_calculated = 0.0;
						$discount->discount_percent_amount_calculated = $price->price_value_with_tax * $discount->discount_percent_amount_calculated_without_tax / $price->price_value_with_tax;
Par
						$discount->discount_value_without_tax = $discount->discount_percent_amount_calculated_without_tax = $discount->discount_percent_amount_calculated = ($price->price_value*floatval($discount->discount_percent_amount)/100.0);
						$discount->discount_percent_amount_calculated = 0.0;
						if($price->price_value_with_tax != 0.0)
							$discount->discount_percent_amount_calculated = $price->price_value_with_tax * $discount->discount_percent_amount_calculated_without_tax / $price->price_value_with_tax;
Dans le fichier "administrator/components/com_hikashop/classes/discount.php", remplacer:
				$total->prices[0]->price_value_with_tax = $totalnondiscount_with_tax;
				$total->prices[0]->price_value = $totalnondiscount;
				$currency->addCoupon($total,$coupon2);
Par
				$total->prices[0]->price_value_with_tax = $totalnondiscount_with_tax;
				$total->prices[0]->price_value = $totalnondiscount;
				$total->prices[0]->taxes = array();
				$currency->addCoupon($total,$coupon2);
Le problème du calcul du coupon a été corrigé par le précédent patch, ces modifications permettent d'éviter des erreurs de type "warning" mais n'affectant pas le résultat final.

Cordialement,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: consultech

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

  • Posts: 54
  • Thank you received: 2
  • Hikaserial Subscription Hikashop Business
11 years 6 months ago #105591

Perfect... working properly.

Many thanks for your support.

Best regards,

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

Time to create page: 0.086 seconds
Powered by Kunena Forum