close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Modding a Very Old Version of eCart

Thread began 8/17/2012 4:07 am by contact433031 | Last modified 9/11/2012 8:39 am by Jason Byrnes | 2929 views | 3 replies |

contact433031

Modding a Very Old Version of eCart

Hi,

I currently have a client that's using a very old version of eCart and is unwilling to upgrade to a proper database-based shopping cart, so I am stuck with figuring out how to modify the code to fit within their design constraints.

I'm a graphics -- print production -- person who has moved into the web space, so my knowledge of code -- specifically javascript -- is mediocre, at best.

Here are my questions:
1. how do I find out what version of eCart we are using?
- This is not a Dreamweaver plugin or GUI-attached version of the software, like your current product offerings that incorporate MySQL and PHP. It's all javascript that's modified one file at a time that uses browser cookies to store order information. As far as I can see it's been used as early as late 2007 or early 2008.

2. What are the limitations of the cookie-based javascript version of this software that might hinder or invalidate attempts to use eCart? Specifically, is there a limit to the number of items that can be added to the cart with a single form action?

Using PHP I've been able to alter the code to the extent that products from a MySQL database will populate the javascript fields, but I have run up against a limit of 24 items that can be recognized by the cookie. Specifically, I am using a PHP loop to display items from the database and then loop the eCart JS code so that there are 32 _quantity_ input fields on a single page (representing 32 different colors) with a single "add to cart" JS function.

It works splendidly unless I want any of the items beyond the first 24, which do not show up at all, even if they are the only items selected.

If you need files to explain I can provide them, and I'd greatly appreciate ay help you can offer.

Thanks in advance.

Sign in to reply to this post

Jason ByrnesWebAssist

I dont recall a version of eCart that did not have a Dreamweaver UI, Please send a copy of one of the add to cart pages and the cart display page so i can take a look at the code.

as far limitations to Cookies based carts, all browsers have a maximum size that a cookie can be.

for example in IE, the maximum size of a cookie is 4096 bytes:
306070

in eCart, there is the option to store the cart information in a session variable or use a cookie, we recommend using the session for storing the cart because it does not have the size limitation.

Sign in to reply to this post

contact433031

Thanks for the reply.

I was able to solve most of my problems by splitting the session into multiple sessions to increase the number of items the cart will accept.

I'm still running into an issue where the cart duplicates items when adding to the cart (this happens only in Safari, which normally wouldn't be a problem, but 60% of customers use Safari for this client).

I was unaware that this was always a DW plugin, but here's the cart.php code:

<?php
session_start();
$_SESSION['ids']=$_REQUEST['total'];
$_SESSION['values']= $_REQUEST['vals'];
?>
<?php
if($_REQUEST['op']=='clear')
{
unset($_SESSION['cart']);
header('location:cart.php');
}

if($_REQUEST['op']=='add')
{
require_once("WA_eCart/adp_PHP.php");
?>
<script>
window.location='cart.php';
</script>
<?php
}

if($_REQUEST['op']=='update')
{
$ids=$_REQUEST['ids'];
$vals=$_REQUEST['vals'];
require_once("WA_eCart/up_PHP.php");
?>
<script>
window.location='cart.php';
</script>
<?php
}
include 'header.php';
echo '<div id="bodyContent" class="grid_24 push_0">';

?>


<center>
<body>
<div id="Layer1" div align="center">
<br />

<div class="eC_Simple_Poppy_Arial">
<div id="center">
<?php

