Magento Expert Forum - Improve your Magento experience

Results 1 to 4 of 4

How to retrieve Abandoned cart details using Magento API

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default How to retrieve Abandoned cart details using Magento API

    Hello All,

    I am writing an custom REST API in the magento to retrieve the abandoned cart details. I have used the below code to retrieve the abandoned cart details. But it is not working. Can anyone tell me what is the issue with the code.

    $collection = Mage::getResourceModel('reports/quote_collection');
    $collection->prepareForAbandonedReport(array(1));
    $collection->load();


    I am sure, the issue is not with REST API, because i have checked with products counts it was working fine. If I change the code to above it was showing blank.

    Since its custom API I have written the code in V1.php

    Appreciate your help.

    View more threads in the same category:


  2. #2
    Junior Member rocker's Avatar
    Join Date
    Mar 2013
    Posts
    105
    Thanks
    3
    Thanked 11 Times in 9 Posts

    Thumbs up

    Instead of pass the array to params, can you can try to pass a variable? So let 's code like this

    PHP Code:
    $storeIds = array(1);
    $collection Mage::getResourceModel('reports/quote_collection');
    $collection->prepareForAbandonedReport($storeIds);
    $collection->load(); 
    And please post the error detail to here if the error happen again!

  3. The Following User Says Thank You to rocker For This Useful Post:

    msamusammil (04-03-2014)

  4. #3
    Junior Member
    Join Date
    Mar 2014
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Hi Rocker,

    Thanks for your reply.

    As you suggested, I have used the below code.

    $storeIds = array(1);
    $collection = Mage::getResourceModel('reports/quote_collection');
    $collection->prepareForAbandonedReport($storeIds);
    $output = $collection->load();

    return $output;

    After that I got the below error in the error log.

    PHP Fatal error: Cannot use object of type Mage_Reports_Model_Resource_Quote_Collection as array in /public_html/mystore/app/code/core/Mage/Api2/Model/Acl/Filter.php on line 78

    In the web browser I got the below error


    Invalid auth/bad request (got a 500, expected HTTP/1.1 20X or a redirect)

    Once again thanks for replying to my post.

    Regards
    Mohamed

  5. #4
    Junior Member
    Join Date
    Mar 2014
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Smile

    Hi All,

    Finally I got the solution.

    Code :
    ----------
    $collection = Mage::getResourceModel('reports/quote_collection');
    $collection->prepareForAbandonedReport();
    $output = $collection->load()->toArray();



    Thanks

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •