Exemple #1
0
 /**
  * Detects if the current request represents a request for the backend's homepage
  *
  * @return bool
  */
 private function isBackendHomepage()
 {
     if ($this->request->getParam('controller', 'index') != 'index') {
         return false;
     }
     if ($this->request->getParam('action', 'index') != 'index') {
         return false;
     }
     if ($this->request->getParam('module', 'backend') != 'backend') {
         return false;
     }
     $basePath = $this->request->getBasePath();
     $uri = $this->request->getRequestUri();
     return str_replace($basePath, '', $uri) === '/backend/';
 }
 /**
  * Returns default image columns name
  *
  * @return array
  */
 public function getDefaultColumns()
 {
     $path = $this->request->getScheme() . '://' . $this->request->getHttpHost() . $this->request->getBasePath() . '/media/image/';
     $columns = ['mv.number as ordernumber', "CONCAT('{$path}', aimage.path, '.', aimage.extension) as image", 'aimage.main as main', 'aimage.description as description', 'aimage.position as position', 'aimage.width as width', 'aimage.height as height', "GroupConcat( im.id, '|', mr.optionId, '|' , co.name, '|', cg.name\n            ORDER by im.id\n            SEPARATOR ';' ) as relations", ' \'1\' as thumbnail'];
     return $columns;
 }
Exemple #3
0
 /**
  * Add context cookie
  *
  * @param Request $request
  * @param Response $response
  */
 private function addContextCookie(Request $request, Response $response)
 {
     /** @var $session Enlight_Components_Session_Namespace */
     $session = $this->get('session');
     if ($session->offsetGet('sCountry')) {
         /** @var ProductContextInterface $productContext */
         $productContext = $this->get('shopware_storefront.context_service')->getProductContext();
         $userContext = sha1(json_encode($productContext->getTaxRules()) . json_encode($productContext->getCurrentCustomerGroup()));
         $response->setCookie('x-cache-context-hash', $userContext, 0, $request->getBasePath() . '/', $request->getHttpHost() == 'localhost' ? null : $request->getHttpHost());
     } else {
         if ($request->getCookie('x-cache-context-hash')) {
             $response->setCookie('x-cache-context-hash', null, strtotime('-1 Year', time()), $request->getBasePath() . '/', $request->getHttpHost() == 'localhost' ? null : $request->getHttpHost());
         }
     }
 }