/**
     * Show explanation
     * @param Varien_Data_Form_Element_Abstract $element
     * @return string
     */
    protected function _getHeaderHtml($element)
    {
        $result = '';
        $goodBackEnds = array();
        $currentBackEnd = get_class(Mage::app()->getCacheInstance()->getFrontEnd()->getBackend());
        $currentBackEnd = preg_replace('/^Zend_Cache_Backend_/', '', $currentBackEnd);
        $message = '';
        $dependClasses = array('Cm_Cache_Backend_File', 'Cm_Cache_Backend_Redis');
        $optionClasses = array();
        $or = "' " . $this->__('or') . " '";
        foreach ($dependClasses as $dependClass) {
            $ourClass = 'MageHost_' . $dependClass;
            if (mageFindClassFile($dependClass)) {
                $goodBackEnds[] = $ourClass;
            } else {
                $optionClasses[$dependClass] = $ourClass;
            }
        }
        if (empty($goodBackEnds)) {
            $message .= 'ERROR:';
            $message .= '<br />' . $this->__("This extension requires one of these classes to exist: '%s'", join($or, $dependClasses));
        } elseif (!in_array($currentBackEnd, $goodBackEnds)) {
            $message .= 'ERROR:';
            $message .= '<br />' . $this->__("This extension requires cache backend: '%s'", join($or, $goodBackEnds));
            $message .= '<br />' . $this->__("Current setting: '%s'", $currentBackEnd);
            $message .= '<br />';
            foreach ($optionClasses as $dependClass => $ourClass) {
                $message .= '<br />' . $this->__("If you would install '%s' you could also use '%s'.", $dependClass, $ourClass);
            }
            if (in_array('MageHost_Cm_Cache_Backend_File', $goodBackEnds)) {
                $message .= <<<EOF
<br />
Please update your <code style="font-weight: normal;">app/etc/local.xml</code>, for example:<br />
<code style="font-weight: normal;">
&lt;config&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;global&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br />
<strong>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;cache&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;backend&gt;MageHost_Cm_Cache_Backend_File&lt;/backend&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/cache&gt;<br />
</strong>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/global&gt;<br />
&lt;/config&gt;<br />
</code>
EOF;
            }
        }
        if (!empty($message)) {
            $result .= sprintf('<ul class="messages"><li class="error-msg"><ul><li><span>%s</span></li></ul></li></ul>', $message);
        }
        $result .= sprintf('<p>%s<br />%s</p>', $this->__('Most settings have direct affect.'), $this->__('Settings which affect cache tags have no effect on already cached blocks.'));
        $result .= parent::_getHeaderHtml($element);
        return $result;
    }
Example #2
0
 protected function _prepareLayout()
 {
     if (!($cloud_app = $this->getData('cloud_app'))) {
         Mage::throwException($this->__('Local storage is selected.'));
     }
     $profile_cloud_app = strtolower(preg_replace('#[^a-z0-9]#is', '', $cloud_app));
     $block_class = 'Mageplace_Backup_Block_Adminhtml_Settings_' . ucfirst($profile_cloud_app);
     if (class_exists($block_class, false) || mageFindClassFile($block_class)) {
         $field_block = $this->getLayout()->createBlock('mpbackup/adminhtml_settings_' . $profile_cloud_app);
         $this->setChild('cloud_app_settings', $field_block);
     }
     return parent::_prepareLayout();
 }
