예제 #1
0
 /**
  * Get pages static
  *
  * @return array
  */
 public static function getPagesStatic()
 {
     $list = array();
     if (\XLite::isFreeLicense() && \XLite\Core\Auth::getInstance()->isPermissionAllowed(\XLite\Model\Role\Permission::ROOT_ACCESS)) {
         $list['volume_discounts'] = array('name' => static::t('Volume discounts'), 'tpl' => 'promotions/volume_discounts.tpl');
         $list['coupons'] = array('name' => static::t('Coupons'), 'tpl' => 'promotions/coupons.tpl');
     }
     return $list;
 }
예제 #2
0
 /**
  * Check if current page is accessible for current x-cart license
  *
  * @return boolean
  */
 protected function checkLicense()
 {
     return !\XLite::isFreeLicense();
 }
예제 #3
0
 /**
  * Define quick links
  *
  * @return array
  */
 protected function defineQuickLinks()
 {
     $result = array('info' => array(static::ITEM_ICON_SVG => 'images/bell.svg', static::ITEM_WIDGET => 'XLite\\View\\Menu\\Admin\\LeftMenu\\Info', static::ITEM_WEIGHT => 100), 'marketplace' => array(static::ITEM_ICON_SVG => 'images/marketplace.svg', static::ITEM_WIDGET => 'XLite\\View\\Menu\\Admin\\LeftMenu\\Marketplace', static::ITEM_WEIGHT => 200, static::ITEM_LABEL_LINK => $this->buildURL('addons_list_marketplace', null, array('landing' => 1))), 'add_new' => array(static::ITEM_TOOLTIP => static::t('Add new'), static::ITEM_WEIGHT => 300, static::ITEM_ICON_SVG => 'images/add.svg', static::ITEM_CHILDREN => array('add_product' => array(static::ITEM_TITLE => static::t('Product'), static::ITEM_ICON_SVG => 'images/add_product.svg', static::ITEM_TARGET => 'add_product', static::ITEM_PERMISSION => 'manage catalog', static::ITEM_WEIGHT => 100), 'add_category' => array(static::ITEM_TITLE => static::t('Category'), static::ITEM_ICON_SVG => 'images/add_category.svg', static::ITEM_TARGET => 'categories', static::ITEM_PERMISSION => 'manage catalog', static::ITEM_EXTRA => array('add_new' => 1), static::ITEM_WEIGHT => 200), 'add_user' => array(static::ITEM_TITLE => static::t('User'), static::ITEM_ICON_SVG => 'images/add_user.svg', static::ITEM_TARGET => 'profile', static::ITEM_EXTRA => array('mode' => 'register'), static::ITEM_PERMISSION => 'manage users', static::ITEM_WEIGHT => 300))));
     if (\XLite::isFreeLicense()) {
         $result['add_new'][static::ITEM_CHILDREN]['add_coupon'] = array(static::ITEM_TITLE => static::t('Coupon'), static::ITEM_ICON_SVG => 'images/add_product.svg', static::ITEM_TARGET => 'main', static::ITEM_EXTRA => array('page' => 'license_restriction'), static::ITEM_WEIGHT => 400);
     }
     return $result;
 }
예제 #4
0
파일: Order.php 프로젝트: kewaunited/xcart
 /**
  * Return true if order can be edited
  *
  * @return boolean
  */
 public function isOrderEditable()
 {
     return !\XLite::isFreeLicense();
 }
