When you click "add to cart" multiple times it tries to keep incrementing the count in the cart.
Unfortunately, in _amazon_store_add_to_cart()
if ((string) $results->Cart->Request->Errors->Error->Code == "AWS.ECommerceService.ItemAlreadyInCart") {
$current_quantity = amazon_store_get_current_cart_quantity($id);
and $id is not the right thing. It's supposed to be a cart id (but here is an offerlisting id)
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | watchdog_improvements-7x-port-944294-9.patch | 1.65 KB | willvincent |
| #5 | amazon_store.watchdog_improvements_944294_05.patch | 3.71 KB | rfay |
| #2 | amazon_store.d7_multi_cart_add_fix.patch | 1.16 KB | rfay |
Comments
Comment #1
rfayThis was fixed in the D6 version with this change:
Comment #2
rfayHere's the patch for it.
Comment #3
rfayCommitted: http://drupal.org/cvs?commit=458712
This was already fixed in D6.
Comment #4
iva2k commentedSorry for re-opening.
The cart is updated properly, BUT I see a notice in the log which I believe should not be there:
"There was an error accessing amazon. Message=Amazon error returned. Code=AWS.ECommerceService.ItemAlreadyInCart}, Message=The item you specified, 1591260280, is already in your cart. //, results=SimpleXMLElement Object ( [OperationRequest] => SimpleXMLElement Object ( [HTTPHeaders] => SimpleXMLElement Object ( [Header] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => UserAgent [Value] => Drupal (+http://drupal.org/) ) ) ) [RequestId] => 1ESG1TT06HW4H8T78N6N [Arguments] => SimpleXMLElement Object ( [Argument] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => Service [Value] => AWSECommerceService ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => Item.1.Quantity [Value] => 1 ) ) [2] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => Operation [Value] => CartAdd ) ) [3] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => OfferListingId [Value] => JvPcUpGLA8%2FhjrL5UYTXBfCHpapVOE8vE8f4VMg5WrbYcQrlWtoqPBfWx2ji1lgk6kHvG6Sbb%2F9tGYIjGFaBZjBI6S5T22q4tSKRL3kpDQTdYVl2uAS6N1N5FrBC5VvnHt9Q5mxk63w%3D ) ) [4] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => Version [Value] => 2010-09-01 ) ) [5] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => Timestamp [Value] => 2010-12-04T23:46:47Z ) ) [6] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => MergeCart [Value] => True ) ) [7] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => AssociateTag [Value] => aspiringarcco-20 ) ) [8] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => Signature [Value] => uBKlN4jlpk+k4iSdZ/rpeDJQRIP25NlurZ8inyXhi9c= ) ) [9] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => Item.1.OfferListingId [Value] => JvPcUpGLA8%2FhjrL5UYTXBfCHpapVOE8vE8f4VMg5WrbYcQrlWtoqPBfWx2ji1lgk6kHvG6Sbb%2F9tGYIjGFaBZjBI6S5T22q4tSKRL3kpDQTdYVl2uAS6N1N5FrBC5VvnHt9Q5mxk63w%3D ) ) [10] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => HMAC [Value] => 1zDttA+YuyNOq0Gg4gHx+2Gy79U= ) ) [11] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => CartId [Value] => 190-7645848-8010414 ) ) [12] => SimpleXMLElement Object ( [@attributes] => Array ( [Name] => AWSAccessKeyId [Value] => AKIAJB5NHZLHTUFKCVTQ ) ) ) ) [RequestProcessingTime] => 0.0913798809051514 ) [Cart] => SimpleXMLElement Object ( [Request] => SimpleXMLElement Object ( [IsValid] => True [CartAddRequest] => SimpleXMLElement Object ( [CartId] => 190-7645848-8001414 [HMAC] => 1zDttA+YuyNOq0Gg4gHx+2Gy79U= [MergeCart] => True [Items] => SimpleXMLElement Object ( [Item] => SimpleXMLElement Object ( [OfferListingId] => JvPcUpGLA8%2FhjrL5UYTXBfCHpapVOE8vE8f4VMg5WrbYcQrlWtoqPBfWx2ji1lgk6kHvG6Sbb%2F9tGYIjGFaBZjBI6S5T22q4tSKRL3kpDQTdYVl2uAS6N1N5FrBC5VvnHt9Q5mxk63w%3D [Quantity] => 1 ) ) ) [Errors] => SimpleXMLElement Object ( [Error] => SimpleXMLElement Object ( [Code] => AWS.ECommerceService.ItemAlreadyInCart [Message] => The item you specified, 1591260280, is already in your cart. ) ) ) [CartId] => 190-7645848-8001414 [HMAC] => 1zDttA+YuyNOq0Gg4gHx+2Gy79U= [URLEncodedHMAC] => 1zDttA%2BYuyNOq0Gg4gHx%2B2Gy79U%3D [PurchaseURL] => https://www.amazon.com/gp/cart/aws-merge.html?cart-id=190-7645848-800141... [SubTotal] => SimpleXMLElement Object ( [Amount] => 70360 [CurrencyCode] => USD [FormattedPrice] => $703.60 ) [CartItems] => SimpleXMLElement Object ( [SubTotal] => SimpleXMLElement Object ( [Amount] => 70360 [CurrencyCode] => USD [FormattedPrice] => $703.60 ) [CartItem] => Array ( [0] => SimpleXMLElement Object ( [CartItemId] => UCSXHCHPY9BN3 [ASIN] => 1591260280 [ExchangeId] => Y12M5532900M7167292 [MerchantId] => ASXGEOX0HKBSE [SellerId] => ASYDZ0OXHKBSE [SellerNickname] => any_book [Quantity] => 2 [Title] => Architecture Exam Review, Vol. II: Nonstructural Topics, 6th Edition [ProductGroup] => Book [Price] => SimpleXMLElement Object ( [Amount] => 31130 [CurrencyCode] => USD [FormattedPrice] => $311.30 ) [ItemTotal] => SimpleXMLElement Object ( [Amount] => 62260 [CurrencyCode] => USD [FormattedPrice] => $622.60 ) ) [1] => SimpleXMLElement Object ( [CartItemId] => UL29GRID8QNO3 [ASIN] => 1427770298 [ExchangeId] => Y12M5532900M7167292 [MerchantId] => ASXGEOX0HKBSE [SellerId] => A7A7ZO6L0D1MD [SellerNickname] => Wei Tan [Quantity] => 1 [Title] => Building Systems 2009 [ProductGroup] => Book [Price] => SimpleXMLElement Object ( [Amount] => 8100 [CurrencyCode] => USD [FormattedPrice] => $81.00 ) [ItemTotal] => SimpleXMLElement Object ( [Amount] => 8100 [CurrencyCode] => USD [FormattedPrice] => $81.00 ) ) ) ) ) )
"
Since it is a normal response, it should not be logged and thus pollute DB bandwidth.
Comment #5
rfayHere's a little cleanup to not believe that everything Amazon calls an error actually is an error.
That watchdog reporting has been in there since the first commit of Amazon Store, but thanks to you we can get rid of it :-)
Please test this out. If it doesn't apply on 6.x-2.1, please try it with 6.x-2.x-dev (dev snapshot)
Comment #6
iva2k commentedI have only production site with amazon_store, so I have no place to try -dev, sorry.
The code change looks trivial, and I trust you. You've done stellar job so far.
Comment #7
rfayCommitted: http://drupal.org/cvs?commit=471848
Comment #8
rfayBut #5 should be applied to the D7 branch.
Comment #9
willvincent commentedPorted, and commit.
Comment #10
willvincent commented