示例#1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     SalesChartsAsset::register($this->view);
     if (false === $this->currency instanceof Currency) {
         $this->currency = CurrencyHelper::findCurrencyByIso($this->currency);
     }
     $this->startDate = $this->getPeriodTs($this->period);
 }
示例#2
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->apiContext = new ApiContext(new OAuthTokenCredential($this->clientId, $this->clientSecret));
     $this->apiContext->setConfig(['mode' => true === $this->sandbox ? 'sandbox' : 'live', 'log.LogEnabled' => false, 'cache.enabled' => true, 'cache.FileName' => \Yii::getAlias('@runtime/paypal.cache')]);
     if (false === $this->currency instanceof Currency) {
         $this->currency = CurrencyHelper::findCurrencyByIso($this->currency);
     }
 }
示例#3
0
文件: Yml.php 项目: lzpfmh/dotplant2
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (false === $this->model instanceof YmlModel) {
         return false;
     }
     if (null === $this->viewFile) {
         $this->viewFile = \Yii::$app->getModule('shop')->getViewPath() . '/backend-yml/generate/yml.php';
     }
     /** @var YmlModel $config */
     $config = $this->model;
     \Yii::$app->urlManager->setHostInfo($config->shop_url);
     $this->currency = CurrencyHelper::findCurrencyByIso($config->currency_id);
     if (static::USE_OFFER_PARAM == $config->offer_param) {
         $this->prepareProperties();
     }
     static::$_noImg = \Yii::$app->getModule('image')->noImageSrc;
 }
 /**
  * Install handlers
  */
 public static function installHandlers(ActionEvent $event)
 {
     $currency = \Yii::$app->getModule('seo')->analytics['ecYandex']['currency'];
     if (AnalyticsHandler::CURRENCY_MAIN === intval($currency)) {
         static::$currency = CurrencyHelper::getMainCurrency();
     } elseif (AnalyticsHandler::CURRENCY_USER === intval($currency)) {
         static::$currency = CurrencyHelper::getUserCurrency();
     } else {
         static::$currency = CurrencyHelper::findCurrencyByIso($currency);
     }
     $route = implode('/', [$event->action->controller->module->id, $event->action->controller->id, $event->action->id]);
     Event::on(CartController::className(), CartController::EVENT_ACTION_ADD, [self::className(), 'handleCartAdd'], false);
     Event::on(CartController::className(), CartController::EVENT_ACTION_REMOVE, [self::className(), 'handleRemoveFromCart'], false);
     Event::on(CartController::className(), CartController::EVENT_ACTION_QUANTITY, [self::className(), 'handleChangeQuantity'], false);
     Event::on(CartController::className(), CartController::EVENT_ACTION_CLEAR, [self::className(), 'handleClearCart'], false);
     Event::on(Controller::className(), Controller::EVENT_PRE_DECORATOR, [self::className(), 'handleProductShow']);
     if ('shop/cart/index' === $route) {
         self::handleCartIndex();
     }
     YandexAnalyticsAssets::register(\Yii::$app->getView());
 }