public function validate(Varien_Object $object) { // for optimization if we no conditions if (!$this->getConditions()) { return true; } $origProduct = null; if ($object->getHasChildren() && $object->getProductType() == 'configurable') { //remember original product $origProduct = $object->getProduct(); $origSku = $object->getSku(); foreach ($object->getChildren() as $child) { // only one itereation. $categoryIds = array_merge($child->getProduct()->getCategoryIds(), $origProduct->getCategoryIds()); $categoryIds = array_unique($categoryIds); $object->setProduct($child->getProduct()); $object->setSku($child->getSku()); $object->getProduct()->setCategoryIds($categoryIds); } } $result = @Mage_Rule_Model_Condition_Combine::validate($object); if ($origProduct) { // restore original product $object->setProduct($origProduct); $object->setSku($origSku); } return $result; }
public function getItemHtml(Varien_Object $item) { if ($item instanceof Unirgy_DropshipSplit_Model_Cart_Vendor || $item->getQuoteItem() instanceof Unirgy_DropshipSplit_Model_Cart_Vendor) { $qItem = !$item instanceof Unirgy_DropshipSplit_Model_Cart_Vendor || $item->getProduct() && !$item->getProduct()->getId() ? $item->getQuoteItem() : $item; $blockName = "vendor_{$qItem->getVendor()->getId()}_{$qItem->getPart()}_" . self::$_blockIter++; return $this->getLayout()->createBlock('udsplit/multishipping_vendor', $blockName)->addData($qItem->getData())->setQuote($qItem->getQuote1())->toHtml(); } return parent::getItemHtml($item); }
/** * Validate Product Rule Condition * * @param Varien_Object $object * * @return bool */ public function validate(Varien_Object $object) { $product = false; if ($object->getProduct() instanceof Mage_Catalog_Model_Product && $object->getData($this->getAttribute()) !== null) { $product = $object->getProduct(); } else { $product = Mage::getModel('catalog/product')->load($object->getProductId()); } $product->setQuoteItemQty($object->getQty())->setQuoteItemPrice($object->getPrice())->setQuoteItemRowTotal($object->getBaseRowTotal()); return parent::validate($product); }
/** * Validate Product Rule Condition * * @param Varien_Object $object * @return bool */ public function validate(Varien_Object $object) { $product = false; if ($object->getProduct() instanceof Mage_Catalog_Model_Product) { $product = $object->getProduct(); } else { $product = Mage::getModel('catalog/product')->load($object->getProductId()); } $product->setQuoteItemSku($object->getSku()); //$newObject = new Varien_Object(); $object->setProduct($product); return parent::validate($object); }
/** * Validate Product Rule Condition * * @param Varien_Object $object * @return bool */ public function validate(Varien_Object $object) { $op = $this->getOperator(); $product = false; if ($object->getProduct() instanceof Mage_Catalog_Model_Product) { $product = $object->getProduct(); } else { $product = Mage::getModel('catalog/product')->load($object->getProductId()); } $product->setQuoteItemQty($object->getQty())->setQuoteItemPrice($object->getPrice())->setQuoteItemRowTotal($object->getBaseRowTotal()); if (!$product->getData($this->getAttribute()) && ($op != '==' || $op != '!=') && $this->getAttribute() != 'category_ids') { return false; } return parent::validate($product); }
public function validate(Varien_Object $object) { if ($vendorId = $this->getRule()->getData('vendor_id')) { $product = false; if ($object->getProduct() instanceof Mage_Catalog_Model_Product) { $product = $object->getProduct(); if (!$product || !$product->getData('sm_product_vendor_id')) { $product = Mage::getModel('catalog/product')->load($object->getProductId()); } if ($product->getData('sm_product_vendor_id') != $vendorId) { return false; } } } return parent::validate($object); }
/** * @param null|Varien_Object $dataObject * @return Xcom_Xfabric_Model_Message_Request */ public function _prepareData(Varien_Object $dataObject = null) { $avroDataObject = Mage::getModel('xcom_chronicle/message_webstore_offer', array('product' => $dataObject->getProduct(), 'store_id' => $dataObject->getStoreId())); $data = array('offer' => $avroDataObject->toArray()); $this->setMessageData($data); return parent::_prepareData($dataObject); }
/** * Ban a specific product page from the cache * * Events: * catalog_product_save_commit_after * * @param Varien_Object $eventObject * @return null */ public function banProductPageCache($eventObject) { if (Mage::helper('turpentine/varnish')->getVarnishEnabled()) { $banHelper = Mage::helper('turpentine/ban'); /** @var Mage_Catalog_Model_Product $product */ $product = $eventObject->getProduct(); /** @var Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $productCollection */ $parentProductsCollection = $banHelper->getRelatedProductsCollection($product); // if not possible to get collection if (!$parentProductsCollection) { return; } // ban product and related products $urlPattern = $banHelper->getProductBanRegex($parentProductsCollection); $result = $this->_getVarnishAdmin()->flushUrl($urlPattern); Mage::dispatchEvent('turpentine_ban_product_cache', $result); $cronHelper = Mage::helper('turpentine/cron'); if ($this->_checkResult($result) && $cronHelper->getCrawlerEnabled()) { $cronHelper->addProductToCrawlerQueue($product); foreach ($banHelper->getParentProducts($product) as $parentProduct) { $cronHelper->addProductToCrawlerQueue($parentProduct); } } // ban related categories $productIds = array_merge(array($product->getId()), $parentProductsCollection->getAllIds()); $categoryRelationCollection = Mage::getResourceModel('turpentine/catalog_category_product_collection')->filterAllByProductIds($productIds); $categoryIds = $categoryRelationCollection->getAllCategoryIds(); $categoryCollection = Mage::getResourceModel('catalog/category_collection')->addAttributeToSelect('url_key')->addIdFilter($categoryIds); foreach ($categoryCollection as $category) { $this->banCategoryCache(new Varien_Object(array('category' => $category))); } } }
/** * @param null|Varien_Object $dataObject * @return Xcom_Xfabric_Model_Message_Request */ public function _prepareData(Varien_Object $dataObject = null) { $avroDataObject = Mage::getModel('xcom_chronicle/message_product', $dataObject->getProduct()); $data = array('products' => array($avroDataObject->toArray())); $this->setMessageData($data); return parent::_prepareData($dataObject); }
/** * @param Varien_Object $object * @return bool */ public function validate(Varien_Object $object) { // check product type if ($this->getAttribute() == 'product_type') { if ($object->getProduct() instanceof Mage_Catalog_Model_Product) { $product = $object->getProduct(); } else { $product = Mage::getModel('catalog/product')->load($object->getProductId()); } if ($product->getTypeId() == $this->getValue()) { return true; } else { return false; } } return parent::validate($object); }
/** * @param null|Varien_Object $dataObject * @return Xcom_Xfabric_Model_Message_Request */ public function _prepareData(Varien_Object $dataObject = null) { /** @var $avroDataObject Xcom_Chronicle_Model_Message_Webstore_Offer */ $avroDataObject = Mage::getModel('xcom_chronicle/message_webstore_offer', array('product' => $dataObject->getProduct(), 'store_id' => $dataObject->getStoreId())); $data = array('sku' => $avroDataObject->getSku(), 'quantity' => $avroDataObject->getQuantity(), 'webStoreId' => $avroDataObject->getWebStoreId()); $this->setMessageData($data); return parent::_prepareData($dataObject); }
/** * Validate Product Rule Condition * * @param Varien_Object $object * * @return bool */ public function validate(Varien_Object $object) { /** @var Mage_Catalog_Model_Product $product */ $product = $object->getProduct(); if (!$product instanceof Mage_Catalog_Model_Product) { $product = Mage::getModel('catalog/product')->load($object->getProductId()); } $product->setQuoteItemQty($object->getQty())->setQuoteItemPrice($object->getPrice())->setQuoteItemRowTotal($object->getBaseRowTotal()); return parent::validate($product); }
/** * Render price for last ordered item * * @param Varien_Object $row * @return string */ public function render(Varien_Object $row) { // Show base price of product - the real price will be shown when user will configure product (if needed) $priceInitial = $row->getProduct()->getPrice() * 1; $priceInitial = floatval($priceInitial) * $this->_getRate($row); $priceInitial = sprintf("%f", $priceInitial); $currencyCode = $this->_getCurrencyCode($row); if ($currencyCode) { $priceInitial = Mage::app()->getLocale()->currency($currencyCode)->toCurrency($priceInitial); } return $priceInitial; }
/** * Validate Product Rule Condition * * @param Varien_Object $object * @return bool */ public function validate(Varien_Object $object) { $product = false; if ($object->getProduct() instanceof Mage_Catalog_Model_Product) { $product = $object->getProduct(); } else { $product = Mage::getModel('catalog/product')->load($object->getProductId()); } if (Mage::getStoreConfig('amrules/general/options_values')) { $options = $product->getTypeInstance(true)->getOrderOptions($product); $values = ''; if (isset($options['options'])) { foreach ($options['options'] as $option) { $values .= '|' . $option['value']; } } $product->setQuoteItemValue($values); } $product->setQuoteItemSku($object->getSku()); $object->setProduct($product); return parent::validate($object); }
/** * Validate Product Rule Condition * * @param Varien_Object $object * * @return bool */ public function validate(Varien_Object $object) { /** @var Mage_Catalog_Model_Product $product */ $product = $object->getProduct(); if (!$product instanceof Mage_Catalog_Model_Product) { $product = Mage::getModel('catalog/product')->load($object->getProductId()); } $product->setQuoteItemQty($object->getQty())->setQuoteItemPrice($object->getPrice())->setQuoteItemRowTotal($object->getBaseRowTotal()); $valid = parent::validate($product); if (!$valid && $product->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) { $children = $object->getChildren(); $valid = $children && $this->validate($children[0]); } return $valid; }
/** * Render single action as link html * * @param array $action * @param Varien_Object $row * @return string */ protected function _toLinkHtml($action, Varien_Object $row) { $product = $row->getProduct(); if (isset($action['process']) && $action['process'] == 'configurable') { if ($product->canConfigure()) { $style = ''; $onClick = sprintf('onclick="return %s.configureItem(%s)"', $action['control_object'], $row->getId()); } else { $style = 'style="color: #CCC;"'; $onClick = ''; } return sprintf('<a href="%s" %s %s>%s</a>', $action['url'], $style, $onClick, $action['caption']); } else { return parent::_toLinkHtml($action, $row); } }
/** * Ban a specific product page from the cache * * Events: * catalog_product_save_commit_after * * @param Varien_Object $eventObject * @return null */ public function banProductPageCache($eventObject) { if (Mage::helper('turpentine/varnish')->getVarnishEnabled()) { $banHelper = Mage::helper('turpentine/ban'); $product = $eventObject->getProduct(); $urlPattern = $banHelper->getProductBanRegex($product); $result = $this->_getVarnishAdmin()->flushUrl($urlPattern); Mage::dispatchEvent('turpentine_ban_product_cache', $result); $cronHelper = Mage::helper('turpentine/cron'); if ($this->_checkResult($result) && $cronHelper->getCrawlerEnabled()) { $cronHelper->addProductToCrawlerQueue($product); foreach ($banHelper->getParentProducts($product) as $parentProduct) { $cronHelper->addProductToCrawlerQueue($parentProduct); } } } }
/** * Validate Product Rule Condition * * @param Varien_Object $object * * @return bool */ public function validate(Varien_Object $object) { /** @var Mage_Catalog_Model_Product $product */ $product = $object->getProduct(); if (!$product instanceof Mage_Catalog_Model_Product) { $product = Mage::getModel('catalog/product')->load($object->getProductId()); } $product->setQuoteItemQty($object->getQty())->setQuoteItemPrice($object->getPrice())->setQuoteItemRowTotal($object->getBaseRowTotal()); // Allows attributes to take custom option SKU into consideration if ($this->getAttribute() === self::QUOTE_ITEM_SKU) { $product->setData($this->getAttribute(), $object->getSku()); $valid = Mage_Rule_Model_Condition_Product_Abstract::validate($product); } else { $valid = parent::validate($object); } if (!$valid && $product->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) { $children = $object->getChildren(); $valid = $children && $this->validate($children[0]); } return $valid; }
/** * Method is needed for specific actions to change given quote options values * according current product type logic * Example: the cataloginventory validation of decimal qty can change qty to int, * so need to change quote item qty option value too. * * @param array $options * @param Varien_Object $option * @param mixed $value * @param Mage_Catalog_Model_Product $product * @return Mage_Bundle_Model_Product_Type */ public function updateQtyOption($options, Varien_Object $option, $value, $product = null) { $optionProduct = $option->getProduct($product); $optionUpdateFlag = $option->getHasQtyOptionUpdate(); $optionCollection = $this->getOptionsCollection($product); $selections = $this->getSelectionsCollection($optionCollection->getAllIds(), $product); foreach ($selections as $selection) { if ($selection->getProductId() == $optionProduct->getId()) { foreach ($options as &$option) { if ($option->getCode() == 'selection_qty_' . $selection->getSelectionId()) { if ($optionUpdateFlag) { $option->setValue(intval($option->getValue())); } else { $option->setValue($value); } } } } } return $this; }
/** * Check availability of giftmessages for specified entity. * * @param string $type * @param Varien_Object $entity * @param Mage_Core_Model_Store|integer $store * @return boolean */ public function isMessagesAvailable($type, Varien_Object $entity, $store = null) { if ($type == 'items') { $items = $entity->getAllItems(); if (!is_array($items) || empty($items)) { return Mage::getStoreConfig(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, $store); } if ($entity instanceof Mage_Sales_Model_Quote) { $_type = $entity->getIsMultiShipping() ? 'address_item' : 'item'; } else { $_type = 'order_item'; } foreach ($items as $item) { if ($item->getParentItem()) { continue; } if ($this->isMessagesAvailable($_type, $item, $store)) { return true; } } } elseif ($type == 'item') { return $this->_getDependenceFromStoreConfig($entity->getProduct()->getGiftMessageAvailable(), $store); } elseif ($type == 'order_item') { return $this->_getDependenceFromStoreConfig($entity->getGiftMessageAvailable(), $store); } elseif ($type == 'address_item') { $storeId = is_numeric($store) ? $store : Mage::app()->getStore($store)->getId(); if (!$this->isCached('address_item_' . $entity->getProductId())) { $this->setCached('address_item_' . $entity->getProductId(), Mage::getModel('catalog/product')->setStoreId($storeId)->load($entity->getProductId())->getGiftMessageAvailable()); } return $this->_getDependenceFromStoreConfig($this->getCached('address_item_' . $entity->getProductId()), $store); } else { return Mage::getStoreConfig(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ORDER, $store); } return false; }
/** * Validate Product Rule Condition * * @param Varien_Object $object * @return bool */ public function validate(Varien_Object $object) { $op = $this->getOperator(); $product = false; if ($object->getProduct() instanceof Mage_Catalog_Model_Product) { $product = $object->getProduct(); } else { $product = Mage::getModel('catalog/product')->load($object->getProductId()); } $product->setQuoteItemQty($object->getQty())->setQuoteItemPrice($object->getPrice())->setQuoteItemRowTotal($object->getBaseRowTotal()); //Validate with attribute is is_new if ($this->getAttribute() == 'is_new') { $result = true; if (!$product->getNewsFromDate() && !$product->getNewsToDate()) { $result = false; } else { $today = new DateTime(date('Y-m-d 00:00:00')); if ($from = $product->getNewsFromDate()) { $fromNewDate = new DateTime($from); if ($today < $fromNewDate) { $result = false; } } if ($to = $product->getNewsToDate()) { $toNewDate = new DateTime($to); if ($today > $toNewDate) { $result = false; } } } $value = $this->getValueParsed(); if ($value == 0) { $result = !$result; } return $result; } //validate with attribute is is_special if ($this->getAttribute() == 'is_special') { $result = true; if (!$product->getSpecialPrice()) { $result = false; } else { $today = new DateTime(date('Y-m-d 00:00:00')); if (!($from = $product->getSpecialFromDate())) { $fromNewDate = $today; } else { $fromNewDate = new DateTime($from); } if (!($to = $product->getSpecialToDate())) { $toNewDate = $today; } else { $toNewDate = new DateTime($to); } if ($today < $fromNewDate || $toNewDate < $today) { $result = false; } $value = $this->getValueParsed(); if ($value == 0) { $result = !$result; } return $result; } } //validate with attribute is qty if ($this->getAttribute() == 'qty') { $result = true; $qty = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty(); $value = $this->getValueParsed(); switch ($op) { case '==': case '!=': $result = $qty == $value; break; case '>=': case '<': $result = $qty >= $value; break; case '<=': case '>': $result = $qty <= $value; break; } if ($op == '!=' || $op == '<' || $op == '>') { $result = !$result; } return $result; } //validate with attribute is qty if ($this->getAttribute() == 'out_of_stock') { $result = true; if ($product->isSaleable()) { $result = false; } if ($this->getValueParsed() == 0) { $result = !$result; } return $result; } //validate best seller if ($this->getAttribute() == 'best_seller') { $result = true; $value = $this->getValueParsed(); // Get Best Seller product $storeId = Mage::app()->getStore()->getId(); if (Mage::registry('bestSelletListId')) { $bestSellerId = Mage::registry('bestSelletListId'); } else { $products = Mage::getResourceModel('reports/product_collection')->addOrderedQty()->setStoreId($storeId)->addStoreFilter($storeId)->setOrder('ordered_qty', 'desc')->setPageSize($value); Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products); //Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products); $bestSellerId = array(); foreach ($products as $p) { $bestSellerId[] = $p->getId(); } if (!empty($bestSellerId)) { Mage::register('bestSelletListId', $bestSellerId); } } if (!count($bestSellerId)) { $result = false; } else { $childProducts = null; if ($product->getTypeId() == 'configurable') { $childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null, $product); } elseif ($product->getTypeId() == 'grouped') { $childProducts = Mage::getModel('catalog/product_type_grouped')->getAssociatedProducts($product); } elseif ($product->getTypeId() == 'bundle') { $childProducts = $product->getTypeInstance(true)->getSelectionsCollection($product->getTypeInstance(true)->getOptionsIds($product), $product); } else { if (!in_array($product->getId(), $bestSellerId)) { return false; } } $flag = 0; if (isset($childProducts)) { foreach ($childProducts as $c) { if (in_array($c->getId(), $bestSellerId)) { $flag = 1; break; } } } if ($flag == 0) { $result = false; } } return $result; } if (!$product->getData($this->getAttribute()) && ('!=' == $op || '>' == $op || '<' == $op || '!{}' == $op || '!()' == $op)) { return false; } return parent::validate($product); }
/** * Method is needed for specific actions to change given quote options values * according current product type logic * Example: the cataloginventory validation of decimal qty can change qty to int, * so need to change quote item qty option value too. * * @param array $options * @param Varien_Object $option * @param mixed $value * * @return object Mage_Bundle_Model_Product_Type */ public function updateQtyOption($options, Varien_Object $option, $value) { $optionProduct = $option->getProduct(); $optionCollection = $this->getOptionsCollection(); $selections = $this->getSelectionsCollection($optionCollection->getAllIds()); foreach ($selections as $selection) { if ($selection->getProductId() == $optionProduct->getId()) { foreach ($options as &$option) { if ($option->getCode() == 'selection_qty_' . $selection->getSelectionId()) { $option->setValue($value); } } } } return $this; }
/** * Retrieve a product instance and initialize if needed * @param Varien_Object $object * * @return Mage_Catalog_Model_Product */ protected function _getProduct(Varien_Object $object) { return $object->getProduct() instanceof Mage_Catalog_Model_Product ? $object->getProduct() : Mage::getModel('catalog/product')->load($object->getProductId()); }
/** * Check availability of giftmessages for specified entity. * * @param string $type * @param Varien_Object $entity * @param Mage_Core_Model_Store|integer $store * @return boolean */ public function isMessagesAvailable($type, Varien_Object $entity, $store = null) { $resultItems = $this->getConfigGiftMessageAllowItems($store); $resultOrder = $this->getConfigGiftMessageAllowOrder($store); if ($type == 'items') { return $resultItems || $resultOrder; } if (is_object($store)) { $storeId = $store->getId(); } elseif (is_numeric($store)) { $storeId = $store; } else { $storeId = Mage::app()->getStore()->getId(); } if ($type == 'item') { return !$entity->getProduct()->isVirtual() && $resultItems && $this->_getDependenceFromStoreConfig($entity->getProduct()->getGiftMessageAvailable(), $store); } elseif ($type == 'order_item') { return !$entity->getIsVirtual() && $resultItems && $this->_getDependenceFromStoreConfig(is_null($entity->getGiftMessageAvailable()) ? 2 : $entity->getGiftMessageAvailable(), $store); } elseif ($type == 'address_item') { if (!$resultItems) { return false; } if (!$this->isCached('address_item_' . $entity->getProductId())) { $this->setCached('address_item_' . $entity->getProductId(), Mage::getModel('catalog/product')->setStoreId($storeId)->load($entity->getProductId())->getGiftMessageAvailable()); } return !$entity->getProduct()->isVirtual() && $this->_getDependenceFromStoreConfig($this->getCached('address_item_' . $entity->getProductId()), $store); } else { return $resultOrder; } return false; }
private function _getProductInformationWork($item, $getInfo, $hasChildren, $children) { $getProduct = in_array('product', $getInfo); $getImage = in_array('image_url', $getInfo); $getLink = in_array('product_url', $getInfo); $result = new Varien_Object(); $result->setProductId((int) $item->getProductId()); $result->setIsConfigurable(false); $result->setIsBundle(false); $result->setSku($item->getSku()); if (Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE == $item->getProductType() && $hasChildren) { $result->setIsConfigurable(true); $result->setParentId($result->getProductId()); $result->setProductId((int) $children[0]->getProductId()); } if (Mage_Catalog_Model_Product_Type::TYPE_BUNDLE == $item->getProductType() && $hasChildren) { $result->setIsBundle(true); $product = Mage::getModel('catalog/product')->load($result->getProductId()); $result->setSku($product->getSku()); $result->setProduct($product); } else { if ($getProduct || $getImage || $getLink && !$result->getIsConfigurable()) { $result->setProduct(Mage::getModel('catalog/product')->load($result->getProductId())); } } if ($getLink) { $result->setProductUrl($this->getProductUrl($result->getIsConfigurable() ? Mage::getModel('catalog/product')->load($result->getParentId()) : $result->getProduct())); } if ($getImage) { $result->setImageUrl($this->getProductImage($result['product'])); } return $result; }
/** * Check availability of giftmessages for specified entity. * * @param string $type * @param Varien_Object $entity * @param Mage_Core_Model_Store|integer $store * @return boolean */ public function isMessagesAvailable($type, Varien_Object $entity, $store = null) { $resultItems = Mage::getStoreConfig(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS, $store); $resultOrder = Mage::getStoreConfig(self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ORDER, $store); if ($type == 'items') { return $resultItems || $resultOrder; } if (is_object($store)) { $storeId = $store->getId(); } elseif (is_numeric($store)) { $storeId = $store; } else { $storeId = Mage::app()->getStore()->getId(); } if ($type == 'item') { return $resultItems && $this->_getDependenceFromStoreConfig($entity->getProduct()->getGiftMessageAvailable(), $store); } elseif ($type == 'order_item') { return $resultItems && $this->_getDependenceFromStoreConfig(is_null($entity->getGiftMessageAvailable()) ? 2 : $entity->getGiftMessageAvailable(), $store); } elseif ($type == 'address_item') { if (!$resultItems) { return false; } if (!$this->isCached('address_item_' . $entity->getProductId())) { $this->setCached('address_item_' . $entity->getProductId(), Mage::getModel('catalog/product')->setStoreId($storeId)->load($entity->getProductId())->getGiftMessageAvailable()); } return $this->_getDependenceFromStoreConfig($this->getCached('address_item_' . $entity->getProductId()), $store); } else { return $resultOrder; } return false; }
/** * Can specify specific actions for ability to change given quote options values * Exemple: cataloginventory decimal qty validation may change qty to int, * so need to change quote item qty option value. * * @param array $options * @param Varien_Object $option * @param mixed $value * * @return object Mage_Catalog_Model_Product_Type_Abstract */ public function updateQtyOption(Varien_Object $option, $value) { $optionProduct = $option->getProduct(); $options = $this->getQtyOptions(); if (isset($options[$optionProduct->getId()])) { $options[$optionProduct->getId()]->setValue($value); } $this->getProduct()->getTypeInstance()->updateQtyOption($this->getOptions(), $option, $value, $this->getProduct()); return $this; }
/** * Returns whether this qty field must be inactive * * @param Varien_Object $row * @return bool */ protected function _isInactive($row) { return $row->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type_Grouped::TYPE_CODE; }