/** * Validate rule against the buy_x_get_y * * @author Mohamed Meabed <*****@*****.**> * * @param Varien_Object $object * * @return bool */ public function validate(Varien_Object $object) { $address = $object; if ('buy_x_get_y' == $this->getAttribute()) { $address->setByXGetY(true); return true; } return parent::validate($address); }
public function validate(Varien_Object $object) { if ($object instanceof Rewardpoints_Model_Quote && !$object->getQuote()) { $object->setQuote($object); } $address = $object; if (!$address instanceof Mage_Sales_Model_Quote_Address) { if ($object->getQuote()->isVirtual()) { $address = $object->getQuote()->getBillingAddress(); } else { $address = $object->getQuote()->getShippingAddress(); } } $address->setBaseSubtotalIncTax($address->getBaseSubtotal() + $address->getBaseTaxAmount()); return parent::validate($object); }
/** * Validate Address Rule Condition * * @param Varien_Object $object * @return bool */ public function validate(Varien_Object $object) { $address = $object; if ($address instanceof Mage_Sales_Model_Quote_Address) { $address = $object->getQuote()->getBillingAddress(); } else { if ($object->getQuote()->isVirtual()) { $address = $object->getQuote()->getBillingAddress(); } else { $address = $object->getQuote()->getShippingAddress(); } } if ('payment_method' == $this->getAttribute() && !$address->hasPaymentMethod()) { $address->setPaymentMethod($object->getQuote()->getPayment()->getMethod()); } return parent::validate($address); }