【发布时间】:2012-12-22 22:03:05
【问题描述】:
我的产品有多个客户可以选择的自定义选项。例如:
产品:10朵花的花篮(SKU 100) 自定义选项:
红玫瑰数量:从 0 到 10 下拉(每个 SKU 200)
紫玫瑰数量:从 0 到 10 下拉(每个 SKU 300)
Pink Tulips 数量:从 0 到 10 下拉(每个 SKU 为 400)
通过这种方式,客户可以构建自己的购物篮。但是,现在我必须为仓库系统导出我的订单,并且我需要列出带有值(数量)的自定义选项的 SKU。虽然我可以从 Order Item 中获取标签和值。没有 SKU。
我的物品是这样的:
$orders = Mage::getModel('sales/order')->getCollection()
->addAttributeToFilter('status', array('eq' => 'processing'));
foreach ($orders as $order) {
foreach ($order->getAllItems() as $order_item) {
$optionsArr = $order_item->getProductOptions();
if (count($optionsArr['options']) > 0) {
foreach ($optionsArr['options'] as $option) {
$optionTitle = $option['label'];
$optionId = $option['option_id'];
$optionValue = $option['value'];
// no SKU ?!?!
}
}
}
}
任何想法如何为每个选择的自定义选项获取 SKU?
【问题讨论】:
-
您获得了 ID,因此您始终可以从目录产品选项模型 l 中加载它。这将为您提供所有选项属性
标签: magento magento-1.7