close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

bug found in eCart_PHP recarding discount rules

Thread began 9/04/2016 4:35 pm by Christopher West | Last modified 9/08/2016 10:41 am by Christopher West | 1024 views | 4 replies

Christopher WestCommunity Expert

bug found in eCart_PHP recarding discount rules

Hi there, I just finished creating some discount rules in the eCart object. and on uploading to localhost I have the following error:

Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\xampp\htdocs\armadillo\WA_eCart\eCart_PHP.php on line 108

I am attaching the file, I assume the error will also return on my other discount rules.

I assume its a bug since I didnt use any custom coding, I just used the eCart object and my session variables.

How do I fix?

php:
//eCart Rule

//eCart Rule
function WAEC_eCart_AllProductsPercentageDiscount()  {
  $totalDiscount = 0;
  if (true && ((sizeof($this->Items) > 0) && (isset($_SESSION['CouponDiscount'])) && ((isset($_SESSION['CouponType'])?$_SESSION['CouponType']:"") == "1") && ((isset($_SESSION['CouponGroup'])?$_SESSION['CouponGroup']:"") == "1") && (time() >= strtotime("".$_SESSION['CouponValidFrom']  ."")) && (time() <= strtotime("".$_SESSION['CouponValidTo']  ."")))) {
    $totalDiscount += ($this->TotalColumn("TotalPrice") * ".$_SESSION['CouponDiscount']  .");//Result
  }
  return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}





.....update...I have found removing some code generated by the eCart Object discount tool to the below works:

php:
[php]

//eCart Rule
//eCart Rule
function WAEC_eCart_AllProductsPercentageDiscount()  {
  $totalDiscount = 0;
  if (true && ((sizeof($this->Items) > 0) && (isset($_SESSION['CouponDiscount'])) && ((isset($_SESSION['CouponType'])?$_SESSION['CouponType']:"") == "1") && ((isset($_SESSION['CouponGroup'])?$_SESSION['CouponGroup']:"") == "1") && (time() >= strtotime($_SESSION['CouponValidFrom']  ."")) && (time() <= strtotime($_SESSION['CouponValidTo']  ."")))) {
    $totalDiscount += ($this->TotalColumn("TotalPrice") * $_SESSION['CouponDiscount']);//Result
  }
  return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
[/php]




NOTES: I have removed the following parts:
strtotime("".$_SESSION['CouponValidFrom'] ."") TO strtotime($_SESSION['CouponValidFrom'] ."")
strtotime("".$_SESSION['CouponValidTo'] ."") TO strtotime($_SESSION['CouponValidTo'] ."")
".$_SESSION['CouponDiscount'] ."); TO $_SESSION['CouponDiscount']);




Chris

Attached Files
eCart_PHP.php

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...