/** * @return array */ protected function prepareParameters() { $queryParameters = parent::prepareParameters(); $dataLocale = $this->getLocale($queryParameters); $queryParameters['dataLocale'] = $dataLocale; $this->catalogContext->setLocaleCode($dataLocale); $dataScope = $this->getScope(); $queryParameters['scopeCode'] = $dataScope; return $queryParameters; }
/** * @return array */ protected function prepareParameters() { $queryParameters = parent::prepareParameters(); $dataLocale = $this->getLocale($queryParameters); $queryParameters['dataLocale'] = $dataLocale; // TODO : strange that we need to set it here, would expect from the datasource $this->catalogContext->setLocaleCode($dataLocale); $dataScope = $this->getScope(); $queryParameters['scopeCode'] = $dataScope; return $queryParameters; }
/** * {@inheritdoc} */ public function initialize() { $locale = $this->getLocale()->getCode(); $this->catalogContext->setLocaleCode($locale); $this->allAttributes = null; $this->values = new ArrayCollection(); $allAttributes = $this->getAllAttributes(); $this->values = new ArrayCollection(); foreach ($allAttributes as $attribute) { $this->addValues($attribute, $this->getLocale()); } }
/** * Initializes self::commonAtributes with values from the repository * Attribute is not available for mass editing if: * - it is an identifier * - it is unique * - without value AND not link to family * - is not common to every products * * @param array $productIds */ protected function initializeCommonAttributes(array $productIds) { // Set attribute options locale $currentLocaleCode = $this->getLocale()->getCode(); $this->catalogContext->setLocaleCode($currentLocaleCode); // Get common attributes $attributes = $this->massActionManager->findCommonAttributes($productIds); foreach ($attributes as $attribute) { $attribute->setLocale($currentLocaleCode); $attribute->getGroup()->setLocale($currentLocaleCode); $this->commonAttributes[] = $attribute; } }
/** * Define locale and scope in CatalogContext */ protected function configureCatalogContext() { $this->catalogContext->setLocaleCode($this->userContext->getCurrentLocaleCode()); $this->catalogContext->setScopeCode($this->userContext->getUserChannelCode()); }