小编dee*_*ark的帖子

如何加载 Magento 产品并找到分配给它的商店

我被要求对一些订单(来自 Ebay 扩展)进行逆向工程,并找出他们真正使用的商店。

充实一个例子;我们从一个 Magento 后端经营几家商店,销售各种产品。这些都是使用单个商家帐户在 eBay 上出售的。

所以我需要做的是加载分配给 eBay 商店的订单,加载附加到该订单的商品,然后查看该商品用于哪些其他商店。一旦我做到了这一点,我就可以简单地过滤掉管理 storeID 和 eBay storeID,这将与我正在寻找的商店一起离开。

这是我到目前为止:

foreach($collection->getItems() as $order):
   // need to do this to load correct order information
   $order = Mage::getModel('sales/order')->loadByIncrementID($order->getIncrementId());
   $items = $order->getItemsCollection();
   foreach($items as $item) {
      // need to do this to get the actual item, not the item on the order
      $item = Mage::getModel('catalog/product')->load($item->getItemId());
      // do something to get the other store ids
   }
endforeach;
Run Code Online (Sandbox Code Playgroud)

php magento

1
推荐指数
1
解决办法
6941
查看次数

标签 统计

magento ×1

php ×1