Magento - 运行多个群发动作

时间:2017-08-16 07:48:30

标签: magento action mass

我遇到了Magento的问题。我想立刻进行多次群众行动。我的意思是,如果一个特定的"群众行动"选择然后我想要另一个群众行动运行。

你们有任何想法如何解决这个问题?这是因为我有多家公司选择交付,我想制作一个模块,在每个公司检查哪个公司是特定订单时,会触发不同的大规模行动。

类Plusshop_ShipmentControl_Adminhtml_MassActionsController扩展Mage_Adminhtml_Controller_Action {

public function massShipmentAction() {
    // Get this session
    $coolrunnerIds = array();
    $session = $this->_getSession();

    // Get order ids from selected in sales_order
    $orderIds = $this->getRequest()->getPost('order_ids', array());

    try {
        foreach ($orderIds as $orderId) {
            // Get order from orderID
            $order = Mage::getModel('sales/order')->load($orderId);

            // Get shipment method by splitting the shipment name
            $shippingMethod = '';
            $shippingMethodFull = $order->getShippingMethod();
            $shippingMethodSplit = explode('_', $shippingMethodFull);

            // Check if its Coolrunner or GLS.
            if($shippingMethodSplit[0] == 'gls') {

                // FIXED - Shipment method number 1.

            } elseif ($shippingMethodSplit[0] == 'coolrunner') {
                // IF IS: Coolrunner create new coolrunner shipment (coolrunner method)
                $shippingMethod = 'Coolrunner (Brug coolrunner funktion)';

                // TRIGGER IF SHIPMENT = COOLRUNNER.

            }

            $session->addSuccess('OrderID: ' . $orderId . ' - Shipping: ' . $shippingMethod);
        }
    } catch (Exception $e) {
        $session->addError($e->getMessage());
    }

    $this->_forward('processAction', 'grid', 'coolrunner', $coolrunnerIds);
}

}

希望你们中的一些人能够让我知道我应该反对的地方:)

此致 凯文

0 个答案:

没有答案