close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

eCart Cookie error

Thread began 3/07/2013 5:34 am by jackson446396 | Last modified 3/08/2013 5:51 am by jackson446396 | 487 views | 2 replies |

jackson446396

eCart Cookie error

Hi,

I've been using eCart for a few years and have always stored the cart details using session variables. I'm now looking to change this so the cart is stored in cookies instead.

In the code I changed the PersistanceType to 1 but when I ran the website it returned an error as certain functions couldn’t be found in WA_eCart_Definition_PHP.php

Please can you provide the PHP code for the following functions:
- SetCookies
- SetCookieInfo
- GetCookies

Many thanks

Sign in to reply to this post

Jason ByrnesWebAssist

the exact code will depend on the columns in your cart. This is the code generated for the default columns:

ID, Name, Description, Thumbnail, Weight, Quantity, Price

php:
//get cookies

function GetCookies($ItemString)     {
  $itemArray = explode("|WAEC|", $ItemString);
   $itemID = $itemArray[0];
   $itemName = $itemArray[1];
   $itemDescription = $itemArray[2];
   $itemThumbnail = $itemArray[3];
   $itemWeight = $itemArray[4];
   $itemQuantity = $itemArray[5];
   $itemPrice = $itemArray[6];
  return new eCart1_ItemDefinition($itemID, $itemName, $itemDescription, $itemThumbnail, $itemWeight, $itemQuantity, $itemPrice);
}
//get cookies
//set cookies
function SetCookies($itemIndex)     {
  $ItemString = "";
  $ItemString .= $this->Items[$itemIndex]->ID."|WAEC|";
  $ItemString .= $this->Items[$itemIndex]->Name."|WAEC|";
  $ItemString .= $this->Items[$itemIndex]->Description."|WAEC|";
  $ItemString .= $this->Items[$itemIndex]->Thumbnail."|WAEC|";
  $ItemString .= $this->Items[$itemIndex]->Weight."|WAEC|";
  $ItemString .= $this->Items[$itemIndex]->Quantity."|WAEC|";
  $ItemString .= $this->Items[$itemIndex]->Price;
  return $ItemString;
}
//set cookies
//cookie information
function SetCookieInfo($theCookieString)     {
  $numDays   = 14;
  $theDomain = "";
  $thePath   = "";
  $cookSec   = false;
  if ($numDays == "") $numDays="0";
  $theDate = strtotime("+".$numDays." Days");
  setcookie($this->CartName."_Items", $theCookieString, $theDate, $thePath, $theDomain, $cookSec);
}
//cookie information
Sign in to reply to this post

jackson446396

Brilliant, thanks for your help!

Sign in to reply to this post

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...