/** * 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 $result = $method->getModule()->getInstalledURL(); } 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; }
/** * Return true if 'Install' button should be displayed * * @param \XLite\Model\Payment\Method $method Payment method * * @return string */ public function isDisplayInstallModuleButton(\XLite\Model\Payment\Method $method) { $result = false; if ($method->getModuleName() && !$method->isModuleInstalled()) { $module = $method->getModule(); $result = $module->getFromMarketplace() && $module->canEnable(false) && ($module->isFree() || $module->isPurchased()) && $this->isLicenseAllowed($module); } return $result; }
/** * {@inheritDoc} */ public function getModule() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getModule', array()); return parent::getModule(); }