简体   繁体   中英

Get all abandoned carts in Magento

How could I get all the abandoned carts with customer's email (programatically)?

What does Magento consider as being abandoned? Not updated in the last day?

Standalone file that can be used anywhere you wish.

Either filter by is_active or check if any of your orders contain the quote id ( in which case the quote became an order so obviously not abandoned ).

require_once( 'app/Mage.php' );

umask(0);
Mage::app('default');

$sCustomerId = 1;
$oQuotes = Mage::getModel( 'sales/quote' )->getCollection();
$oQuotes->addFieldToFilter( 'customer_id', $sCustomerId );
foreach( $oQuotes as $oQuote )
{
    var_dump( $oQuote->getData( 'is_active' ) );
    $oOrders = Mage::getModel( 'sales/order' )->getCollection();
    $oOrders->addFieldToFilter( 'quote_id', $oQuote->getId() );
    var_dump( 'Became an order?: ' );
    var_dump( $oOrders->count() );

    $oItems = Mage::getModel( 'sales/quote_item' )
        ->getCollection()
        ->setQuote( $oQuote );
    foreach( $oItems as $oItem )
    {
        var_dump( $oItem->getProduct()->getId() );
    }
}

The admin section in Magento has this functionality built in. In the admin section visit Reports->Shopping Cart->Abandoned carts .

This page contains an admin grid with all the abandoned carts and the customer email attached. It even gives you the standard export functionality so you can get a file in different formats containing all the information you need.

This link will give your all answers abondoned cart . Hope this will helpful to you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM