I got the code working for creating quote object and quote item object, and I'm able to create quote successfully which I could confirm it by checking the database, I also created cookie named front-end. All I need now is to assign the created quote to the guest user, so that I can let the user checkout as guest, but couldn't assign the cart to the guest user.

Request for items in the cart will be coming from 3rd party site via JSON request which I have decoded and looped through.

Here is the code



$cartInfo = $_GET['items'];

require_once '../app/Mage.php'; 


$session = Mage::getSingleton('customer/session');


foreach ($cartArray as $key=> $value) {
        $productId = $key;
        $productQuantity = $value;
        $productModel = Mage::getSingleton('catalog/product');
        $productObj = $productModel->load($productId);
        if (!$quoteObj) {
            $quoteObj = new Mage_Sales_Model_Quote();

        $store_id = Mage::app()->getStore()->getId();
        $storeObj = $quoteObj->getStore()->load($store_id);

        $quoteItem = Mage::getModel('sales/quote_item')->setProduct($productObj);

        $quoteId = $quoteObj->entity_id;
        echo $quoteObj->entity_id.'**<br />';
        echo $quoteItem->item_id.'---<br />';

Finally figured out the issue, hope it helps someone, here is the answer.

The above given code in the question section works perfectly, all you have to do is place the custom file in the root folder of your magento installation, if you create a folder and place this code, it wont work. It is must that the code file has to be in the root.

  • 2
    Your ""solution"" needs to be more technical. This is a bit useless without technical resources. – Machado Oct 27 '16 at 12:01

Since this is a guess checkout, the only way I can think of is to let the customer re-load the quote in their browser. So you would need to either email them a link with the quote id or let them enter the quote id on your site.

To Reload Quote in your controller

 $id = $this->getRequest()->getParam('quote_id');
 $store_id = $this->getRequest()->getParam('store_id');

  • Is there any way I can attach the quote to the guest in the custom page itself that I created? – Bobby Jul 29 '14 at 6:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.