Exemplo n.º 1
0
 public function gridAction()
 {
     if ($this->_getParam("pimcore_editmode") == "true") {
         $this->editmode = true;
         $this->view->editmode = true;
     }
     /**
      * @var $filterDefinition \Pimcore\Model\Object\FilterDefinition
      */
     $filterDefinition = $this->_getParam("filterdefinition");
     if (!$filterDefinition instanceof \Pimcore\Model\Object\FilterDefinition) {
         $filterDefinition = \Pimcore\Model\Object\FilterDefinition::getById(intval($this->_getParam("filterdef")));
         if (!$filterDefinition) {
             throw new Exception("Filter Definition not found!");
         }
     }
     $this->view->filterDefinitionObject = $filterDefinition;
     $indexService = OnlineShop_Framework_Factory::getInstance()->getIndexService();
     $productList = $indexService->getProductListForCurrentTenant();
     $productList->setVariantMode(OnlineShop_Framework_IProductList::VARIANT_MODE_INCLUDE_PARENT_OBJECT);
     $filterService = OnlineShop_Framework_Factory::getInstance()->getFilterService($this->view);
     $orderByOptions = array();
     $this->view->orderByOptions = $orderByOptions;
     OnlineShop_Framework_FilterService_Helper::setupProductList($filterDefinition, $productList, $this->_getAllParams(), $this->view, $filterService, $this->_getParam("fullpage"));
     $this->view->productList = $productList;
     $this->view->filterService = $filterService;
     //Getting seo text - if not specified in the template, then get them from the category if existent
     $grid_seo_headline = $this->view->input("grid_seo_headline")->getValue();
     if (empty($grid_seo_headline)) {
         $category = OnlineShop_Framework_FilterService_Helper::getFirstFilteredCategory($this->view->filterDefinitionObject->getConditions());
         if ($category) {
             $grid_seo_headline = $category->getSeoname();
         }
     }
     $grid_seo_text = $this->view->wysiwyg("grid_seo_text")->getValue();
     if (empty($grid_seo_text)) {
         $category = OnlineShop_Framework_FilterService_Helper::getFirstFilteredCategory($this->view->filterDefinitionObject->getConditions());
         if ($category) {
             $grid_seo_text = $category->getSeotext();
         }
     }
     $this->view->grid_seo_headline = $grid_seo_headline;
     $this->view->grid_seo_text = $grid_seo_text;
 }
Exemplo n.º 2
0
            ?>
">
                    <?php 
            echo $page;
            ?>
                </a>
            <?php 
        }
        ?>

        <?php 
    }
    ?>

        <?php 
    if (isset($this->next)) {
        ?>
            <a href="<?php 
        echo OnlineShop_Framework_FilterService_Helper::createPagingQuerystring($this->next);
        ?>
"
               class="pageRight"
            >
                next
            </a>
        <?php 
    }
    ?>
    </div>
<?php 
}
Exemplo n.º 3
0
 public function searchAction()
 {
     $values = array();
     $productList = OnlineShop_Framework_Factory::getInstance()->getIndexService()->getProductListForCurrentTenant();
     $productList->setVariantMode(OnlineShop_Framework_IProductList::VARIANT_MODE_INCLUDE_PARENT_OBJECT);
     if ($this->getParam("term")) {
         //$productList->addQueryCondition($this->getParam("term"));
         foreach (explode(" ", $this->getParam("term")) as $term) {
             $productList->addQueryCondition($term, "search");
         }
     }
     if ($this->getParam("showResultPage")) {
         $params = $this->getAllParams();
         if (empty($filterDefinition)) {
             $filterDefinition = Pimcore_Config::getWebsiteConfig()->searchFilterdefinition;
         }
         $this->view->filterDefinitionObject = $filterDefinition;
         // create and init filter service
         $filterService = OnlineShop_Framework_Factory::getInstance()->getFilterService($this->view);
         OnlineShop_Framework_FilterService_Helper::setupProductList($filterDefinition, $productList, $params, $this->view, $filterService, true);
         $this->view->filterService = $filterService;
         $this->view->products = $productList;
         // init pagination
         $paginator = Zend_Paginator::factory($productList);
         $paginator->setCurrentPageNumber($this->getParam('page'));
         $paginator->setItemCountPerPage($filterDefinition->getPageLimit());
         $paginator->setPageRange(10);
         $this->view->paginator = $paginator;
         // print page with layout or only the list for ajax requests
         if ($this->getRequest()->isXmlHttpRequest() === false) {
             $this->enableLayout();
         } else {
             // infinity scrolling?
             if ($this->getParam('infinity')) {
                 $this->renderScript('/shop/list/products.php');
             }
         }
     } else {
         $productList->setLimit(10);
         foreach ($productList as $p) {
             $firstSizeVariants = $p->getColorVariants(true);
             if (count($firstSizeVariants) == 0) {
                 // keine varianten verfügbar
                 $linkProduct = $p;
             } else {
                 $linkProduct = $firstSizeVariants[0];
             }
             $values[] = array("id" => $p->getId(), "value" => $p->getName(), "label" => $p->getName(), "url" => $linkProduct->getShopDetailLink($this->view));
         }
         $this->_helper->json($values);
     }
 }