Example #1
0
 /**
  * Prepare grid collection
  */
 protected function _prepareCollection()
 {
     $collection = new Varien_Data_Collection();
     $layout = $this->getLayout();
     $update = $layout->getUpdate();
     $design = Mage::getSingleton('core/design_package');
     $layoutXML = $update->getFileLayoutUpdatesXml('frontend', $design->getPackageName(), $design->getTheme('layout'), 0);
     $xpath = $layoutXML->xpath('//action[@method="setEsi"]');
     foreach ($xpath as $x) {
         $esi = new Varien_Object();
         $handle = $x->xpath('ancestor::node()[last()-2]');
         $handleName = $handle[0]->label ? $handle[0]->label : $handle[0]->getName();
         $parentBlock = $x->xpath('parent::*');
         $parentBlockName = $parentBlock[0]->getAttribute('name');
         $parentBlockDescription = $parentBlock[0]->getAttribute('description');
         $cacheType = $x->params->cache_type ? $x->params->cache_type : "global";
         $esi->setId($parentBlockName);
         $esi->setHandle($handleName);
         $esi->setBlockName($parentBlockName);
         $esi->setDescription($parentBlockDescription);
         $esi->setCacheType($cacheType);
         try {
             $collection->addItem($esi);
         } catch (Exception $e) {
             Mage::logException($e);
         }
     }
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
Example #2
0
 public function initTotals()
 {
     $parent = $this->getParentBlock();
     if ($parent->getSource()) {
         $fee = new Varien_Object();
         $fee->setLabel($this->__('Refund Payment fee'));
         $fee->setValue($parent->getSource()->getCapayableFee());
         $fee->setBaseValue($parent->getSource()->getBaseCapayableFee());
         $fee->setCode('payment_fee');
         $fee->setBlockName('capayable_fee');
         $parent->addTotalBefore($fee, 'adjustment_positive');
     }
     return $this;
 }
Example #3
0
 /**
  * Prepare grid collection
  */
 protected function _prepareCollection()
 {
     $collection = new Varien_Data_Collection();
     $cache = Mage::helper('varnish')->getRedisCache()->getFrontend();
     $ids = $cache->getIdsMatchingTags(array('VARNISH-CACHETYPE-PER-PAGE'));
     foreach ($ids as $id) {
         $data = unserialize($cache->load($id));
         $item = new Varien_Object();
         $item->setId($id);
         $item->setStoreId($data->getStoreId());
         $item->setParentUrl($data->getParentUrl());
         $item->setBlockName($data->getNameInLayout());
         $item->setFingerprint($id);
         $item->setProbeUrl($data->getUrl());
         $collection->addItem($item);
     }
     $this->setCollection($collection);
     $sort = $this->getParam($this->getVarNameSort()) ? $this->getParam($this->getVarNameSort()) : $this->getDefaultSort();
     $dir = $this->getParam($this->getVarNameDir()) ? $this->getParam($this->getVarNameDir()) : $this->getDefaultDir();
     $this->_sortCollectionBy($sort, $dir);
     return parent::_prepareCollection();
 }