예제 #5
0
 /**
  * Action of license key registration
  *
  * @return void
  */
 protected function doActionRegisterKey()
 {
     $key = \XLite\Core\Request::getInstance()->key;
     if ($key) {
         $keysInfo = \XLite\Core\Marketplace::getInstance()->checkAddonKey($key);
     } else {
         $keysInfo = null;
         $emptyKey = true;
     }
     $this->setReturnURL($this->buildURL('addons_list_marketplace'));
     if ($keysInfo && $keysInfo[$key]) {
         $keysInfo = $keysInfo[$key];
         $repo = \XLite\Core\Database::getRepo('\\XLite\\Model\\ModuleKey');
         foreach ($keysInfo as $info) {
             if (\XLite\Model\ModuleKey::KEY_TYPE_XCN == $info['keyType']) {
                 $xcnPlan = $info['xcnPlan'];
                 $keyData = $info['keyData'];
                 // Unset some fields which is not in database
                 unset($info['xcnPlan']);
                 unset($info['keyData']);
                 unset($info['key']);
                 $entity = $repo->findOneBy($info);
                 if (!$entity) {
                     $entity = new \XLite\Model\ModuleKey();
                     $entity->map($info);
                 }
                 $entity->setKeyValue($key);
                 $entity->setXcnPlan($xcnPlan);
                 $entity->setKeyData($keyData);
                 if (!empty($keyData['wave'])) {
                     $this->updateUpgradeWaveOption($keyData['wave']);
                 }
                 $isValid = true;
                 if (\XLite::isFreeLicense($entity)) {
                     if (0 == \XLite\Core\Database::getRepo('XLite\\Model\\Module')->hasMarketplaceModules(true)) {
                         $isValid = false;
                         $this->showError(__FUNCTION__, static::t('Cannot gather modules from the marketplace. Please try later.'));
                     }
                 }
                 if ($isValid) {
                     // Save entity (key) in the database
                     \XLite\Core\Database::getEM()->persist($entity);
                     \XLite\Core\Database::getEM()->flush();
                     if (\XLite::isFreeLicense()) {
                         // Search for modules from non-free edition
                         $nonFreeModules = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getNonFreeEditionModulesList(false);
                         if ($nonFreeModules) {
                             // Try to uninstall these modules...
                             foreach ($nonFreeModules as $module) {
                                 $messages = array();
                                 $res = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->uninstallModule($module, $messages);
                                 if ($messages) {
                                     foreach ($messages as $message) {
                                         $method = $res ? 'Info' : 'Error';
                                         \XLite\Upgrade\Logger::getInstance()->{'log' . $method}($message, array(), false);
                                     }
                                 }
                             }
                         }
                         \XLite::setCleanUpCacheFlag(true);
                     }
                     if (empty($keyData['message'])) {
                         $this->showInfo(__FUNCTION__, static::t('X-Cart license key has been successfully verified'));
                     } else {
                         $this->showWarning(__FUNCTION__, static::t('X-Cart license key has been successfully verified and activated. But this key has expired and do not allow upgrade store.'));
                     }
                     // Clear cache for proper installation
                     \XLite\Core\Marketplace::getInstance()->clearActionCache(\XLite\Core\Marketplace::ACTION_GET_ADDONS_LIST);
                     $this->setHardRedirect();
                 }
             } else {
                 $keyData = $info['keyData'];
                 $module = \XLite\Core\Database::getRepo('\\XLite\\Model\\Module')->findOneBy(array('author' => $info['author'], 'name' => $info['name']));
                 if ($module) {
                     $entity = $repo->findKey($info['author'], $info['name']);
                     if ($entity) {
                         $entity->setKeyValue($key);
                         $repo->update($entity);
                     } else {
                         $entity = $repo->insert($info + array('keyValue' => $key));
                     }
                     if (!empty($keyData['wave'])) {
                         $this->updateUpgradeWaveOption($keyData['wave']);
                     }
                     // Clear cache for proper installation
                     \XLite\Core\Marketplace::getInstance()->clearActionCache(\XLite\Core\Marketplace::ACTION_GET_ADDONS_LIST);
                     if (empty($keyData['message'])) {
                         $this->showInfo(__FUNCTION__, static::t('License key has been successfully verified for "{{name}}" module by "{{author}}" author', array('name' => $module->getModuleName(), 'author' => $module->getAuthorName())));
                     } else {
                         $this->showWarning(__FUNCTION__, static::t('License key has been successfully verified and activated for "{{name}}" module by "{{author}}" author. But this key has expired and do not allow upgrade store.', array('name' => $module->getModuleName(), 'author' => $module->getAuthorName())));
                     }
                     // We install the addon after the successfull key verification
                     $this->setReturnURL($this->buildURL('upgrade', 'install_addon_force', array('moduleIds[]' => $module->getModuleID(), 'agree' => 'Y')));
                 } else {
                     $this->showError(__FUNCTION__, static::t('Key is validated, but the module X was not found', array('module' => implode(',', $info))));
                 }
             }
         }
     } elseif (!isset($emptyKey)) {
         $error = \XLite\Core\Marketplace::getInstance()->getError();
         $message = $error ? static::t('Response from marketplace: X', array('response' => $error)) : static::t('Response from marketplace is not received');
         $this->showError(__FUNCTION__, $message);
     } else {
         $this->showError(__FUNCTION__, static::t('Please specify non-empty key'));
     }
 }
예제 #6
0
 /**
  * Check if the simple class is used for widget displaying
  *
  * @param array                $column
  * @param \XLite\Model\AEntity $entity
  *
  * @return boolean
  */
 protected function isClassColumnVisible(array $column, \XLite\Model\AEntity $entity)
 {
     $result = parent::isClassColumnVisible($column, $entity);
     /** @var \XLite\Model\Shipping\Method $entity */
     switch ($column[static::COLUMN_CODE]) {
         case 'deliveryTime':
             $result = 'offline' === $entity->getProcessor();
             break;
         case 'handlingFee':
             $result = !\XLite::isFreeLicense();
             break;
         default:
             break;
     }
     return $result;
 }
예제 #7
0
파일: Main.php 프로젝트: kirkbauer2/kirkxc
 /**
  * Check if current page is accessible for current x-cart license
  *
  * @return boolean
  */
 protected function checkLicense()
 {
     $result = true;
     if ('license_restriction' === \XLite\Core\Request::getInstance()->page && \XLite::isFreeLicense()) {
         $result = false;
     }
     return $result;
 }
예제 #8
0
파일: Rate.php 프로젝트: kirkbauer2/kirkxc
 /**
  * getMarkupRate
  *
  * @return float
  */
 public function getMarkupRate()
 {
     $handlingFee = \XLite::isFreeLicense() ? 0 : $this->getMethod()->getHandlingFee();
     return $this->markupRate + $handlingFee;
 }