/** * Prepare product and its configuration to be added to some products list. * Perform standard preparation process and then prepare options belonging to specific product type. * * @param Varien_Object $buyRequest * @param Mage_Catalog_Model_Product $product * @param string $processMode * @return array|string */ protected function _prepareProduct(Varien_Object $buyRequest, $product, $processMode) { $subscriptionOption = Mage::helper('adyen_subscription/quote')->getProductAdditionalOptions($buyRequest, $product); if ($subscriptionOption) { $this->qtyMultiplier = $subscriptionOption['qty']; // this qty will be used to calculate the exact number is bundle items if smaller than one $product->addCustomOption('additional_options', serialize([$subscriptionOption])); } return parent::_prepareProduct($buyRequest, $product, $processMode); }
/** * Allow Fixed Bundles to be added to the cart without needing to submit the add to cart form * * @param Varien_Object $buyRequest * @param Mage_Catalog_Model_Product $product * @param string $processMode * @return array|string * @author Paul Hachmang <*****@*****.**> */ protected function _prepareProduct(Varien_Object $buyRequest, $product, $processMode) { $product = $this->getProduct($product); $options = $buyRequest->getBundleOption(); $optionsCollection = $this->getOptionsCollection($product); if ($product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE && count($options) <= 0) { foreach ($optionsCollection->getItems() as $option) { if ($option->getType() == self::OPTION_TYPE_FIXED && $option->getRequired() && !isset($options[$option->getId()])) { $selectionData = Mage::getResourceSingleton('bundle/bundle')->getSelectionsData($product->getId()); foreach ($selectionData as $prod) { $options[$option->getId()][] = $prod['selection_id']; } } } //we are placing the new information in the request $buyRequest->setBundleOption($options); } return parent::_prepareProduct($buyRequest, $product, $processMode); }