Beispiel #1
0
 /**
  * Default customer account page
  *
  * @return \Magento\Framework\View\Result\Page
  */
 public function execute()
 {
     if (!$this->_brandHelper->getConfig('general_settings/enable')) {
         return $this->resultForwardFactory->create()->forward('noroute');
     }
     /** @var \Magento\Framework\View\Result\Page $resultPage */
     $page = $this->resultPageFactory->create();
     return $page;
 }
Beispiel #2
0
 /**
  * Default customer account page
  *
  * @return \Magento\Framework\View\Result\Page
  */
 public function execute()
 {
     if (!$this->_brandHelper->getConfig('general_settings/enable')) {
         return $this->resultForwardFactory->create()->forward('noroute');
     }
     $brand = $this->_initBrand();
     if ($brand) {
         $this->layerResolver->create('brand');
         /** @var \Magento\Framework\View\Result\Page $resultPage */
         $page = $this->resultPageFactory->create();
         // apply custom layout (page) template once the blocks are generated
         if ($brand->getPageLayout()) {
             $page->getConfig()->setPageLayout($brand->getPageLayout());
         }
         $page->addHandle(['type' => 'VES_BRAND_' . $brand->getId()]);
         if (($layoutUpdate = $brand->getLayoutUpdateXml()) && trim($layoutUpdate) != '') {
             $page->addUpdate($layoutUpdate);
         }
         /*$collectionSize = $brand->getProductCollection()->getSize();
           if($collectionSize){
               $page->addHandle(['type' => 'vesbrand_brand_layered']);
           }*/
         $page->getConfig()->addBodyClass('page-products')->addBodyClass('brand-' . $brand->getUrlKey());
         return $page;
     } elseif (!$this->getResponse()->isRedirect()) {
         return $this->resultForwardFactory->create()->forward('noroute');
     }
 }
Beispiel #3
0
 public function getConfig($key, $default = '')
 {
     $result = $this->_brandHelper->getConfig($key);
     if (!$result) {
         return $default;
     }
     return $result;
 }
Beispiel #4
0
 /**
  * Prepare form
  *
  * @return $this
  */
 protected function _prepareForm()
 {
     /** @var $model \Ves\Brand\Model\Brand */
     $model = $this->_coreRegistry->registry('ves_brand');
     /**
      * Checking if user have permission to save information
      */
     if ($this->_isAllowedAction('Ves_Brand::brand_edit')) {
         $isElementDisabled = false;
     } else {
         $isElementDisabled = true;
     }
     /** @var \Magento\Framework\Data\Form $form */
     $form = $this->_formFactory->create();
     $form->setHtmlIdPrefix('brand_');
     $fieldset = $form->addFieldset('base_fieldset', ['legend' => __('Brand Information')]);
     if ($model->getId()) {
         $fieldset->addField('brand_id', 'hidden', ['name' => 'brand_id']);
     }
     $fieldset->addField('name', 'text', ['name' => 'name', 'label' => __('Brand Name'), 'title' => __('Brand Name'), 'required' => true, 'disabled' => $isElementDisabled]);
     $fieldset->addField('url_key', 'text', ['name' => 'url_key', 'label' => __('URL Key'), 'title' => __('URL Key'), 'note' => __('Empty to auto create url key'), 'disabled' => $isElementDisabled]);
     $fieldset->addField('group_id', 'select', ['label' => __('Brand Group'), 'title' => __('Brand Group'), 'name' => 'group_id', 'options' => $this->_viewHelper->getGroupList(), 'disabled' => $isElementDisabled]);
     $fieldset->addField('image', 'image', ['name' => 'image', 'label' => __('Image'), 'title' => __('Image'), 'disabled' => $isElementDisabled]);
     $fieldset->addField('thumbnail', 'image', ['name' => 'thumbnail', 'label' => __('Thumbnail'), 'title' => __('Thumbnail'), 'disabled' => $isElementDisabled]);
     $wysiwygDescriptionConfig = $this->_wysiwygConfig->getConfig(['tab_id' => $this->getTabId()]);
     $fieldset->addField('description', 'editor', ['name' => 'description', 'style' => 'height:200px;', 'label' => __('Description'), 'title' => __('Description'), 'disabled' => $isElementDisabled, 'config' => $wysiwygDescriptionConfig]);
     /**
      * Check is single store mode
      */
     if (!$this->_storeManager->isSingleStoreMode()) {
         $field = $fieldset->addField('store_id', 'multiselect', ['name' => 'stores[]', 'label' => __('Store View'), 'title' => __('Store View'), 'required' => true, 'values' => $this->_systemStore->getStoreValuesForForm(false, true), 'disabled' => $isElementDisabled]);
         $renderer = $this->getLayout()->createBlock('Magento\\Backend\\Block\\Store\\Switcher\\Form\\Renderer\\Fieldset\\Element');
         $field->setRenderer($renderer);
     } else {
         $fieldset->addField('store_id', 'hidden', ['name' => 'stores[]', 'value' => $this->_storeManager->getStore(true)->getId()]);
         $model->setStoreId($this->_storeManager->getStore(true)->getId());
     }
     $fieldset->addField('position', 'text', ['name' => 'position', 'label' => __('Position'), 'title' => __('Position'), 'disabled' => $isElementDisabled]);
     $fieldset->addField('status', 'select', ['label' => __('Status'), 'title' => __('Page Status'), 'name' => 'status', 'options' => $model->getAvailableStatuses(), 'disabled' => $isElementDisabled]);
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
Beispiel #5
0
 /**
  * Default customer account page
  *
  * @return \Magento\Framework\View\Result\Page
  */
 public function execute()
 {
     if (!$this->_brandHelper->getConfig('general_settings/enable')) {
         return $this->resultForwardFactory->create()->forward('noroute');
     }
     $group = $this->_initGroup();
     if ($group) {
         $page = $this->resultPageFactory->create();
         $page->getConfig()->addBodyClass('group-' . $group->getUrlKey());
         return $page;
     } elseif (!$this->getResponse()->isRedirect()) {
         return $this->resultForwardFactory->create()->forward('noroute');
     }
 }