Example #1
0
 protected function _prepareCollection()
 {
     $collection = new Varien_Data_Collection();
     $logs = explode("\n\n", $this->getJob()->getLog());
     foreach ($logs as $log) {
         @(list($date, $message) = explode("\t", $log, 2));
         if ($date and $message) {
             $object = new Varien_Object();
             $object->setCreatedAt($date);
             $object->setMessage($message);
             $collection->addItem($object);
         }
     }
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
 /**
  * Validate Address Rule Condition
  *
  * @param Varien_Object|Mage_Sales_Model_Order|Mage_Sales_Model_Quote $object
  * @return bool
  */
 public function validate(Varien_Object $object)
 {
     $quote = $object;
     if (!$object instanceof Mage_Sales_Model_Quote) {
         $quote = Mage::getModel('sales/quote')->load($object->getQuoteId());
     }
     $address = $quote->getBillingAddress();
     //Get infos from billing address
     $toValidate = new Varien_Object();
     $toValidate->setBillingPostcode($address->getPostcode());
     $toValidate->setBillingRegion($address->getRegion());
     $toValidate->setBillingRegionId($address->getRegionId());
     $toValidate->setBillingCountryId($address->getCountryId());
     if (!$quote->isVirtual()) {
         //Get infos from shipping address
         $address = $quote->getShippingAddress();
     }
     $toValidate->setBaseSubtotal($address->getBaseSubtotal());
     $toValidate->setBaseGrandTotal($address->getBaseGrandTotal());
     $toValidate->setWeight($address->getWeight());
     $toValidate->setShippingMethod($address->getShippingMethod());
     $toValidate->setTotalQty($quote->getItemsQty());
     $toValidate->setBaseCurrencyCode($quote->getBaseCurrencyCode());
     $toValidate->setCreatedAt($this->_getFormatCreatedAt($object));
     return parent::validate($toValidate);
 }