Jump to content

irder

Members
  • Posts

    341
  • Joined

  • Last visited

Posts posted by irder

  1. hello,please test this,thanks

     

     

    https://github.com/PrestaShop/PrestaShop/pull/7876

     public function addColorsToProductList(&$products)
        {
            if (!is_array($products) || !count($products) || !file_exists(_PS_THEME_DIR_.'product-list-colors.tpl')) {
                return;
            }
    
            $products_need_cache = array();
            foreach ($products as &$product) {
                if (!$this->isCached(_PS_THEME_DIR_.'product-list-colors.tpl', $this->getColorsListCacheId($product['id_product']))) {
                    $products_need_cache[] = (int)$product['id_product'];
                }else{
                    $product['color_list'] = $this->context->smarty->createTemplate(_PS_THEME_DIR_.'product-list-colors.tpl', $this->getColorsListCacheId($product['id_product']))->fetch();
                }
            }
          
            unset($product);
    
            $colors = false;
            if (count($products_need_cache)) {
                var_dump($products_need_cache);
                 $colors = Product::getAttributesColorList($products_need_cache);
                 Tools::enableCache();
                foreach ($products as &$product) {
                    if (in_array($product['id_product'], $products_need_cache)){
                            $tpl = $this->context->smarty->createTemplate(_PS_THEME_DIR_.'product-list-colors.tpl', $this->getColorsListCacheId($product['id_product']));
                            if (isset($colors[$product['id_product']])) {
                                $tpl->assign(array(
                                    'id_product'  => $product['id_product'],
                                    'colors_list' => $colors[$product['id_product']],
                                    'link'        => Context::getContext()->link,
                                    'img_col_dir' => _THEME_COL_DIR_,
                                    'col_img_dir' => _PS_COL_IMG_DIR_
                                ));           
                                $product['color_list'] = $tpl->fetch(_PS_THEME_DIR_.'product-list-colors.tpl', $this->getColorsListCacheId($product['id_product']));
                            } else {
                                $product['color_list'] = '';
                            }
                     }
                        
                }
                Tools::restoreCacheSettings();
            }
        }
    

    this code can fix the bug ,but i don't know why  :ph34r:

     

  2. hi,

    in category.tpl  

    add the code like

    {if $category->id eq xxx1 }
        {assign var='view' value='list'}
    {elseif $category->id eq xxx2 }
        {assign var='view' value='grid'}
    {elseif}
          {assign var='view' value='grid'}  
    {if}
    

    then in   product-list.tpl

    <div {if isset($id) && $id} id="{$id}"{/if} class="display-items product_list product-list grid row{if isset($class) && $class} {$class}{/if} calc-items">
    

    remove the default view "grid" add the variable  view

     

    the code will be like

    <div {if isset($id) && $id} id="{$id}"{/if} class="display-items product_list product-list  row   {if isset($view) && $view} {$view}{/if}    {if isset($class) && $class} {$class}{/if} calc-items">
    
  3.  

    But the short description shows on the product list but not the product.tpl (the product itself) If u check any product on my page there is no short description there.

     

    How can it be in the css file? isnt it in the tpl file?

     

    And my line 452 shows this:

     

      
    vertical-align: middle;
        text-align: center;
        position: relative; }
        ul.product_base_list.table li.base_product .product-container .right-block h5 {
          width: 40%;

    line 302

    pb-center-column #short_description_block {

    margin-top10px;

    margin-bottom20px;

    displaynone;}

     

    remove display:none

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More