Example #3
0
 protected function _prepareLayout()
 {
     $activeTab = $this->getRequest()->getParam('tab');
     $allowedTabs = array(Ess_M2ePro_Helper_View_Development::TAB_SUMMARY, Ess_M2ePro_Helper_View_Development::TAB_ABOUT, Ess_M2ePro_Helper_View_Development::TAB_INSPECTION, Ess_M2ePro_Helper_View_Development::TAB_DATABASE, Ess_M2ePro_Helper_View_Development::TAB_TOOLS, Ess_M2ePro_Helper_View_Development::TAB_MODULE, Ess_M2ePro_Helper_View_Development::TAB_DEBUG, Ess_M2ePro_Helper_View_Development::TAB_BUILD);
     // ---------------------------------------
     $params = array('label' => Mage::helper('M2ePro')->__('Summary'));
     if ($activeTab == Ess_M2ePro_Helper_View_Development::TAB_SUMMARY || !in_array($activeTab, $allowedTabs)) {
         $params['content'] = $this->getLayout()->createBlock('M2ePro/adminhtml_development_tabs_summary')->toHtml();
     } else {
         $params['url'] = $this->getUrl('*/adminhtml_development/summaryTab');
         $params['class'] = 'ajax';
     }
     $this->addTab(Ess_M2ePro_Helper_View_Development::TAB_SUMMARY, $params);
     // ---------------------------------------
     // ---------------------------------------
     $params = array('label' => Mage::helper('M2ePro')->__('About'));
     if ($activeTab == Ess_M2ePro_Helper_View_Development::TAB_ABOUT) {
         $params['content'] = $this->getLayout()->createBlock('M2ePro/adminhtml_development_tabs_about')->toHtml();
     } else {
         $params['url'] = $this->getUrl('*/adminhtml_development/aboutTab');
         $params['class'] = 'ajax';
     }
     $this->addTab(Ess_M2ePro_Helper_View_Development::TAB_ABOUT, $params);
     // ---------------------------------------
     $this->addTab(Ess_M2ePro_Helper_View_Development::TAB_INSPECTION, array('label' => Mage::helper('M2ePro')->__('Inspection'), 'content' => $this->getLayout()->createBlock('M2ePro/adminhtml_development_tabs_inspection')->toHtml()));
     // ---------------------------------------
     $params = array('label' => Mage::helper('M2ePro')->__('Database'));
     if ($activeTab == Ess_M2ePro_Helper_View_Development::TAB_DATABASE) {
         $params['content'] = $this->getLayout()->createBlock('M2ePro/adminhtml_development_tabs_database')->toHtml();
     } else {
         $params['url'] = $this->getUrl('*/adminhtml_development/databaseTab');
         $params['class'] = 'ajax';
     }
     $this->addTab(Ess_M2ePro_Helper_View_Development::TAB_DATABASE, $params);
     // ---------------------------------------
     $this->addTab(Ess_M2ePro_Helper_View_Development::TAB_TOOLS, array('label' => Mage::helper('M2ePro')->__('Tools'), 'content' => $this->getLayout()->createBlock('M2ePro/adminhtml_development_tabs_tools')->toHtml()));
     $this->addTab(Ess_M2ePro_Helper_View_Development::TAB_MODULE, array('label' => Mage::helper('M2ePro')->__('Module'), 'content' => $this->getLayout()->createBlock('M2ePro/adminhtml_development_tabs_module')->toHtml()));
     $this->addTab(Ess_M2ePro_Helper_View_Development::TAB_DEBUG, array('label' => Mage::helper('M2ePro')->__('Debug'), 'content' => $this->getLayout()->createBlock('M2ePro/adminhtml_development_tabs_debug')->toHtml()));
     $block = 'M2ePro/adminhtml_development_tabs_build';
     $blockClassName = Mage::getConfig()->getBlockClassName($block);
     if (class_exists($blockClassName, false) || @mageFindClassFile($blockClassName)) {
         $this->addTab(Ess_M2ePro_Helper_View_Development::TAB_BUILD, array('label' => Mage::helper('M2ePro')->__('Build'), 'content' => $this->getLayout()->createBlock($block)->toHtml()));
     }
     $this->setActiveTab($activeTab);
     return parent::_prepareLayout();
 }
