سؤال

I am having the following code:

/** @var $item Mage_Sales_Model_Quote_Item */
if($item->isShipSeparately())) ...

This is checking the shipment_type field of the quote item.

Can this shipment_type ever become SHIPMENT_SEPARATELY if no bundle products are involved?

هل كانت مفيدة؟

المحلول

When using Magento's default attributes and products: NO

mysql>  SELECT `attribute_code`,`apply_to` FROM `catalog_eav_attribute` JOIN `eav_attribute` ON `eav_attribute`.`attribute_id` = `catalog_eav_attribute`.`attribute_id` WHERE `attribute_code` = 'shipment_type';
+----------------+----------+
| attribute_code | apply_to |
+----------------+----------+
| shipment_type  | bundle   |
+----------------+----------+
1 row in set (0.00 sec)

You could of course tinker with the apply_to value and/or create your own product type which allows you to set the shipment type value to SHIPMENT_SEPARATELY.

Alternatively you could observe the event sales_convert_quote_item_to_order_item and then

    $orderItem->setProductOptions(
        array_merge(
            $orderItem->getProductOptions(),
            array(
                'shipment_type' => Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY
            )
        )
    );
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top