Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Interface with Quickbooks? 
 
niassy151
Jr. Member
 
Total Posts:  23
Joined:  2010-06-29
 

Does all of the shipping information need to go through Magento? We’ve been using a different system, and I don’t think the lady that does it is ready to change over to Magento when we use the new site.

Please help!

 
Magento Community Magento Community
Magento Community
Magento Community
 
wmcferr
Sr. Member
 
Total Posts:  174
Joined:  2010-11-16
 

I am working on a site that is using Magento ver. 1.3.2.4 as its eCommerce platform. We have built a custom “Add To Cart” process which adds multiple items to the cart via an AJAX request. After this request, some postprocessing is done viw JavaScript in the browser before redirecting to the “View Cart” page. 99% of the time this process seems to function properly in Firefox and Safari but in IE8, the process fails. When adding an item to the cart, after being redirected to the “Your Cart” page, the shopping cart is empty.

Not all items on the site are added via this AJAX process. This issue only happens only when the cart is empty before adding the items via AJAX. That is to say, if an item that is added via the normal Magento process is added to the cat first, then the AJAX add to cart requests always succeed. Blu clearing cookies and then attempting to add via AJAX will fail consistently on IE8.

Server is an Apache/PHP server with PHP 5.2.9, eAccelerator and Suhosin. Please request any additional information and I’ll be happy to provide it. We are storing sessions in a MySQL Database.

Here is the code for our custom add to cart method. This code is located in /app/code/core/Mage/Checkout/controllers/CartController.php:

public function ajaxaddAction()
{
$result = array(’success’ => true);

try
{
$session = $this->_getSession();
$cart = $this->_getCart();

$products = json_decode($_POST[’products’],true);

if(!is_array($products))
{
throw new Exception("Products data not sent");
}

foreach ($products as $product_data)
{
$product = $this->_initProduct($product_data[’id’]);

if(!$product)
throw new Exception("Product id {$product_data[’id’]} not found");

$info = array(’qty’ => $product_data[’qty’]);

if($product_data[’options’])
$info[’options’] = $product_data[’options’];

$cart->addProduct($product,$info);
}

$cart->save();

$this->_getSession()->setCartWasUpdated(true);

/**
* @todo remove wishlist observer processAddToCart
*/
Mage::dispatchEvent(’checkout_cart_add_product_complete’,
array(’product’ => $products[0], ‘request’ => $this->getRequest(), ‘response’ => $this->getResponse())
);

$cartItems = $cart->getQuote()->getAllItems();

$result[’cart’] = array();

foreach($cartItems as $item)
$result[’cart’][] = json_decode($item->toJson());
}
catch (Mage_Core_Exception $e)
{
if ($this->_getSession()->getUseNotice(true)) {
$this->_getSession()->addNotice($e->getMessage());
} else {
$messages = array_unique(explode("\n", $e->getMessage()));
foreach ($messages as $message) {
$this->_getSession()->addError($message);
}
}
$result[’success’] = false;
$result[’exception’] = $e->getMessage();
}

catch (Exception $e) {
$this->_getSession()->addException($e, $this->__(’Can not add item to shopping cart’));
$result[’success’] = false;
$result[’exception’] = $e->getMessage();
}

header(’Content-Type: application/json’,true);

ob_end_clean();

echo json_encode($result);

exit();
}

I hope it will be helpful for you.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top