Example #4
0
 protected function _getMethod($code, $config, $store = null)
 {
     if (isset(self::$_methods[$code])) {
         return self::$_methods[$code];
     }
     if (empty($config['model'])) {
         return false;
     }
     $modelName = $config['model'];
     $className = Mage::getConfig()->getModelClassName($modelName);
     if (!mageFindClassFile($className)) {
         return false;
     }
     $method = Mage::getModel($modelName);
     $method->setId($code)->setStore($store);
     self::$_methods[$code] = $method;
     return self::$_methods[$code];
 }
Example #5
0
 /**
  * Show explanation about Cache Backend that needs to be used
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 protected function _getHeaderHtml($element)
 {
     $result = '';
     if (is_dir(Mage::getBaseDir('base') . DIRECTORY_SEPARATOR . 'mini')) {
         $note = '';
         $note .= "On our webservers CSS and JavaScript files can be automatically minified to optimize performance.<br />\n";
         $note .= "These minified files are cached in the '<code>httpdocs/mini</code>' directory.<br />\n";
         $note .= "When the Magento cache is cleaned, this extension will cleanup the minify cache.<br />\n";
         $result .= sprintf('<ul class="messages"><li class="notice-msg"><ul><li><span>%s</span></li></ul></li></ul>', $note);
     }
     $goodBackEnds = array();
     $currentBackEnd = get_class(Mage::app()->getCacheInstance()->getFrontEnd()->getBackend());
     $currentBackEnd = preg_replace('/^Zend_Cache_Backend_/', '', $currentBackEnd);
     $message = '';
     $dependClasses = array('Cm_Cache_Backend_File', 'Cm_Cache_Backend_Redis');
     $optionClasses = array();
     $or = "' " . $this->__('or') . " '";
     foreach ($dependClasses as $dependClass) {
         $ourClass = 'MageHost_' . $dependClass;
         if (mageFindClassFile($dependClass)) {
             $goodBackEnds[] = $ourClass;
         } else {
             $optionClasses[$dependClass] = $ourClass;
         }
     }
     if (empty($goodBackEnds)) {
         $message .= 'ERROR:';
         $message .= '<br />' . $this->__("This extension requires one of these classes to exist: '%s'", join($or, $dependClasses));
     } elseif (!in_array($currentBackEnd, $goodBackEnds)) {
         $message .= 'ERROR:';
         $message .= '<br />' . $this->__("This extension requires cache backend: '%s'", join($or, $goodBackEnds));
         $message .= '<br />' . $this->__("Current setting: '%s'", $currentBackEnd);
         $message .= '<br />';
         foreach ($optionClasses as $dependClass => $ourClass) {
             $message .= '<br />' . $this->__("If you would install '%s' you could also use '%s'.", $dependClass, $ourClass);
         }
     }
     if (!empty($message)) {
         $result .= sprintf('<ul class="messages"><li class="error-msg"><ul><li><span>%s</span></li></ul></li></ul>', $message);
     }
     $result .= parent::_getHeaderHtml($element);
     return $result;
 }
Example #6
0
 public function createBlock($block)
 {
     $error = Mage::helper('core')->__('Invalid block type: %s', $block);
     if (is_string($block)) {
         if (strpos($block, '/') !== false) {
             if (!($block = Mage::getConfig()->getBlockClassName($block))) {
                 Mage::throwException($error);
             }
         }
         $fileName = mageFindClassFile($block);
         if ($fileName !== false) {
             include_once $fileName;
             $block = new $block(array());
         }
     }
     if (!$block instanceof Mage_Core_Block_Abstract) {
         Mage::throwException($error);
     }
     return $block;
 }
Example #7
0
 /**
  * Create block object instance based on block type
  *
  * @param string $block
  * @param array $attributes
  * @return Mage_Core_Block_Abstract
  */
 protected function _getBlockInstance($block, array $attributes = array())
 {
     if (isset($this->_registeredBlockMocks[$block])) {
         return $this->_registeredBlockMocks[$block];
     }
     if (is_string($block)) {
         if (strpos($block, '/') !== false) {
             if (!($block = Mage::getConfig()->getBlockClassName($block))) {
                 Mage::throwException(Mage::helper('core')->__('Invalid block type: %s', $block));
             }
         }
         if (class_exists($block, false) || mageFindClassFile($block)) {
             $block = new $block($attributes);
         }
     }
     if (!$block instanceof Mage_Core_Block_Abstract) {
         Mage::throwException(Mage::helper('core')->__('Invalid block type: %s', $block));
     }
     return $block;
 }
 /**
  * Show explanation
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 protected function _getHeaderHtml($element)
 {
     $result = '';
     $goodBackEnds = array();
     $currentBackEnd = get_class(Mage::app()->getCacheInstance()->getFrontEnd()->getBackend());
     $currentBackEnd = preg_replace('/^Zend_Cache_Backend_/', '', $currentBackEnd);
     $message = '';
     $dependClasses = array('Cm_Cache_Backend_File', 'Cm_Cache_Backend_Redis');
     $optionClasses = array();
     $or = "' " . $this->__('or') . " '";
     foreach ($dependClasses as $dependClass) {
         $ourClass = 'JeroenVermeulen_' . $dependClass;
         if (mageFindClassFile($dependClass)) {
             $goodBackEnds[] = $ourClass;
         } else {
             $optionClasses[$dependClass] = $ourClass;
         }
     }
     if (empty($goodBackEnds)) {
         $message .= 'ERROR:';
         $message .= '<br />' . $this->__("This extension requires one of these classes to exist: '%s'", join($or, $dependClasses));
     } elseif (!in_array($currentBackEnd, $goodBackEnds)) {
         $message .= 'ERROR:';
         $message .= '<br />' . $this->__("This extension requires cache backend: '%s'", join($or, $goodBackEnds));
         $message .= '<br />' . $this->__("Current setting: '%s'", $currentBackEnd);
         $message .= '<br />';
         foreach ($optionClasses as $dependClass => $ourClass) {
             $message .= '<br />' . $this->__("If you would install '%s' you could also use '%s'.", $dependClass, $ourClass);
         }
     }
     if (!empty($message)) {
         $result .= sprintf('<ul class="messages"><li class="error-msg"><ul><li><span>%s</span></li></ul></li></ul>', $message);
     }
     $result .= sprintf('<p>%s<br />%s</p>', $this->__('Most settings have direct affect.'), $this->__('Settings which affect cache tags have no effect on already cached blocks.'));
     $result .= parent::_getHeaderHtml($element);
     return $result;
 }
Example #9
0
 protected function _getBlockInstance($block, array $attributes = array())
 {
     if (version_compare(Mage::getVersion(), '1.3.1', '>')) {
         return parent::_getBlockInstance($block, $attributes);
     }
     if (is_string($block)) {
         if (strpos($block, '/') !== false) {
             if (!($block = Mage::getConfig()->getBlockClassName($block))) {
                 Mage::throwException(Mage::helper('core')->__('Invalid block type: %s', $block));
             }
         }
         $fileName = mageFindClassFile($block);
         if ($fileName !== false) {
             if (!class_exists($block, false)) {
                 include_once $fileName;
             }
             $block = new $block($attributes);
         }
     }
     if (!$block instanceof Mage_Core_Block_Abstract) {
         Mage::throwException(Mage::helper('core')->__('Invalid block type: %s', $block));
     }
     return $block;
 }
Example #10
0
 public function getBlockFilename($blockClass)
 {
     return mageFindClassFile($blockClass);
 }
Example #11
0
 /**
  * Init image limit configuration model
  *
  * @throws Mage_Core_Exception
  * @return Mage_XmlConnect_Model_ImageLimits
  */
 protected function _initSizeModel()
 {
     $defaultScreenSize = $this->_getApplicationModel()->getDeviceModel()->getDefaultScreenSize();
     if ($this->_screenSize && $this->_screenSize != $defaultScreenSize) {
         if (!$this->getSizeModel()) {
             $modelClass = Mage::getConfig()->getModelClassName('xmlconnect/imageLimits_' . $this->_screenSize);
             if (class_exists($modelClass, false) || mageFindClassFile($modelClass)) {
                 $sizeModel = Mage::getModel('xmlconnect/imageLimits_' . $this->_screenSize, $this->_updateType);
                 $this->setSizeModel($sizeModel);
             }
         }
         $this->_calculateImageLimits()->_afterCalculate();
     } else {
         $this->_setScreenSize($defaultScreenSize)->_setDefaultSizeModel();
     }
     return $this;
 }
