/** * Setting flag if dowenloadable product can be or not in complex product * based on link can be purchased separately or not * * @param Mage_Catalog_Model_Product $product */ public function beforeSave($product = null) { parent::beforeSave($product); if ($this->getLinkSelectionRequired($product)) { $this->getProduct($product)->setTypeHasRequiredOptions(true); } else { $this->getProduct($product)->setTypeHasRequiredOptions(false); } // Update links_exist attribute value $linksExist = false; if ($data = $product->getDownloadableData()) { if (isset($data['link'])) { foreach ($data['link'] as $linkItem) { if (!isset($linkItem['is_delete']) || !$linkItem['is_delete']) { $linksExist = true; break; } } } } /* * After "Downloadable Information" tab was made non-ajax we should * set this flag "true" to force saving of 'required_options' attribute */ $this->getProduct($product)->setCanSaveCustomOptions(true); $this->getProduct($product)->setTypeHasOptions($linksExist); $this->getProduct($product)->setLinksExist($linksExist); }
/** * Setting flag if dowenloadable product can be or not in complex product * based on link can be purchased separately or not * * @param Mage_Catalog_Model_Product $product */ public function beforeSave($product = null) { parent::beforeSave($product); if ($this->getLinkSelectionRequired($product)) { $this->getProduct($product)->setTypeHasRequiredOptions(true); } else { $this->getProduct($product)->setTypeHasRequiredOptions(false); } // Update links_exist attribute value $linksExist = false; if ($data = $product->getDownloadableData()) { if (isset($data['link'])) { foreach ($data['link'] as $linkItem) { if (!isset($linkItem['is_delete']) || !$linkItem['is_delete']) { $linksExist = true; break; } } } } $this->getProduct($product)->setTypeHasOptions($linksExist); $this->getProduct($product)->setLinksExist($linksExist); }
/** * Setting flag if dowenloadable product can be or not in complex product * based on link can be purchased separately or not * * @param Mage_Catalog_Model_Product $product */ public function beforeSave($product = null) { parent::beforeSave($product); if ($this->getLinkSelectionRequired($product)) { $this->getProduct($product)->setTypeHasOptions(true); $this->getProduct($product)->setTypeHasRequiredOptions(true); } else { $this->getProduct($product)->setTypeHasOptions(false); $this->getProduct($product)->setTypeHasRequiredOptions(false); } }
/** * Setting flag if dowenloadable product can be or not in complex product * based on link can be purchased separately or not * */ public function beforeSave() { parent::beforeSave(); $this->getProduct()->canAffectOptions(true); if ($this->getLinkSelectionRequired()) { $this->getProduct()->setTypeHasOptions(true); $this->getProduct()->setTypeHasRequiredOptions(true); } else { $this->getProduct()->setTypeHasOptions(false); $this->getProduct()->setTypeHasRequiredOptions(false); } }