protected function annotate(Varien_Object $obj, $path)
 {
     if (file_exists($path)) {
         // Mage::log(strtotime($obj->getUpdateTime()));
         // Mage::log(filemtime($path));
         if ((int) filemtime($path) > (int) strtotime($obj->getUpdateTime())) {
             $obj->setMergeState(Jarlssen_CmsFiles_Helper_Data::STATE_FILE_NEWER);
         } else {
             $obj->setMergeState(Jarlssen_CmsFiles_Helper_Data::STATE_DB_NEWER);
         }
         if ((bool) Mage::getStoreConfig(Jarlssen_CmsFiles_Helper_Data::CONF_CMS_DEV_OVERRIDE)) {
             $obj->setContent(file_get_contents($path));
         }
     } else {
         $obj->setMergeState(Jarlssen_CmsFiles_Helper_Data::STATE_NO_FILE);
     }
 }
Example #2
0
 public function deleteAction()
 {
     //        if (!$this->_validateFormKey()) {
     //            Mage::throwException('Invalid form key');
     //        }
     $id = (int) $this->getRequest()->getParam('id');
     $response = new Varien_Object();
     $response->setError(0);
     if ($id) {
         try {
             $this->_getCart()->removeItem($id)->save();
             $response->setQty($this->_getCart()->getSummaryQty());
             $this->loadLayout();
             $content = $this->getLayout()->getBlock('cart_sidebar')->toHtml();
             $response->setContent($content);
             $response->setSuccessMessage($this->__('<div class="removed-successfully">This item was removed from the cart</div>'));
         } catch (Exception $e) {
             $response->setError(1);
             $response->setErrorMessage($this->__('<div class="removed-failed">Can not remove the item.</div>'));
         }
     }
     $this->getResponse()->setBody($response->toJson());
 }