Example #12
0
 /**
  * Get file and line for the current bucket and try to be smart about it.
  * In some case it is not very helpful to jump to the line where Varien_Profiler::start() is called,
  * because this could be a generic call. Instead jumping to the line where the actual action is happing.
  *
  * @param array $trace
  * @param $type
  * @param $name
  * @return array|bool
  */
 public static function getFileAndLine(array $trace, $type, $name)
 {
     $fileAndLine = false;
     switch (self::getType($type, $name)) {
         /**
          * If we have an "event" let's jump to where the event is dispatched
          */
         case Varien_Profiler::TYPE_EVENT:
             $fileAndLine = array('file' => $trace[1]['file'], 'line' => $trace[1]['line']);
             break;
             /**
              * In case of a template let's jump to the template file
              */
         /**
          * In case of a template let's jump to the template file
          */
         case Varien_Profiler::TYPE_TEMPLATE:
             $fileAndLine = array('file' => Mage::getBaseDir('design') . DS . $name, 'line' => 0);
             break;
             /**
              * For blocks let's jump the the block class
              */
         /**
          * For blocks let's jump the the block class
          */
         case Varien_Profiler::TYPE_BLOCK:
             $node = $trace[1]['args'][0];
             /* @var $node Varien_Simplexml_Element */
             if (!empty($node['class'])) {
                 $className = (string) $node['class'];
             } else {
                 $className = (string) $node['type'];
             }
             $className = Mage::getConfig()->getBlockClassName($className);
             $fileAndLine = array('file' => mageFindClassFile($className), 'line' => 0);
             break;
             /**
              * For models let's extract the class name and jump to this file instead
              */
         /**
          * For models let's extract the class name and jump to this file instead
          */
         case Varien_Profiler::TYPE_MODEL:
             $className = substr($name, 24);
             $fileAndLine = array('file' => mageFindClassFile($className), 'line' => 0);
             break;
         case Varien_Profiler::TYPE_EAVMODEL:
             $fileAndLine = array('file' => $trace[3]['file'], 'line' => $trace[3]['line']);
             break;
             /**
              * Ok, this is ugly and very slow, but it's so handy... :)
              * In case of an observer let's find out the class and method that will be executed, find the file and jump
              * to this method.
              */
         /**
          * Ok, this is ugly and very slow, but it's so handy... :)
          * In case of an observer let's find out the class and method that will be executed, find the file and jump
          * to this method.
          */
         case Varien_Profiler::TYPE_OBSERVER:
             $observerName = substr($name, 10);
             $eventName = substr(self::$stack[count(self::$stack) - 2], 15);
             foreach (array(Mage::getDesign()->getArea(), 'global') as $area) {
                 $eventConfig = Mage::app()->getConfig()->getEventConfig($area, $eventName);
                 if ($eventConfig) {
                     $observers = array();
                     foreach ($eventConfig->observers->children() as $obsName => $obsConfig) {
                         $observers[$obsName] = array('type' => (string) $obsConfig->type, 'model' => $obsConfig->class ? (string) $obsConfig->class : $obsConfig->getClassName(), 'method' => (string) $obsConfig->method);
                     }
                     if (isset($observers[$observerName])) {
                         $model = $observers[$observerName]['model'];
                         $method = $observers[$observerName]['method'];
                         $className = Mage::getConfig()->getModelClassName($model);
                         $file = mageFindClassFile($className);
                         $line = self::getLineNumber($file, '/function.*' . $method . '/');
                         $fileAndLine = array('file' => $file, 'line' => $line);
                         break;
                     }
                 }
             }
             if ($fileAndLine) {
                 break;
             }
         default:
             $fileAndLine = array('file' => $trace[0]['file'], 'line' => $trace[0]['line']);
     }
     return $fileAndLine;
 }
