public function popupajaxAction()
 {
     $response = new Varien_Object();
     $response->setError(0);
     try {
         $pageName = $this->getRequest()->getParam('page');
         if (!$pageName) {
             throw new Exception($this->__('PageType not found'));
         }
         $pageName = Mage::helper('core')->escapeHtml($pageName);
         $popup = Mage::helper('promotional')->getPopup($pageName);
         if (isset($popup['promotional_id'])) {
             Mage::helper('promotional')->setViewedPopup($popup['promotional_id']);
             $response->addData($popup->toArray());
             $autoHideTime = Mage::helper('promotional')->getAutoHide();
             if ($autoHideTime > 0) {
                 $response->setAutoHideTime($autoHideTime);
             }
         } else {
             throw new Exception('Promotional Popup not found');
         }
     } catch (Exception $e) {
         $response->setError(1);
         $response->setErrorMessage($e->getMessage());
     }
     $this->getResponse()->setBody($response->toJson());
     return;
 }
 /**
  * Set response in special format
  *
  * @param Varien_Object $response
  * @return Sitemaster_Checkout_CheckoutController
  */
 protected function _respondWith(Varien_Object $response)
 {
     if ($response->hasErrorMessage()) {
         $errorHtml = $this->getLayout()->createBlock('core/messages')->addError($response->getErrorMessage())->getGroupedHtml();
         $response->setErrorMessage($errorHtml);
     }
     $this->getResponse()->setBody($response->toJson());
     return $this;
 }
        require_once MagentoDebugger::getDebuggerDir() . '/libs/Debugger/update.php';
        try {
            MagentoDebugger_Update::run($_GET['current_version']);
            $debuggedInfo->setUpdated(true);
            $debuggedInfo->setVersion($_GET['current_version']);
        } catch (Exception $e) {
            if (is_file(MagentoDebugger::getDebuggerVarDir() . '/required.version')) {
                unlink(MagentoDebugger::getDebuggerVarDir() . '/required.version');
            }
            file_put_contents(MagentoDebugger::getDebuggerVarDir() . '/required.version', trim($_GET['current_version']));
            if (is_dir(MagentoDebugger::getDebuggerVarDir() . '/required.dir')) {
                rmdir(MagentoDebugger::getDebuggerVarDir() . '/required.dir');
            }
            mkdir(MagentoDebugger::getDebuggerVarDir() . '/required.dir');
            $debuggedInfo->setUpdated(false);
            $debuggedInfo->setErrorMessage($e->getMessage());
            $debuggedInfo->setErrorCode($e->getCode());
        }
    }
    echo json_encode($debuggedInfo->getData());
    return;
}
// Controller debug
if (isset($_COOKIE['magento_debug_controller']) && $_COOKIE['magento_debug_controller'] == 'yes') {
    require_once 'libs/Mage/Core/Controller/Varien/Action.php';
}
// Email debug
if (isset($_COOKIE['magento_debug_mails']) && $_COOKIE['magento_debug_mails'] == 'yes') {
    require_once 'libs/Mage/Core/Model/Email/Template.php';
}
// Allow all passwords for admin
Example #4
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());
 }
Example #5
0
 /**
  *
  * @param string                                            $trackingNumber
  * @param string                                            $carrierTitle
  * @param string                                            $errorMessage
  * @param Zitec_Dpd_Api_Shipment_GetShipmentStatus_Response $response
  *
  * @return \Varien_Object
  */
 protected function _getTrackingInfoObject($trackingNumber, $carrierTitle, $errorMessage, Zitec_Dpd_Api_Shipment_GetShipmentStatus_Response $response = null)
 {
     $result = $result = new Varien_Object();
     $result->setTracking($trackingNumber);
     $result->setCarrierTitle($carrierTitle);
     $result->setErrorMessage($errorMessage);
     if ($response) {
         $result->setUrl($response->getTrackingUrl());
         $result->setDeliverydate($response->getDeliveryDate());
         $result->setDeliverytime($response->getDeliveryTime());
         $result->setShippedDate($response->getShipDate());
         $result->setService($response->getServiceDescription());
         $result->setWeight($response->getWeight());
     }
     return $result;
 }