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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Best eCart practice recommendation

Thread began 10/14/2014 8:27 pm by Steve | Last modified 10/15/2014 4:16 pm by Jason Byrnes | 363 views | 17 replies |

Steve

Best eCart practice recommendation

Hello,
I’ d like a suggestion on best practices to check for a product intersection.

Our products have a StartDate and an EndDate saved as a Unix TimeStamp.

The logic for checking if an intersection exists is as follows:

if ($targetEndDate >= $startDate && $targetStartDate <= $endDate)
{
$showMe = 'trueness';
}
else
{
$showMe = 'false';
}



Our Product page has all the products listed so firing off the validation check on the Product page could be one solution.
The Add to Cart button takes us to the Cart page which looks like an equally viable page to use for checking if there is a clash.

My original logic is to take the first item set to the cart and establish a startDate and endDate, then each newly added product would run the conditional statement as the targetStartDate and targetEndDate. IF an intersection is present we show an alert (show region).

Validation on the Product page would have to block the adding of a new product that clashes but would make it more difficult to remove one item and select another.

Validation on the Cart page seems like it may be the best location to check for clashes but since there is no recordset and the eCart values are sessions, it seems I’d need to pull the productIds from the Session values and then do a comparison.

Before I start programming this , are their any suggestions on the best practices to achieve this goal in eCart (6)?

Sign in to reply to this post

Jason ByrnesWebAssist

There isn't early a "best practice" for this, it's custom coding scenario.

Myself, rather than doing validation on the start - end date I would hide items that are not within the range.

If you need help implementing this, please submit a premiere support appointment:
http://www.webassist.com/premier_request.php

Sign in to reply to this post

Steve

Jason,

Hiding is not a optimal option from a Marketing perspective since the Customer may select a less costly subscription range 1st and then not have the option to select a more costly greater date spanning product if it is hidden. Presenting both and then an alert saying delete one would allow them the freedom to pick which item they would like to retain (on the cart page level).


Is there a way to iterate through the web assist separated session values?


For instance on my cart page I have the following session value containing 3 items and start and end dates for each:

["eCart1_Items"]=>
string(837) "2|WAECART| Next week’s prediction|WAECART|Game predictions for the week. |WAECART||WAECART|0|WAECART|1|WAECART|29|WAECART|1413270000|WAECART|1413874800|WAECART|12|WAECART|14133301714138528|WAECART|0|WAECART|29|WAECART|1 Next week’s prediction (2)


?WA?6|WAECART|Entire Season PROMOTION|WAECART|Game predictions for the ENTIRE season including the playoff games for one low price. Offer expires October 15th. |WAECART||WAECART|0|WAECART|1|WAECART|199|WAECART|1412665200|WAECART|1422864000|WAECART|12|WAECART|141333341205642125|WAECART|0|WAECART|199|WAECART|1 Entire Season PROMOTION (6)


?WA?5|WAECART|All playoff games|WAECART|Game predictions for all playoff games.|WAECART||WAECART|0|WAECART|1|WAECART|29|WAECART|1417507200|WAECART|1422864000|WAECART|12|WAECART|141333341570919962|WAECART|0|WAECART|29|WAECART|1 All playoff games (5)"


Are they like an index? $_SESSION['eCart1_Items'] something to step through the separated values?

Sign in to reply to this post

Jason ByrnesWebAssist

use the repeat cart region behavior to loop through the cart and call each column by name, for example this will write each item Name in the cart:


<?php
while (!$eCart1->EOF()) {
?>
<?php echo $eCart1->DisplayInfo("Name"); ?>
<?php
$eCart1->MoveNext();
}
$eCart1->MoveFirst();
?>
Sign in to reply to this post

Steve

Perfect, thank you Jason!

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

Steve

Is there a way to count the number of items in the cart using a comparison operator?

<?php if ($eCart1->TotalRows >= 1) { 
echo 'Equal or more than 1 ';
} ?>



TotalRows does not seem to work like it would on a recordset

Sign in to reply to this post

Steve

This post has been deleted.

Jason ByrnesWebAssist

This will give the total quantity in the cart.

<?php echo $eCart1->TotalColumn("Quantity"); ?>

Sign in to reply to this post

Steve

Jason,
Is there a Function that gives a unique Product count? Rather than TotalColumn which gives a total quantity of any existing items.

I tried :

echo $eCart1->TotalColumn("Quantity");
echo '<br> TotalColumn name: '. $eCart1->TotalColumn("Name");

expecting that the TotalColumn function applied to a product title (name) would have returned the count of Products in the cart, but instead returned the name of the Product.


While TotalCount Quantity is really close it will show a single product with 2 items as "2" when the goal is screening for more than "1" Product in the cart.

Thanks for your help!

Sign in to reply to this post
loading

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