Example #13
0
 /**
  * Search grouped class
  *
  * @return void
  */
 public function searchGroupedClassAction()
 {
     if ($this->getRequest()->isPost()) {
         $uri = $this->getRequest()->getPost('uri');
         $groupType = $this->getRequest()->getPost('group');
         if ($groupType == 'all') {
             $groupTypes = array('model', 'block', 'helper');
         } else {
             $groupTypes = array($groupType);
         }
         $items = array();
         if (!empty($uri)) {
             foreach ($groupTypes as $type) {
                 $items[$type]['class'] = Mage::getConfig()->getGroupedClassName($type, $uri);
                 $items[$type]['filepath'] = mageFindClassFile($items[$type]['class']);
             }
             $block = $this->getLayout()->createBlock('debug/abstract');
             $block->setTemplate('olctw_debug/groupedclasssearch.phtml');
             $block->assign('items', $items);
             $this->getResponse()->setBody($block->toHtml());
         } else {
             $this->getResponse()->setBody($this->__('Please fill in a search query'));
         }
     }
 }
Example #14
0
 /**
  * @return MSP_CashOnDelivery_Model_Cashondelivery|null|Phoenix_CashOnDelivery_Model_CashOnDelivery|Mage_Payment_Model_Method_Cashondelivery
  */
 protected function _getCodPayment()
 {
     $payment = null;
     if ($this->_isModuleActive('Phoenix_CashOnDelivery')) {
         $version = Mage::getConfig()->getModuleConfig("Phoenix_CashOnDelivery")->version;
         if (version_compare($version, '1.0.8', '<')) {
             $payment = Mage::getModel("cashondelivery/cashOnDelivery");
         } else {
             $payment = Mage::getModel("phoenix_cashondelivery/cashOnDelivery");
         }
     }
     if ($this->_isModuleActive('MSP_CashOnDelivery')) {
         $payment = Mage::getModel('msp_cashondelivery/cashondelivery');
     }
     $classExists = mageFindClassFile('Mage_Payment_Model_Method_Cashondelivery');
     if ($classExists !== false && Mage::getStoreConfigFlag('payment/cashondelivery/active')) {
         $payment = Mage::getModel('payment/method_cashondelivery');
     }
     return $payment;
 }