if (isset($_SESSION['length']))
{
?>
<form action="cart.php" method="POST" >
<h2>Your Shopping Cart</h2>
<table class="eC_ShoppingCartUpdateable" border="0" cellspacing="0" cellpadding="10">
<tr>
<th class="eC_FormItem" >Quantity</th>
<!-- <th class="eC_FormItem" >Remove</th>-->
<th>Name</th>
<th class="eC_PriceItem" >Size</th>
<th>Color</th>
<th class="eC_PriceItem" >Price</th>
<th class="eC_PriceItem" >Total</th>
</tr>
<?php
$c=0;
$cart=$_SESSION['cart'];
$cart=explode("*",$cart);
$total=0;
foreach($cart as $c)
{
$c=explode("|",$c);
$itemID=$c[0];
$itemName=$c[1];
$itemType=$c[2];
$itemColor=$c[3];
$itemQuantity=$c[4];
$itemPrice=$c[5];
$itemTotal=$c[6];
$total+=$itemTotal;
if($itemQuantity!='')
{
?>
<tr>
<td class="eC_FormItem" ><input type="text" name="adp_Quantity_<?php echo $itemID; ?>" size="3" value="<?php echo $itemQuantity; ?>" /></td>
<!-- <td class="eC_FormItem" ><input type="checkbox" value="<?php //echo $adp->DisplayInfo("ID"); ?>" name="adp_Delete_<?php //echo $adp->DisplayIndex; ?>" /></td>-->
<td><?php echo $itemName; ?></td>
<td class="eC_PriceItem" ><?php echo '';//$adp->DisplayInfo("Size"); ?></td>
<td><?php echo $itemColor; ?></td>
<td class="eC_PriceItem" ><?php echo $itemPrice; ?></td>
<td class="eC_PriceItem" ><?php echo $itemTotal; ?></td>
</tr>
<?php
}
}
$_SESSION['total']=$total;
}
?>
</table>
<br />
<h3>Order Summary</h3>
<div class="eC_OrderSummary">
<table border="0" cellpadding="0" cellspacing="0" class="eC_CartSummary">

<tr>
<td class="eC_SummaryLabel">Sub-total : </td>
<td><?php echo " $ ".$total; ?></td>
</tr>

<tr>
<td class="eC_SummaryLabel"></td><!-- Shipping (Will be deducted from U.S. Orders on Address Confirmation at Checkout) -->
<td></td> <!--&nbsp; -->
</tr>
<tr>
<td class="eC_IndividualCharge"><?php /*echo $adp->RuleLooperName("Shipping"); */?></td>
<td><?php /* echo WA_eCart_DisplayMoney($adp, $adp->RuleLooperValue("Shipping")); */ ?></td>
</tr>

<tr class="eC_SummaryFooter">
<td class="eC_SummaryLabel">Total:</td>
<td><?php echo " $ ".$total; ?></td>
</tr>
<tr class="eC_ButtonWrapper">
<td>&nbsp;</td>
<td>&nbsp;

</td>
</tr>
</table>
<table class="eC_ButtonWrapper" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">

<input type="button" style="background-image:url(continue.png); background-color:transparent; background-position:center; background-repeat:no-repeat; width:144px; height:43px; border:none; cursor:pointer" alt="Clear Cart" onClick="window.location='orderverandabracelet.php'" />
<input type="button" value="" name="clear" style="background-image:url(clearcart.png); background-position:center; background-repeat:no-repeat; height:43px; width:144px; border:none; cursor:pointer" onClick="window.location='cart.php?op=clear'"/>

<input type="button" name="update" style="background-image:url(update.png); background-color:transparent; background-position:center; background-repeat:no-repeat; width:144px; height:43px; border:none; cursor:pointer" src="update.png" alt="Update" value="" onClick="upCart();" />
<input type="button" style="background-image:url(send.png); background-position:center; background-repeat:no-repeat; width:144px; height:43px; border:none; cursor:pointer" src="checkout.png" alt="Checkout" onClick="window.location='checkout.php'" />
</td>
</tr>
</table>

</div>
</form>

<?php

if(!isset($_SESSION['cart']) || empty($_SESSION['cart']))
{
?>
<table><tr><td>The cart is empty</td></tr></table>
<?php
}
?>
</div>


</div>






</div>

</div>

<script language="javascript">
function upCart()
{
var fields = document.getElementsByTagName('input');
var qty='';
var ids='';
for(var i=0;i<fields.length;i++)
{
if(fields[i].type=='text')
{
qty = qty+fields[i].value+"|";
ids = ids+fields[i].name+"|";
}
}
window.location='cart.php?op=update&ids='+ids+'&vals='+qty;
}
</script>
<?php
include 'footer.php';
?>
Sign in to reply to this post

Jason ByrnesWebAssist

This is looking like code from eCart v1, thats a blast from the past. This code is about 10 years old. I think for this, we will need to look into the problem through a premiere support ticket since the code base is so far back from the past.

If you visit the support landing page, you can submit a new ticket and we van contact you to look into the problem.

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