我如何组合来自magento发货订单的项目?

我如何组合来自magento发货订单的项目?,magento,Magento,我正在考虑将不同订单中的多个项目放入同一个装运箱。理想情况下,当我去发货订单时,该订单的项目部分会显示该客户的所有未结项目。我已将生成项目的代码隔离为: app/design/adminhtml/default/mytemplate/template/sales/order/shipping/create/items.phtml 以及该文件中的代码行: $\u items=$this->getShipping()->getAllItems() 在函数getAllItems中,我添加了以下代码:

我正在考虑将不同订单中的多个项目放入同一个装运箱。理想情况下,当我去发货订单时,该订单的项目部分会显示该客户的所有未结项目。我已将生成项目的代码隔离为:

app/design/adminhtml/default/mytemplate/template/sales/order/shipping/create/items.phtml

以及该文件中的代码行:

$\u items=$this->getShipping()->getAllItems()

在函数getAllItems中,我添加了以下代码:

$cust_orders = Mage::getModel('sales/order')->getCollection()
    ->addAttributeToSelect('*')
    ->addAttributeToSelect('entity_id')
    ->addFieldToFilter('customer_id',$this->getCustomerId());

foreach ($cust_orders as $order) {
    $order_id = $order->getEntityId();
    $cust_items = Mage::getModel('sales/order_item')
        ->getCollection()
        ->addAttributeToSelect('*')
        ->addFieldToFilter('order_id', $order_id);
    foreach ($cust_items as $cust_item) {
        { help! }
    }
我需要一些帮助!部分我正在尝试将新数组($cust_items)正确地放入数组$items中。但我似乎无法理解这一部分。。。对象似乎是使用getItemsCollection函数填充的;我正在做的事情已经失去了方向

如果你有什么新想法,请告诉我。谢谢

   $cust_orders = Mage::getModel('sales/order')->getCollection()
    ->addAttributeToSelect('*')
    ->addAttributeToSelect('entity_id')
    ->addFieldToFilter('customer_id',$this->getCustomerId());


foreach ($cust_orders as $order) {
    $order_id = $order->getEntityId();
    $cust_items = Mage::getModel('sales/order_shipment_item')
        ->getCollection()
        ->addAttributeToSelect('*')
        ->addFieldToFilter('parent_id', $order_id);
    foreach ($cust_items as $cust_item) {
        $items[] = $cust_item;
    }
其他一些小的调整,和更多的测试,但我看起来很好去


这个答案显然是错误的。。。。仍在寻找解决方案。。。。让我非常困惑…

事实上,在深入研究之后,显然需要在链的更深处的items集合中进行更改。从项目集合中,我需要加载所有项目。如果有人想增加他们的分数,我在听。谢谢,解决了!我将第二个getModel更改为getModel('sales/order\u shipping\u item'),将过滤器更改为'parent\u id;然后将帮助替换为$items[]=$cust_item;看起来我可以很好的去。。。更多的小修改,还没有测试它的实际装运部分,但这部分看起来已经完成了。