Esempio n. 1
0
 /**
  * @return $this
  */
 public function build()
 {
     if (!$this->isVisible()) {
         return parent::_prepareLayout();
     }
     $this->buildMenu();
     $currentUrl = $this->urlBuilder->getCurrentUrl();
     /** @var DataObject $item */
     foreach ($this->getFlatTree() as $item) {
         if (!is_object($item)) {
             continue;
         }
         if ($item->getData('url') == $currentUrl) {
             $this->activeItem = $item;
             break;
         }
     }
     return parent::_prepareLayout();
 }
 /**
  * @param $entity_ids
  */
 protected function _setupCollection($entity_ids)
 {
     $list = $this->_objectManager->create('\\Boxalino\\Intelligence\\Model\\Collection');
     $list->setStoreId($this->_storeManager->getStore()->getId())->addFieldToFilter('entity_id', $entity_ids)->addAttributeToSelect('*');
     $list->getSelect()->order(new \Zend_Db_Expr('FIELD(e.entity_id,' . implode(',', $entity_ids) . ')'));
     $list->load();
     $list->setCurBxPage($this->getToolbarBlock()->getCurrentPage());
     $limit = $this->getRequest()->getParam('product_list_limit') ? $this->getRequest()->getParam('product_list_limit') : $this->getToolbarBlock()->getDefaultPerPageValue();
     $totalHitCount = $this->p13nHelper->getTotalHitCount();
     if (ceil($totalHitCount / $limit) < $list->getCurPage() && $this->getRequest()->getParam('p')) {
         $url = $this->_url->getCurrentUrl();
         $url = preg_replace('/(\\&|\\?)p=+(\\d|\\z)/', '$1p=1', $url);
         $this->_response->setRedirect($url);
     }
     $lastPage = ceil($totalHitCount / $limit);
     $list->setLastBxPage($lastPage);
     $list->setBxTotal($totalHitCount);
     $this->_productCollection = $list;
 }
 /**
  * Get context values that may not be available and are not required
  * for every log call. Only available values will be included in this
  * set of context values.
  *
  * @return array
  */
 protected function getOptionalContext()
 {
     return array_filter([self::APP_REQUEST_URL => $this->url->getCurrentUrl(), self::SESSION_ID => $this->getSafeSessionId()]);
 }
Esempio n. 4
0
 /**
  * Backend domain
  *
  * @return string
  */
 public function getDomain()
 {
     return $this->urlManager->getCurrentUrl();
 }