/** * Check if cart has items with consultation overhead. * If yes, redirect to new overview page, where you can select which item * to pay with prescription payment * @param Varien_Event_Observer $observer * @return mixed False if no items are found, redirect for further * processing */ public function hasItemsForConsultationOverhead($observer) { // If extension is disabled if (!Mage::getSingleton('prescriptionpayment/prescriptionpayment')->isEnabled()) { return false; } $cartTotal = Mage::helper('checkout/cart')->getQuote()->getGrandTotal(); if ($this->attributeMinTotal > $cartTotal || $this->attributeMaxTotal < $cartTotal && !empty($this->attributeMaxTotal) || Mage::app()->getRequest()->getParam('proceedtocheckout') == 1) { if (Mage::app()->getRequest()->getParam('proceedtocheckout')) { if (Ce_PrescriptionPayment_Helper_Data::payByPrescription()) { $this->setCartItemsPriceToZero(); } else { $this->setCartItemsPriceToOriginalPrice(); } } return false; } $itemsOld = $this->getCartItems(); $items = Mage::getSingleton('prescriptionpayment/prescriptionpayment')->getReducedItems($itemsOld); if (!empty($items)) { Mage::app()->getResponse()->setRedirect(Mage::getUrl('prescriptionpayment/items/select')); } return false; }
/** * Check if customer wants to pay by prescription * @return boolean */ public function payByPrescription() { return Ce_PrescriptionPayment_Helper_Data::payByPrescription(); }