templates/eshopSearch.html.twig line 1

Open in your IDE?
  1. {% if wireFrame.wireFrameFile is defined and wireFrame.wireFrameFile != null %}
  2.     {% set wireFrameFile = wireFrame.wireFrameFile  %}
  3. {% else %}
  4.     {% set wireFrameFile = 'eshopLayoutFlat.html.twig' %}
  5. {% endif %}
  6. {% extends wireFrameFile %}
  7. {% block title %}{{ 'eshop.search'|trans|raw }}{% endblock %}
  8. {% block page_contents %}
  9. <h1>{{ 'eshop.search'|trans }}</h1>
  10. <div class="eshopHeading">{{ 'eshop.search_string'|trans }}: {{ searchString }}</div>
  11. {% set productTemplate = 'eshopProduct_' ~ productView ~'.html.php' %}
  12. <h4>{{ 'eshop.categories'|trans }}</h4>
  13. <!-- category list -->
  14. <div class="categoryContainer">
  15. <?php 
  16. foreach($categoryList as $category) {
  17.    print($category->getCategoryName());
  18. }
  19. ?>
  20. </div>
  21. <h4><?= $view['translator']->trans('eshop.products'?></h4>
  22. <!-- navigator -->
  23. <div class="navigator">
  24.     <div class="paginator">
  25.       <?php
  26.         if(!empty($eshop->getCountPerPage())) {
  27.             $countPerPage $eshop->getCountPerPage();
  28.         } else {
  29.             $countPerPage 20;
  30.         }
  31.           $pageCount $productCount $countPerPage;
  32.           $pageTotal ceil($pageCount);
  33.           if($pageTotal == 0) {
  34.               $pageTotal++;
  35.           }
  36.         /*
  37.         print('<br>qqw countPerPage: '.$countPerPage);
  38.         print('<br>qqw productCount: '.$productCount);
  39.         print('<br>qqw pageTotal: '.$pageTotal);
  40.         */
  41.           /* we get current page */
  42.           if(!empty($app->getRequest()->get('page')) && $app->getRequest()->get('page') > 0) {
  43.               $currentPage $app->getRequest()->get('page');
  44.           } else {
  45.               $currentPage 1;
  46.           }
  47.       ?>
  48.       <span class="smallDescription"><?= $view['translator']->trans('system.pages'?><?= $currentPage ?>/<?= $pageTotal ?></span>
  49.       <?php
  50.           $scheme $app->getRequest()->getScheme(); //This will return https
  51.         $host $app->getRequest()->getHost(); // This will return www.yoursite.com
  52.           for ($i 1$i <= $pageTotal$i++) {
  53.             if(!empty($app->getRequest()->get('page')) && $app->getRequest()->get('page') == $i) {
  54.                 $cssClass 'pageLinkCurrent';
  55.             } elseif(empty($app->getRequest()->get('page')) && $i == 1) {
  56.                 $cssClass 'pageLinkCurrent';
  57.             } else {
  58.                 $cssClass 'pageLink';
  59.             }
  60.           ?>
  61.               <a href="<?= $scheme ?>://<?= $host ?><?= $app->getRequest()->getPathInfo() ?>?page=<?= $i ?>" class="<?= $cssClass ?>"><?= $i ?></a>
  62.           <?php
  63.         }
  64.       ?>
  65.     </div>
  66.     <div class="clearPaginator">
  67.     </div>
  68. </div>    
  69. <!-- product list -->
  70. <div class="productContainer">
  71. <?php 
  72. foreach($productList as $product) {
  73.     /* we load VAT */   
  74.     $productVAT null;
  75.     if(!empty($product) && !empty($product->getProductVAT()) && $product->getProductVAT() > 0) {
  76.         /* VAT is derived from productVAT */
  77.         $productVAT $product->getProductVAT();
  78.     } elseif(!empty($eshop->getPreferredVAT()) && $eshop->getPreferredVAT() > 0) {
  79.         /* VAT is derived from eshop VAT */
  80.         $productVAT $eshop->getPreferredVAT();            
  81.     }    
  82.     /* we get price(s) to display */
  83.     $displayPrice null;
  84.     $displayPriceVAT null;
  85.     foreach($productPriceList as $price) {
  86.         if($price->getProductId() == $product->getProductId()) {
  87.             //print("<br>price product id: ".$price->getProductId());
  88.             
  89.             /* we get price level according to logged contact-customer */
  90.             if(!empty($view['session']->get('contact')) && !empty($view['session']->get('contact')->getPriceLevel()) && $price->getPriceLevelId()==$view['session']->get('contact')->getPriceLevel()->getPriceLevelId()) {
  91.                 /* we get netto or brutto value according to e-shop configuration */
  92.                 if(!empty($eshop->getDisplayNettoPrices()) && $eshop->getDisplayNettoPrices()==true) {
  93.                   $displayPrice round($price->getNettoValue(),$eshop->getRoundPrice());
  94.                 } else {
  95.                   $displayPrice round($price->getBruttoValue(),$eshop->getRoundPrice());
  96.                 }
  97.                 if(!empty($eshop->getDisplayNettoPrices()) && $eshop->getDisplayNettoPrices()==true) {
  98.                   $displayPriceVAT $displayPrice + ($displayPrice * ($productVAT/100));
  99.                   $displayPriceVATLabel $view['translator']->trans('product.price_with_VAT');
  100.                 } else {
  101.                   $displayPriceVAT $displayPrice - ($displayPrice * ($productVAT/100));
  102.                   $displayPriceVATLabel $view['translator']->trans('product.price_without_VAT');
  103.                 }                  
  104.                 
  105.             } elseif($price->getPriceLevelId() == 1) {
  106.                 /* we get default price level */
  107.                 /* we get netto or brutto value according to e-shop configuration */
  108.                 if(!empty($eshop->getDisplayNettoPrices()) && $eshop->getDisplayNettoPrices()==true) {
  109.                   $displayPrice round($price->getNettoValue(),$eshop->getRoundPrice());
  110.                 } else {
  111.                   $displayPrice round($price->getBruttoValue(),$eshop->getRoundPrice());
  112.                 }
  113.                 if(!empty($eshop->getDisplayNettoPrices()) && $eshop->getDisplayNettoPrices()==true) {
  114.                   $displayPriceVAT $displayPrice + ($displayPrice * ($productVAT/100));
  115.                   $displayPriceVATLabel $view['translator']->trans('product.price_with_VAT');
  116.                 } else {
  117.                   $displayPriceVAT $displayPrice - ($displayPrice * ($productVAT/100));
  118.                   $displayPriceVATLabel $view['translator']->trans('product.price_without_VAT');
  119.                 }               
  120.               //$displayPrice = round($price->getBruttoValue(),$eshop->getRoundPrice());
  121.             }
  122.             
  123.         }
  124.     }  
  125. ?>
  126.     <!-- product template -->
  127.     <?php
  128.     echo $view->render($productTemplate, array('product' => $product
  129.                                                      'eshop' => $eshop,
  130.                                                      'displayPrice' => $displayPrice,
  131.                                                      'displayPriceVAT' => $displayPriceVAT,    
  132.                                                      'productVAT' => $productVAT,                                                 
  133.                                                      'productThumbs' => $productThumbs,
  134.                                                      'user' => $user,
  135.                                                      'app' => $app,
  136.                                                      'searchString' => $searchString,
  137.                                                      
  138.                                                         )
  139.                                                      ) 
  140.     ?>        
  141. <?php
  142. }
  143. ?>
  144. </div>
  145. <!-- navigator -->
  146. <div class="navigator">
  147.     <div class="paginator">
  148.       <?php
  149.           $pageCount $productCount $countPerPage;
  150.       ?>
  151.       <span class="smallDescription">pages <?= $currentPage ?>/<?= $pageTotal ?></span>
  152.       <?php
  153.           $scheme $app->getRequest()->getScheme(); //This will return https
  154.        $host $app->getRequest()->getHost(); //This will return www.yoursite.com
  155.           for ($i 1$i <= $pageTotal$i++) {
  156.             if(!empty($app->getRequest()->get('page')) && $app->getRequest()->get('page') == $i) {
  157.                 $cssClass 'pageLinkCurrent';
  158.             } elseif(empty($app->getRequest()->get('page')) && $i == 1) {
  159.                 $cssClass 'pageLinkCurrent';
  160.             } else {
  161.                 $cssClass 'pageLink';
  162.             }
  163.               
  164.           ?>
  165.               <a href="<?= $scheme ?>://<?= $host ?><?= $app->getRequest()->getPathInfo() ?>?page=<?= $i ?>" class="<?= $cssClass ?>"><?= $i ?></a>
  166.           <?php
  167.         }
  168.       ?>
  169.     </div>
  170.     <div class="clearPaginator">
  171.     </div>
  172. </div>    
  173. {% endblock %}