close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Adding More Columns in eCart Object?

Thread began 4/08/2009 1:36 pm by Art | Last modified 7/16/2010 10:42 am by Art | 3518 views | 16 replies

whit368229

Thanks for your reply! I tried what you suggested, but missed something somewhere. Here's what I did:

1) I opened Products_Detail.php page

2) I added a column (ProductCategoryID) to the cart.

3) Added a Calculation: PartsShipping=abs([ProductCategoryID] == 2) * [Quantity]

4) Created a rule: FlatRateParts (see below)

5) Created a new recordset (rsCatID):
SELECT products.ProductCategoryID
FROM products

6) From the Bindings tab, I drug ProductCategoryID (from rsCatID) onto my Products_Detail.php page within the addFields div:

<div id="addFields" <?php echo(($row_WADAProducts["NumLeft"] > 0 || $row_WADAProducts["ProductUnlimited"] != 0)?'':'style="display:none"'); ?> >
<input type="hidden" name="WA_Store_Cart_1_ID_Add" id="WA_Store_Cart_1_ID_Add" value="<?php echo $row_WADAProducts["ProductID"]; ?>" />
<?php echo $row_rsCatID['ProductCategoryID']; ?>
<h2 id="ProductPrice">$<?php echo number_format($row_WADAProducts["ProductPrice"], 2); ?></h2>
<input type="image" src="Images/btn_addtocart.png" border="0" value="Add to Cart" name="WA_Store_Cart_1_ATC" align="absmiddle" />
<label>Qty:</label>
<input type="text" name="WA_Store_Cart_1_Quantity_Add" value="1" size="2" align="absmiddle" />
</div>



7) OPened the add to cart server behavior and added a value to ProductCategoryID:

<?php echo $row_rsCatID['ProductCategoryID']; ?>



On my WA_Store_Cart_PHP.php page:

//Shipping
$this->Shipping[] = new WA_eCart_Rule(urldecode("FlatRateParts"), true, "WAEC_WA_Store_Cart_FlatRateParts");
$this->Shipping[] = new WA_eCart_Rule(urldecode("UPS%20Shipping"), true, "WAEC_WA_Store_Cart_UPSShipping");
}
//end node



On my WA_Store_Cart_PHP.php page the rule looks like this:

//eCart Rule
function WAEC_WA_Store_Cart_FlatRateParts() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "PartsShipping", "2") > 0) && (( (ceil($this->TotalColumn("PartsShipping")/4) * 9.95) )))) {
$totalShipping += 9.95;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_WA_Store_Cart_UPSShipping() {
$totalShipping = 0;
if (true && (("UPS"=="UPS")&&(isset($_SESSION["WA_Store_Cart_UPS_Quote"]))&&(floatval($_SESSION["WA_Store_Cart_UPS_Quote"]) != 0))) {
$totalShipping += floatval($_SESSION["WA_Store_Cart_UPS_Quote"]) + 0;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//end node



On my WA_Store_Cart_PHP.php page the calcs look like this:

//calculations
$this->TotalWeight = $this->Weight * $this->Quantity;//w
$this->TotalPrice = $this->Price * $this->Quantity;//c
$this->FullDetails = $this->Quantity . ' ' . $this->Name . ' (' . $this->ID . ')';//t
$this->PartsShipping = abs($this->ProductCategoryID == 2) * $this->Quantity;//t



I uploaded updated files for testing. On Products_Detail.php, I added three ProductCategoryID=2 products to the cart and checked out. Standard UPS rates applied, not my rules. Also, category 1 appears on the page instead of Cat 2?

What did I miss?

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