Beispiel #1
0
 /**
  * Get promotion message
  *
  * @return string
  */
 protected function getPromotionMessage()
 {
     $addons = $this->getAddons();
     $modules = array();
     $params = array('clearCnd' => 1);
     foreach ($addons as $addon => $title) {
         if (!\Includes\Utils\Operator::checkIfClassExists('\\XLite\\Module\\' . $addon . '\\Main')) {
             $match = explode('\\', $addon);
             $mainClassFile = LC_DIR_MODULES . str_replace('\\', '/', $addon) . '/Main.php';
             if (\Includes\Utils\FileManager::isExists($mainClassFile)) {
                 // Module is installed but not enabled
                 $limit = \XLite\View\Pager\Admin\Module\Manage::getInstance()->getItemsPerPage();
                 $pageId = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getInstalledPageId($match[0], $match[1], $limit);
                 $pageParam = 'page';
                 $target = 'addons_list_installed';
             } else {
                 // Module is not installed
                 list(, $limit) = $this->getWidget(array(), '\\XLite\\View\\Pager\\Admin\\Module\\Install')->getLimitCondition()->limit;
                 $pageId = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getMarketplacePageId($match[0], $match[1], $limit);
                 $pageParam = 'pageId';
                 $target = 'addons_list_marketplace';
             }
             if (0 < $pageId) {
                 $params[$pageParam] = $pageId;
             }
             $url = $this->buildURL($target, '', $params) . '#' . $match[1];
             $modules[] = '<a href="' . $url . '">' . $title . '</a>';
         }
     }
     return 0 < count($modules) ? static::t('Install additional modules to add more product sources', array('list' => implode(', ', $modules))) : '';
 }
Beispiel #2
0
 /**
  * We make the full location path for the provided URL
  *
  * @return string
  */
 protected function getLocationURL()
 {
     $repo = \XLite\Core\Database::getRepo('XLite\\Model\\Module');
     $module = $repo->find($this->getParam(static::PARAM_MODULE_ID));
     $pageId = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getInstalledPageId($module->getAuthor(), $module->getName(), \XLite\View\Pager\Admin\Module\Manage::getInstance()->getItemsPerPage());
     $params = array('clearCnd' => 1, \XLite\View\Pager\APager::PARAM_PAGE_ID => $pageId);
     return \XLite::getInstance()->getShopURL(sprintf('%s#%s', $this->buildURL('addons_list_installed', '', $params), $module->getName()));
 }
Beispiel #3
0
 /**
  * Get form field by option
  *
  * @param \XLite\Model\Config $option Option
  *
  * @return array
  */
 protected function getFormFieldByOption(\XLite\Model\Config $option)
 {
     $cell = parent::getFormFieldByOption($option);
     if ('redirect_to_cart' == $option->getName() && $cell) {
         $limit = \XLite\View\Pager\Admin\Module\Manage::getInstance()->getItemsPerPage();
         $pageId = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getInstalledPageId('XC', 'Add2CartPopup', $limit);
         $params = array('clearCnd' => 1, 'page' => $pageId);
         $url = $this->buildURL('addons_list_installed', '', $params) . '#' . 'Add2CartPopup';
         $cell[static::SCHEMA_COMMENT] = static::t('This option is ignored as Add to Cart Popup module is installed and enabled.', array('url' => $url));
     }
     return $cell;
 }
Beispiel #4
0
 /**
  * Get related module page URL
  *
  * @param \XLite\Model\Language $entity Language object
  *
  * @return string
  */
 protected function getModulePageURL($entity)
 {
     $url = null;
     $module = $entity->getModule();
     if (!empty($module) && preg_match('/(\\w+)\\\\(\\w+)/', $module, $match)) {
         $params = array('clearCnd' => 1);
         $limit = \XLite\View\Pager\Admin\Module\Manage::getInstance()->getItemsPerPage();
         $pageId = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getInstalledPageId($match[1], $match[2], $limit);
         if (!is_null($pageId)) {
             if (0 < $pageId) {
                 $params[\XLite\View\Pager\APager::PARAM_PAGE_ID] = $pageId;
             }
             $url = $this->buildURL('addons_list_installed', '', $params) . '#' . $match[2];
         }
     }
     return $url;
 }
Beispiel #5
0
 /**
  * Module page URL getter
  *
  * @return string
  */
 public function getModuleInstalledPageURL()
 {
     $result = '';
     if ($this->isInstalled()) {
         $module = $this->getModuleInstalled();
         $pageId = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getInstalledPageId($module->getAuthor(), $module->getName(), \XLite\View\Pager\Admin\Module\Manage::getInstance()->getItemsPerPage());
         $params = array('clearCnd' => 1, \XLite\View\Pager\APager::PARAM_PAGE_ID => $pageId);
         $result = \XLite\Core\Converter::buildURL('addons_list_installed', '', $params) . '#' . $module->getName();
     }
     return $result;
 }
Beispiel #6
0
 /**
  * Module page URL getter
  *
  * @param \XLite\Model\Module $module Module
  *
  * @return string
  */
 protected function getModulePageURL(\XLite\Model\Module $module)
 {
     $params = array('clearCnd' => 1, 'clearSearch' => 1);
     $pageId = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getInstalledPageId($module->getAuthor(), $module->getName(), \XLite\View\Pager\Admin\Module\Manage::getInstance()->getItemsPerPage());
     if (0 < $pageId) {
         $params[\XLite\View\Pager\APager::PARAM_PAGE_ID] = $pageId;
     }
     return $this->buildURL('addons_list_installed', '', $params) . '#' . $module->getName();
 }
 /**
  * Returns URL to payment module
  *
  * @param \XLite\Model\Payment\Method $method Payment method
  *
  * @return string
  */
 public function getPaymentModuleURL(\XLite\Model\Payment\Method $method)
 {
     $result = '';
     list($moduleAuthor, $moduleName) = explode('_', $method->getModuleName());
     if ($method->isModuleInstalled()) {
         // Payment module is installed
         $pageId = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getInstalledPageId($moduleAuthor, $moduleName, \XLite\View\Pager\Admin\Module\Manage::getInstance()->getItemsPerPage());
         $params = array('clearCnd' => 1, \XLite\View\Pager\APager::PARAM_PAGE_ID => $pageId);
         $result = \XLite\Core\Converter::buildURL('addons_list_installed', '', $params) . '#' . $moduleName;
     } else {
         // Payment module is not installed
         $widget = new \XLite\View\Pager\Admin\Module\Install();
         list(, $limit) = $widget->getLimitCondition()->limit;
         $pageId = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getMarketplacePageId($moduleAuthor, $moduleName, $limit);
         $params = array('clearCnd' => 1, 'clearSearch' => 1, \XLite\View\Pager\APager::PARAM_PAGE_ID => $pageId, \XLite\View\ItemsList\AItemsList::PARAM_SORT_BY => \XLite\View\ItemsList\Module\AModule::SORT_OPT_ALPHA);
         $result = $this->buildURL('addons_list_marketplace', '', $params) . '#' . $moduleName;
     }
     return $result;
 }