close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Why number is being rounded on eCart and why Dimensions not passed

Thread began 6/12/2020 9:45 am by lr_leal239405 | Last modified 6/12/2020 10:11 am by Ray Borduin | 579 views | 3 replies |

lr_leal239405

Why number is being rounded on eCart and why Dimensions not passed

I have a question on an eCart function. I have an Add to Cart on a page where the code is passing the Price value as rounded. I get for example $84.00 instead of $84.15. The formula is below along with the entire AddToCart function. (the number comes from price being $99.00 - 15% which equals 84.15). on the cart.php the price comes in as $84.00. Also, on the confirm cart, it does not calculate shipping from this page(s) addToCart even though that record definitely has values in Length Width Height and Weight. (on any items from my main Shopping cart page, it does calculate shipping). I don't know what I'm missing. Any general info would help.

<?php
// WA eCart MySQLi AddToCart
if (isset($_POST["eCart1_1_ATC"]) || isset($_POST["eCart1_1_ATC_x"])) {
$ATC_itemID = $_POST["eCart1_1_ID_Add"];
$ATC_AddIfIn = 0;
$ATC_RedirectAfter = "../eCart/cart.php?quote=yes";
$ATC_RedirectIfIn = "";
if (function_exists("rel2abs")) {
$ATC_RedirectIfIn = $ATC_RedirectIfIn?rel2abs($ATC_RedirectIfIn,dirname(__FILE__)):"";
$ATC_RedirectAfter = $ATC_RedirectAfter?rel2abs($ATC_RedirectAfter,dirname(__FILE__)):"";
}
if ("Recordset2reccart" != "") $Recordset2reccart->FindRow("",$ATC_itemID);
$ATC_itemName = "".($Recordset2reccart->getColumnVal("part_name")) ."";// column binding
$ATC_itemDescription = "".($Recordset2reccart->getColumnVal("description")) ."";// column binding
$ATC_itemThumbnail = "". "" ."";// column binding
$ATC_itemWeight = floatval("".($Recordset2reccart->getColumnVal("Weight")) ."");// column binding
$ATC_itemQuantity = floatval("".($Recordset2reccart->getColumnVal("quantity")) ."");// column binding
//$ATC_itemQuantity = "".$_POST["eCart1_1_Quantity_Add"] ."";// column binding
//$ATC_itemQuantity = "". "1" ."";// column binding
$ATC_itemPrice = number_format(floatval(($Recordset2reccart->getColumnVal("price")) - ($Recordset2reccart->getColumnVal('discount') * 100)),2, '.', '');// column binding
$ATC_itemeCartCatID = floatval("".($Recordset2reccart->getColumnVal("part_name")) ."");// column binding
$ATC_itemLength = floatval("".($Recordset2reccart->getColumnVal("Length")) ."");// column binding
$ATC_itemWidth = floatval("".($Recordset2reccart->getColumnVal("Width")) ."");// column binding
$ATC_itemHeight = floatval("".($Recordset2reccart->getColumnVal("Height")) ."");// column binding
$ATC_itemItemNumber = "".($Recordset2reccart->getColumnVal("part_no")) ."";// column binding
//$ATC_itemInStockQty = floatval("".(Recordset2reccart->getColumnVal("In_Stock_Qty")) ."");// column binding
//$ATC_itemQuestions = "".($WRecordset2recs->getColumnVal("Include_Questions")) ."";// column binding
//$ATC_itemShippingType = "". "ship_collect" ."";// column binding
if ("WADAecart_products" != "") $Recordset2reccart->Index = 0;
$ATC_itemQuantity = floatval($ATC_itemQuantity);
if (is_numeric($ATC_itemQuantity) && $ATC_itemQuantity != 0) {
$eCart1->AddToCart($ATC_AddIfIn, $ATC_RedirectIfIn, $ATC_itemID, $ATC_itemName, $ATC_itemDescription, $ATC_itemThumbnail, $ATC_itemWeight, $ATC_itemQuantity, $ATC_itemPrice, $ATC_itemeCartCatID, $ATC_itemLength, $ATC_itemWidth, $ATC_itemHeight, $ATC_itemItemNumber);
if ($ATC_RedirectAfter != "" && $eCart1->redirStr == "") $eCart1->redirStr = $ATC_RedirectAfter;
$_SESSION['WAEC_ContinueRedirect'] = $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING']?"?".htmlentities($_SERVER['QUERY_STRING']):"");
}
}
?>

(I added the number_format thinking that would be it, but it's not doing it)

Thanks.

Sign in to reply to this post

Ray BorduinWebAssist

The number_format would cause this issue, and your math seems wrong. I think it would be more like:

$ATC_itemPrice = $Recordset2reccart->getColumnVal("price") - ($Recordset2reccart->getColumnVal('discount') * $Recordset2reccart->getColumnVal("price"));// column binding

Sign in to reply to this post
Did this help? Tips are appreciated...

lr_leal239405

Oops. yes. Thanks. Math was my worst subject (don't know how I ended up doing programming) :).

I had generic question above on why not calculating shipping when I'm passing Length Width Height and Weight (I think that's all it needs for UPS to calculate) but it works fine from my Shopping cart page. (I'm trying to fix it now. Maybe you'd have to see it all for you to determine).

Sign in to reply to this post

Ray BorduinWebAssist

I think UPS uses weight primarily. You only need to pass length, width, and height if it is an excessively large item for it's weight.

Sign in to reply to this post
Did this help? Tips are appreciated...

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