/** * Display only those checkout agreements which match the product in cart * * @param Mage_Checkout_Model_Resource_Agreement_Collection $agreements */ protected function _addRevocationProductTypesFilter($agreements) { /** @var $productCollection Mage_Catalog_Model_Resource_Product_Collection */ $productCollection = Mage::getResourceModel('catalog/product_collection')->addAttributeToFilter('entity_id', array('in' => $this->_getProductIdsInQuote()))->joinAttribute('revocation_product_type', 'catalog_product/revocation_product_type', 'entity_id', null, 'left')->addAttributeToSelect('revocation_product_type'); $revocationProductTypes = array(FireGento_MageSetup_Model_Source_RevocationProductType::REVOCATION_PRODUCT_TYPE_ALL => FireGento_MageSetup_Model_Source_RevocationProductType::REVOCATION_PRODUCT_TYPE_ALL); $defaultRevocationProductType = Mage::getStoreConfig('checkout/options/default_revocation_product_type'); foreach ($productCollection->getColumnValues('revocation_product_type') as $revocationProductType) { if ($revocationProductType) { $revocationProductTypes[$revocationProductType] = $revocationProductType; } else { $revocationProductTypes[$defaultRevocationProductType] = $defaultRevocationProductType; } } $agreements->addFieldToFilter('revocation_product_type', array('in' => $revocationProductTypes)); }
public function getAllIds() { $ids = parent::getAllIds(); if (Mage::getStoreConfig('customweb_subscription/checkout/enabled_agreement') && Mage::helper('customweb_subscription/cart')->isQuoteRecurring()) { $ids[] = 'subscription'; } return $ids; }