Parse error when creating discounts

  • Posts: 29
  • Thank you received: 0
12 years 10 months ago #35211

When I try to add any kind of discount, I get this error:

Parse error: syntax error, unexpected T_VARIABLE in /homepages/9/d320511903/htdocs/administrator/components/com_hikashop/classes/discount.php on line 265


This is line 265:
$coupon2 = clone $coupon1;

And to put it in context:
		$totalprice += $totaldiscount;
		$totalprice_with_tax += $totaldiscount_with_tax;
		$coupon2 = clone $coupon1;
		$coupon2->total = clone $coupon1->total;
		$coupon2->total->prices = $this->copyStandardPrices($coupon1->total->prices);
		switch ($discountmode) {
			case 2:
				$coupon2->total->prices[0]->price_value_with_tax = $totalprice_with_tax;
				$coupon2->total->prices[0]->price_value = $totalprice;
				$currency->addCoupon($coupon2->total,$coupon2);
				$coupon2->total->prices[0]->price_value_without_discount_with_tax -= $totaldiscount_with_tax;
				$coupon2->total->prices[0]->price_value_without_discount -= $totaldiscount;
				$coupon2->discount_percent_amount_calculated_without_tax -= $totaldiscount;
				$coupon2->discount_value_without_tax -= $totaldiscount;
				$coupon2->discount_percent_amount_calculated -= $totaldiscount;
				$coupon2->discount_value -= $totaldiscount;
				$coupon2->discount_flat_amount = $coupon2->discount_value;
				break;
			default:
				$coupon2->total->prices[0]->price_value_with_tax = $totalnondiscount_with_tax;
				$coupon2->total->prices[0]->price_value = $totalnondiscount;
				 $currency->addCoupon($coupon2->total,$coupon2);
				break;
		}


The cart works pretty well otherwise. When I first set it up, I was getting parse errors due to SEF URL issues. I followed directions found on the forum and got it working. In Joomla Global Configuration, I have SEF URLs on and Apache mod_rewrite on; in Hikashop I have short URLs on. I experiemented in turning these off and it didn't change anything. I also tried removing some custom language terms and that didn't help either. (Kind of grasping at straws…)

Is this likely to be related to the SEF URL issue? Or is it something else? I've been able to add products, and the shop is nearly finished.

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

  • Posts: 82910
  • Thank you received: 13379
  • MODERATOR
12 years 10 months ago #35221

It's something else.

Could you try to change:
$coupon2 = clone $coupon1;

to:
$coupon2 = clone($coupon1);

in that file and see if that solves the problem ?

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

  • Posts: 29
  • Thank you received: 0
12 years 10 months ago #35223

Thanks for the quick response. The error I have now is:

Parse error: syntax error, unexpected T_VARIABLE in /homepages/9/d320511903/htdocs/administrator/components/com_hikashop/classes/discount.php on line 266

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

  • Posts: 82910
  • Thank you received: 13379
  • MODERATOR
12 years 10 months ago #35225

It's the same for the line after:
$coupon2->total = clone $coupon1->total;

you need to replace it with:
$coupon2->total = clone($coupon1->total);

That's because you're apparently using PHP4 which doesn't accept this notation.

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

Time to create page: 0.045 seconds
Powered by Kunena Forum