Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento 获取所有用户的购物车_Magento_Migration_Shopping Cart - Fatal编程技术网

Magento 获取所有用户的购物车

Magento 获取所有用户的购物车,magento,migration,shopping-cart,Magento,Migration,Shopping Cart,我正在尝试将所有用户的Cart迁移到另一个系统 是否有办法为每个用户获取购物车中的所有商品? 我需要的只是产品和客户ID你应该看看报价表:sales\u flat\u quote,sales\u flat\u quote\u item和sales\u flat\u quote\u item\u选项我想当你说购物车商品时,你是指订购商品吧 我将使用sql执行此操作,因为您需要迁移信息,如果您需要在magento上使用as集合,请告诉我 SELECT o.customer_id , p.name F

我正在尝试将所有用户的Cart迁移到另一个系统

是否有办法为每个用户获取购物车中的所有商品?
我需要的只是产品和客户ID

你应该看看报价表:
sales\u flat\u quote
sales\u flat\u quote\u item
sales\u flat\u quote\u item\u选项
我想当你说购物车商品时,你是指订购商品吧

我将使用sql执行此操作,因为您需要迁移信息,如果您需要在magento上使用as集合,请告诉我

SELECT o.customer_id , p.name
FROM sales_flat_quote as o
LEFT JOIN sales_flat_quote_item as i ON i.quote_id = o.entity_id
LEFT JOIN catalog_product_flat_1 as p ON i.product_id = p.entity_id

$list = Mage::getModel('sales/quote')->getCollection();
foreach($list as $li){
    $itens = $li->getItemsCollection(); //here we have the itens;
    $li->getCustomer()->getName; // here we have the customer name.
    foreach($itens as $i){
       $i->getName();//itens name;
    }
}

你用的是什么Magento?你真的需要购物车还是订单?我使用的是Magento 1.7,我需要购物车。不是quote集合中的所有项目都在购物车中。要获取购物车中的活动报价列表,请查看表
log\u quote
。是否有方法使用getModel方法而不是查询DB?。类似于
$items=Mage::getModel('sales/quote')->getCollection()抱歉,但它对我不起作用,
$li->getAllItems()为空。我还尝试了yoursql方法,但它返回重复的值。对不起,我的错误,他们没有“重复”,因为这是一个订单,我只想用户的车,因为我不使用1.7版本,我使这个代码基于1.5,但应该工作,这个方法可能改变了签名,去Mage_销售_模型_订单,寻找“项目”,并改变为正确的方法。其余的应该可以用。但是对于getAllItems,你有错误或者什么都没有?对不起,我的错误,它们不是“重复”的,因为是一个订单,我只是想要用户的购物车,不是所有的订单。我尝试了另一个答案的SQL解决方案,涉及其中的两个表,但仍然得到重复的值,然后只需将产品id分组添加到SQL解决方案中