Magento Update and Clean Shoping Cart using Ajax -
Two days while trying to do me, but failed. I have a code on the server:
& lt ;? Php require_once $ _SERVER ['DOCUMENT_ROOT']. '/app/Mage.php'; Dana :: Application (); Dana :: log ('-----'); Dana :: getSingleton ('Checkout / Session') - & gt; SetCartWasUpdated (true); $ Quote = Dana :: getSingleton ('Checkout / Session') - & gt; GetQuote (); Forex Currency ($ quote- & gt; All Matching Items) ($ quote_item) ($ quote_item- & gt; Set (55); } $ Quote-> Save (); Dana: Logon ($ quote_item); $ Session = Dana :: Milensington ('checkout / session'); Forex Currency ($ session-> getQuote () -> join item ($ item)) {$ productid = $ item- & gt; GetProductId (); $ Productsku = $ item- & gt; getSku (); $ Product name = $ item- & gt; Mix (); $ Product cost = $ item-> getQty (); } Dana :: log ('Product:' $ PRODUCTNAME. 'QUOTITION:'. $ PRODUCER); Dana :: log ('-----'); ? & Gt; I have an AJAX request:
& lt; script type = "text / javascript" & gt; Function UpdateCart (Product ID, Quality) {qty = jQuery ('# prodqty'). Val () jQuery.ajax ({type: "POST", data type: "HTML", data: {productId: productId, qty: qty} url: "updateCart.php? ProductId =" + productId + "& amp; qty = "+ Qty, success: function (data) {// warning (" success ");}, error: function (data) {warning (" failure ");}}); } & Lt; / Script & gt; and .phtml file:
& lt; Id = 'prodqty' onchange = "updateCart (20)" & gt; & Lt; Options & gt; 1 & lt; / Options & gt; & Lt; Options & gt; 2 & lt; / Options & gt; & Lt; Options & gt; 3 & lt; / Options & gt; & Lt; Options & gt; 4 & lt; / Options & gt; & Lt; Options & gt; 5 & lt; / Options & gt; & Lt; Options & gt; 6 & lt; / Options & gt; & Lt; Options & gt; 7 & lt; / Options & gt; & Lt; / Select & gt; SetQty (55) - This is the desired quantity for testing when I select the option through selection, fix the cart updates and log all that has been done well. But when I suppress the volume of the F5 car (not updated in the situation), to check the situation, I am going to the entire .php code (from server) magenta template (cart.php in our case). I was surprised when I press F5 and the car is QTY55 (as desired for me) Question - What do I remember ??? Please help me
You should add these rows:
Dana :: getSingleton ('Checkout / cart') - & gt; Save (); Dana :: getSingleton ('Checkout / Session') - & gt; SetCartWasUpdated (true); Instead of $ quote- & gt; Save (); (Not sure about this)
Comments
Post a Comment