public function hasRequiredOptions($product = null) { if (ITwebexperts_Payperrentals_Helper_Data::isReservationAndRental($this->getProduct($product))) { return false; } else { return parent::hasRequiredOptions($product); } }
public function getOptionsPrice($product, $price) { if (ITwebexperts_Payperrentals_Helper_Data::isReservationAndRental($product)) { $optprice = 0; if ($optionIds = $product->getCustomOption('option_ids')) { $basePrice = $price; foreach (explode(',', $optionIds->getValue()) as $optionId) { if ($option = $product->getOptionById($optionId)) { $quoteItemOption = $product->getCustomOption('option_' . $option->getId()); $group = $option->groupFactory($option->getType())->setOption($option)->setQuoteItemOption($quoteItemOption); $optprice += $group->getOptionPrice($quoteItemOption->getValue(), $basePrice); } } } return $optprice; } else { return parent::getOptionsPrice($product, $price); } }
/** * Adds rental start and end dates to custom options * * @param Varien_Object $buyRequest * @param null $product * @param null $processMode * @param string $productType * @return string * todo refactor /investigate more to additional_options(how the translations of options would work, might need a lot of effort) * this function should check if we are in global dates mode, should get the existing param etc, no need to modify query string on listing. * This will allow so adding a product from a different block from listing to work too */ public function prepareForCartAdvanced(Varien_Object $buyRequest, $product = null, $processMode = null, $productType = 'simple') { if (ITwebexperts_Payperrentals_Helper_Data::isBuyout($buyRequest)) { $product->addCustomOption(ITwebexperts_Payperrentals_Model_Product_Type_Reservation::BUYOUT_PRICE_OPTION, true, $product); return 'call_parent'; } if (!ITwebexperts_Payperrentals_Helper_Sso::isAllowedRenting()) { return Mage::helper('payperrentals')->__('You are not allowed renting. Please login on CNH'); } if ($productType != 'simple' && !ITwebexperts_Payperrentals_Helper_Data::isReservationAndRental($product)) { return 'call_parent'; } if ($buyRequest->getIsReservation() == ITwebexperts_Payperrentals_Model_Product_Isreservation::STATUS_RENTAL) { return Mage::helper('payperrentals/membership')->addProductToQueue($product, $buyRequest, $productType == 'grouped' ? true : false); } $msg = $this->_completeBuyRequestObject($buyRequest, $product, $productType); if ($msg) { return $msg; } $resultObject = new Varien_Object(); Mage::dispatchEvent('prepare_advanced_before', array('buy_request' => $buyRequest, 'product_type' => $productType, 'product' => $product, 'result' => $resultObject)); if ($resultObject->getResult() != '') { return $resultObject->getResult(); } $this->_addCustomOptions($product, $buyRequest); ITwebexperts_Payperrentals_Helper_Date::saveDatesForGlobalUse((array) $buyRequest); return 'call_parent'; }