Example #15
0
 /**
  * @param Mage_Sales_Model_Order $magentoOrder
  * @param ShopgateOrder          $shopgateOrder
  *
  * @return Mage_Sales_Model_Order
  */
 protected function _setOrderState($magentoOrder, $shopgateOrder)
 {
     $magentoOrder = $this->_getFactory()->setOrderStatus($magentoOrder);
     if ($magentoOrder->getShopgateStatusSet()) {
         //do nothing, but we will need to pull this whole thing inside factory
     } elseif ($shopgateOrder->getPaymentMethod() == ShopgateOrder::PREPAY && !$shopgateOrder->getIsPaid()) {
         $classExists = mageFindClassFile("Mage_Payment_Model_Method_Banktransfer");
         if ($classExists !== false && Mage::getStoreConfigFlag("payment/banktransfer/active")) {
             return $magentoOrder;
         } else {
             if ((Mage::getConfig()->getModuleConfig("Phoenix_BankPayment")->is('active', 'true') || Mage::getConfig()->getModuleConfig('Mage_BankPayment')->is('active', 'true')) && Mage::getStoreConfig('payment/bankpayment/order_status')) {
                 $status = Mage::getStoreConfig('payment/bankpayment/order_status');
                 $state = $this->_getHelper()->getStateForStatus($status);
                 $magentoOrder->setState($state, $status);
             } else {
                 if (!Mage::getStoreConfig(Shopgate_Framework_Model_Config::XML_PATH_SHOPGATE_ORDER_MARK_UNBLOCKED_AS_PAID)) {
                     if ($magentoOrder->getState() != Mage_Sales_Model_Order::STATE_HOLDED) {
                         $magentoOrder->setHoldBeforeState($magentoOrder->getState());
                         $magentoOrder->setHoldBeforeStatus($magentoOrder->getStatus());
                     }
                     $magentoOrder->setState(Mage_Sales_Model_Order::STATE_HOLDED, Mage_Sales_Model_Order::STATE_HOLDED);
                 } else {
                     $oldStatus = $shopgateOrder->getIsPaid();
                     $shopgateOrder->setIsPaid(true);
                     $magentoOrder->addStatusHistoryComment($this->_getHelper()->__("[SHOPGATE] Set order as paid because shipping is not blocked and config is set to 'mark unblocked orders as paid'!"), false)->setIsCustomerNotified(false);
                     $magentoOrder = $this->_setOrderPayment($magentoOrder, $shopgateOrder);
                     $shopgateOrder->setIsPaid($oldStatus);
                 }
             }
         }
     } else {
         $stateObject = new Varien_Object();
         $methodInstance = $magentoOrder->getPayment()->getMethodInstance();
         if ($shopgateOrder->getPaymentMethod() != ShopgateOrder::AMAZON_PAYMENT && strpos($shopgateOrder->getPaymentMethod(), 'PAYONE') === false) {
             // avoid calling order on amazon payment again
             $methodInstance->initialize($methodInstance->getConfigData('payment_action'), $stateObject);
         }
         if (!$stateObject->getState()) {
             $status = $methodInstance->getConfigData("order_status");
             if ($shopgateOrder->getPaymentMethod() == ShopgateOrder::COD && Mage::getConfig()->getModuleConfig('Phoenix_CashOnDelivery')->is('active', 'true')) {
                 $stateObject->setState(Mage_Sales_Model_Order::STATE_NEW);
             } else {
                 $stateObject->setState($this->_getHelper()->getStateForStatus($status));
             }
             $stateObject->setStatus($status);
         }
         $magentoOrder->setState($stateObject->getState(), $stateObject->getStatus());
         if (Mage::getStoreConfig(Shopgate_Framework_Model_Config::XML_PATH_SHOPGATE_ORDER_MARK_UNBLOCKED_AS_PAID) && !$shopgateOrder->getIsPaid() && $shopgateOrder->getPaymentMethod() != ShopgateOrder::BILLSAFE) {
             $oldStatus = $shopgateOrder->getIsPaid();
             $shopgateOrder->setIsPaid(true);
             $magentoOrder->addStatusHistoryComment($this->_getHelper()->__("[SHOPGATE] Set order as paid because shipping is not blocked and config is set to 'mark unblocked orders as paid'!"), false)->setIsCustomerNotified(false);
             $magentoOrder = $this->_setOrderPayment($magentoOrder, $shopgateOrder);
             $shopgateOrder->setIsPaid($oldStatus);
         }
     }
     $magentoOrder->save();
     return $magentoOrder;
 }
Example #16
0
 protected function _getBlockInstance($block, array $attributes = array())
 {
     if (is_string($block)) {
         if (strpos($block, '/') !== false) {
             if (!($block = AO::getConfig()->getBlockClassName($block))) {
                 AO::throwException(AO::helper('core')->__('Invalid block type: %s', $block));
             }
         }
         $fileName = mageFindClassFile($block);
         if ($fileName !== false) {
             include_once $fileName;
             $block = new $block($attributes);
         }
     }
     if (!$block instanceof Mage_Core_Block_Abstract) {
         AO::throwException(AO::helper('core')->__('Invalid block type: %s', $block));
     }
     return $block;
 }