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

total of items in the cart did not match the total of all items

Thread began 4/02/2010 8:48 am by info307537 | Last modified 4/06/2010 3:32 pm by Eric Mittman | 873 views | 3 replies |

info307537

total of items in the cart did not match the total of all items

I keep getting this error message when trying to process my transaction with paypal:

This transaction has been completed, but the total of items in the cart did not match the total of all items.

I can't find the problem in my code. Can you please help:

<?php

if (($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST)) {
$PP_DirectPayment_required = array();
$PP_DirectPayment_required[0] = array();
$PP_DirectPayment_required[1] = array();
$PP_DirectPayment_itemized = array();
$PP_DirectPayment_itemized[0] = array();
$PP_DirectPayment_itemized[1] = array();
$PP_DirectPayment_optional = array();
$PP_DirectPayment_optional[0] = array();
$PP_DirectPayment_optional[1] = array();
$cartIndex = 0;
$nextIndex = 0;
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "Username";
$PP_DirectPayment_required[1][$nextIndex] = "xxxxxxx";
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "Password";
$PP_DirectPayment_required[1][$nextIndex] = "xxxxxxx";
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "Signature";
$PP_DirectPayment_required[1][$nextIndex] = "xxxxxxx";
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "PaymentAction";
$PP_DirectPayment_required[1][$nextIndex] = "Sale";
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "Currency";
$PP_DirectPayment_required[1][$nextIndex] = "".$CurrencyCode ."";
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "IPAddress";
$PP_DirectPayment_required[1][$nextIndex] = "".$_SERVER["REMOTE_ADDR"] ."";
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "CreditCardType";
$PP_DirectPayment_required[1][$nextIndex] = "".$row_WAATKcustomers['cc_type'] ."";
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "CreditCardNumber";
$PP_DirectPayment_required[1][$nextIndex] = "".$row_WAATKcustomers['cc_number'] ."";
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "ExpMonth";
$PP_DirectPayment_required[1][$nextIndex] = "".$row_WAATKcustomers['exp_month'] ."";
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "ExpYear";
$PP_DirectPayment_required[1][$nextIndex] = "".$row_WAATKcustomers['exp_year'] ."";
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "FirstName";
$PP_DirectPayment_required[1][$nextIndex] = "".$row_WAATKcustomers['first_name'] ."";
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "LastName";
$PP_DirectPayment_required[1][$nextIndex] = "".$row_WAATKcustomers['last_name'] ."";
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "Street1";
$PP_DirectPayment_required[1][$nextIndex] = "".$row_WAATKcustomers['address1'] ."";
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "CityName";
$PP_DirectPayment_required[1][$nextIndex] = "".$row_WAATKcustomers['town_city'] ."";
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "StateOrProvince";
$PP_DirectPayment_required[1][$nextIndex] = "".$row_WAATKcustomers['county'] ."";
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "PostalCode";
$PP_DirectPayment_required[1][$nextIndex] = "".$row_WAATKcustomers['post_code'] ."";
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "Country";
$PP_DirectPayment_required[1][$nextIndex] = "".$row_rs_country_list['currency_code'] ."";
$nextIndex = count($PP_DirectPayment_required[0]);
$PP_DirectPayment_required[0][$nextIndex] = "UseSandbox";
$PP_DirectPayment_required[1][$nextIndex] = "true";

$PP_DirectPayment_itemized[0][0] = "OrderTotal";
$PP_DirectPayment_itemized[1][0] = "".number_format(round($GrandTotal,2), 2) ."";
$PP_DirectPayment_itemized[0][1] = "OrderDescription";
$PP_DirectPayment_itemized[1][1] = "";

while ( !$Tech8_Spares_eCart1->EOF() ) {

$nextIndex = count($PP_DirectPayment_itemized[0]);
$PP_DirectPayment_itemized[0][$nextIndex] = "Amount" . strval($cartIndex+1) . "";
$PP_DirectPayment_itemized[1][$nextIndex] = "".round($price,2) ."";
$nextIndex = count($PP_DirectPayment_itemized[0]);
$PP_DirectPayment_itemized[0][$nextIndex] = "Name" . strval($cartIndex+1) . "";
$PP_DirectPayment_itemized[1][$nextIndex] = "".$pname ."";
$nextIndex = count($PP_DirectPayment_itemized[0]);
$PP_DirectPayment_itemized[0][$nextIndex] = "Number" . strval($cartIndex+1) . "";
$PP_DirectPayment_itemized[1][$nextIndex] = "".$product_id ."";
$nextIndex = count($PP_DirectPayment_itemized[0]);
$PP_DirectPayment_itemized[0][$nextIndex] = "Quantity" . strval($cartIndex+1) . "";
$PP_DirectPayment_itemized[1][$nextIndex] = "".$qty ."";

$Tech8_Spares_eCart1->MoveNext();
$cartIndex ++;
}
$Tech8_Spares_eCart1->MoveFirst();

$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "MerchantSessionID";
$PP_DirectPayment_optional[1][$nextIndex] = "".session_id() ."";
$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "Payer";
$PP_DirectPayment_optional[1][$nextIndex] = "".$row_WAATKcustomers['email'] ."";
$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "Street2";
$PP_DirectPayment_optional[1][$nextIndex] = "".$row_WAATKcustomers['address1'] ."";
$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "Phone";
$PP_DirectPayment_optional[1][$nextIndex] = "".$row_WAATKcustomers['phone'] ."";
$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "CVV2";
$PP_DirectPayment_optional[1][$nextIndex] = "".$row_WAATKcustomers['cvv'] ."";

$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "ItemTotal";
$PP_DirectPayment_optional[1][$nextIndex] = "".number_format(round($SubTotal,2), 2) ."";
$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "ShippingTotal";
$PP_DirectPayment_optional[1][$nextIndex] = "".$delivery ."";
$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "HandlingTotal";
$PP_DirectPayment_optional[1][$nextIndex] = "".$charges - $discount ."";
$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "TaxTotal";
$PP_DirectPayment_optional[1][$nextIndex] = "".number_format(round($VAT,2), 2) ."";

$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "InvoiceID";
$PP_DirectPayment_optional[1][$nextIndex] = "".$order_id ."";
$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "SH_Name";
$PP_DirectPayment_optional[1][$nextIndex] = "".((isset($_POST["first_name_ship"]))?$_POST["first_name_ship"]:"") ." ".((isset($_POST["last_name_ship"]))?$_POST["last_name_ship"]:"") ."";
$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "SH_Street1";
$PP_DirectPayment_optional[1][$nextIndex] = "".((isset($_POST["address1_ship"]))?$_POST["address1_ship"]:"") ."";
$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "SH_Street2";
$PP_DirectPayment_optional[1][$nextIndex] = "".((isset($_POST["address2_ship"]))?$_POST["address2_ship"]:"") ."";
$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "SH_CityName";
$PP_DirectPayment_optional[1][$nextIndex] = "".((isset($_POST["town_city_ship"]))?$_POST["town_city_ship"]:"") ."";
$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "SH_StateOrProvince";
$PP_DirectPayment_optional[1][$nextIndex] = "".((isset($_POST["county_ship"]))?$_POST["county_ship"]:"") ."";
$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "SH_PostalCode";
$PP_DirectPayment_optional[1][$nextIndex] = "".((isset($_POST["post_code_ship"]))?$_POST["post_code_ship"]:"") ."";
$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "SH_Country";
$PP_DirectPayment_optional[1][$nextIndex] = "".((isset($_POST["country_ship_code"]))?$_POST["country_ship_code"]:"") ."";
$nextIndex = count($PP_DirectPayment_optional[0]);
$PP_DirectPayment_optional[0][$nextIndex] = "SH_Phone";
$PP_DirectPayment_optional[1][$nextIndex] = "".((isset($_POST["phone_ship"]))?$_POST["phone_ship"]:"") ."";

Sign in to reply to this post

Eric Mittman

What is the version of DW and eCart that you are working with? I have seen an error similar to this one but it should be resolved with version 4.5.2 or higher of eCart. If you are getting this error with the latest releases it is something we will need to look into further. Please post back with the details so that we can determine how to proceed.

Sign in to reply to this post

info307537

RE: total of items in the cart did not match the total of all items

I am now using 5.0.1, but I may some of the ecart code may have been created by an earlier version of ecart. Can you tell me what files I need to check for you?

Sign in to reply to this post

Eric Mittman

It would be a good idea to work on a copy of your site first since you have updated the cart. You should reapply the checkout server behaviors. You can either open up your checkout, confirm, and pp_confirm pages and update the individual PayPal checkout server behaviors on these pages or you can backup your current checkout pages into another folder and run the checkout wizard again to crate a new set of pages for you.

I would suggest just updating the server behaviors, it is less involved and should give you the correct result. The server behaviors that you will need to update are:

Express Checkout
Authentication for PayPal Express checkout (checkout page)
Get Payer Profile for Express Checkout (pp_confirm page)
Process Transaction with Express Checkout (pp_confirm page)

Direct Pay
eCar local checkout (PP_Direct_Payment) (confirm page)

You can just double click on them to edit, the setting should be fine but you should double check them along the way, then finish the server behavior to have it write out the newly updated files.

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