Jump to content

Edit History

loulou66

loulou66

HI

here's the solution for PS 1.6.x.x

1°) file /modules/blocklayered/blocklayered.php into fonction function getFilterBlock()

line 2679 replace :
case 'category':
    $tmp_array = array();
    if (isset($products) && $products)
    {
        $categories_with_products_count = 0;
        foreach ($products as $category)
        {
            $tmp_array[$category['id_category']] = array(
                'name' => $category['name'],
                'nbr' => (int)$category['count_products']
            );

            if ((int)$category['count_products'])
                $categories_with_products_count++;

            if (isset($selected_filters['category']) && in_array($category['id_category'], $selected_filters['category']))
                $tmp_array[$category['id_category']]['checked'] = true;
        }
        if ($categories_with_products_count || !Configuration::get('PS_LAYERED_HIDE_0_VALUES'))
            $filter_blocks[] = array (
                'type_lite' => 'category',
                'type' => 'category',
                'id_key' => 0, 'name' => $this->l('Categories'),
                'values' => $tmp_array,
                'filter_show_limit' => $filter['filter_show_limit'],
                'filter_type' => $filter['filter_type']
            );
    }
    break;

by :
case 'category':
    $tmp_array = array();
    $tmp_prod = $products;
    foreach ($products as &$category) {
        foreach ($tmp_prod as $cat) {
            if ($cat['id_category'] == $category['id_parent']) {
                $category['isChildren'] = true;
            }
        }
    }
    if (isset($products) && $products)
    {
        $categories_with_products_count = 0;
        foreach ($products as &$category)
        {
            $tmp_array[$category['id_category']] = array(
                'name' => $category['name'],
                'nbr' => (int)$category['count_products']
            );

            if ((int)$category['count_products'])
                $categories_with_products_count++;

            if (isset($selected_filters['category']) && in_array($category['id_category'], $selected_filters['category']))
                $tmp_array[$category['id_category']]['checked'] = true;
            if (isset($category['isChildren']))
                $tmp_array[$category['id_category']]['isChildren'] = true;
        }
        if ($categories_with_products_count || !Configuration::get('PS_LAYERED_HIDE_0_VALUES'))
            $filter_blocks[] = array (
                'type_lite' => 'category',
                'type' => 'category',
                'id_key' => 0, 'name' => $this->l('Categories'),
                'values' => $tmp_array,
                'filter_show_limit' => $filter['filter_show_limit'],
                'filter_type' => $filter['filter_type']
            );
    }
    break;

2°) File /themes/theme/modules/blocklayered/blocklayered.tpl

Replace :
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if} col-lg-12">
by:
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if} {if isset($value.isChildren) && $value.isChildren}isChildren{/if} col-lg-12">

and Replace :
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if}">
by :
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if} {if isset($value.isChildren) && $value.isChildren}isChildren{/if}">

3°) File /themes/theme/css/modules/blocklayered/blocklayered.css

Add :
#layered_block_left ul li.isChildren {
    padding-left: 20px;
}

4°) clear all cache PS and Browser

5°) Enjoy

@++ Loulou66

loulou66

loulou66

HI

here's the solution for PS 1.6.x.x

1°) file /modules/blocklayered/blocklayered.php into fonction function getFilterBlock()

line 2679 replace :
case 'category':
    $tmp_array = array();
    if (isset($products) && $products)
    {
        $categories_with_products_count = 0;
        foreach ($products as $category)
        {
            $tmp_array[$category['id_category']] = array(
                'name' => $category['name'],
                'nbr' => (int)$category['count_products']
            );

            if ((int)$category['count_products'])
                $categories_with_products_count++;

            if (isset($selected_filters['category']) && in_array($category['id_category'], $selected_filters['category']))
                $tmp_array[$category['id_category']]['checked'] = true;
        }
        if ($categories_with_products_count || !Configuration::get('PS_LAYERED_HIDE_0_VALUES'))
            $filter_blocks[] = array (
                'type_lite' => 'category',
                'type' => 'category',
                'id_key' => 0, 'name' => $this->l('Categories'),
                'values' => $tmp_array,
                'filter_show_limit' => $filter['filter_show_limit'],
                'filter_type' => $filter['filter_type']
            );
    }
    break;

by :
case 'category':
    $tmp_array = array();
    $tmp_prod = $products;
    foreach ($products as &$category) {
        foreach ($tmp_prod as $cat) {
            if ($cat['id_category'] == $category['id_parent']) {
                $category['isChildren'] = true;
            }
        }
    }
    if (isset($products) && $products)
    {
        $categories_with_products_count = 0;
        foreach ($products as $category)
        {
            $tmp_array[$category['id_category']] = array(
                'name' => $category['name'],
                'nbr' => (int)$category['count_products']
            );

            if ((int)$category['count_products'])
                $categories_with_products_count++;

            if (isset($selected_filters['category']) && in_array($category['id_category'], $selected_filters['category']))
                $tmp_array[$category['id_category']]['checked'] = true;
            if (isset($category['isChildren']))
                $tmp_array[$category['id_category']]['isChildren'] = true;
        }
        if ($categories_with_products_count || !Configuration::get('PS_LAYERED_HIDE_0_VALUES'))
            $filter_blocks[] = array (
                'type_lite' => 'category',
                'type' => 'category',
                'id_key' => 0, 'name' => $this->l('Categories'),
                'values' => $tmp_array,
                'filter_show_limit' => $filter['filter_show_limit'],
                'filter_type' => $filter['filter_type']
            );
    }
    break;

2°) File /themes/theme/modules/blocklayered/blocklayered.tpl

Replace :
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if} col-lg-12">
by:
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if} {if isset($value.isChildren) && $value.isChildren}isChildren{/if} col-lg-12">

and Replace :
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if}">
by :
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if} {if isset($value.isChildren) && $value.isChildren}isChildren{/if}">

3°) File /themes/theme/css/modules/blocklayered/blocklayered.css

Add :
#layered_block_left ul li.isChildren {
    padding-left: 20px;
}

4°) clear all cache PS and Browser

5°) Enjoy

@++ Loulou66

loulou66

loulou66

HI

here's the solution for PS 1.6.x.x1°) file /modules/blocklayered/blocklayered.php into fonction function getFilterBlock()

line 2679 replace :
case 'category':
    $tmp_array = array();
    if (isset($products) && $products)
    {
        $categories_with_products_count = 0;
        foreach ($products as $category)
        {
            $tmp_array[$category['id_category']] = array(
                'name' => $category['name'],
                'nbr' => (int)$category['count_products']
            );

            if ((int)$category['count_products'])
                $categories_with_products_count++;

            if (isset($selected_filters['category']) && in_array($category['id_category'], $selected_filters['category']))
                $tmp_array[$category['id_category']]['checked'] = true;
        }
        if ($categories_with_products_count || !Configuration::get('PS_LAYERED_HIDE_0_VALUES'))
            $filter_blocks[] = array (
                'type_lite' => 'category',
                'type' => 'category',
                'id_key' => 0, 'name' => $this->l('Categories'),
                'values' => $tmp_array,
                'filter_show_limit' => $filter['filter_show_limit'],
                'filter_type' => $filter['filter_type']
            );
    }
    break;

by :
case 'category':
    $tmp_array = array();
    $tmp_prod = $products;
    foreach ($products as &$category) {
        foreach ($tmp_prod as $cat) {
            if ($cat['id_category'] == $category['id_parent']) {
                $category['isChildren'] = true;
            }
        }
    }
    if (isset($products) && $products)
    {
        $categories_with_products_count = 0;
        foreach ($products as $category)
        {
            $tmp_array[$category['id_category']] = array(
                'name' => $category['name'],
                'nbr' => (int)$category['count_products']
            );

            if ((int)$category['count_products'])
                $categories_with_products_count++;

            if (isset($selected_filters['category']) && in_array($category['id_category'], $selected_filters['category']))
                $tmp_array[$category['id_category']]['checked'] = true;
            if (isset($category['isChildren']))
                $tmp_array[$category['id_category']]['isChildren'] = true;
        }
        if ($categories_with_products_count || !Configuration::get('PS_LAYERED_HIDE_0_VALUES'))
            $filter_blocks[] = array (
                'type_lite' => 'category',
                'type' => 'category',
                'id_key' => 0, 'name' => $this->l('Categories'),
                'values' => $tmp_array,
                'filter_show_limit' => $filter['filter_show_limit'],
                'filter_type' => $filter['filter_type']
            );
    }
    break;

2°) File /themes/theme/modules/blocklayered/blocklayered.tpl

Replace :
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if} col-lg-12">
by:
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if} {if isset($value.isChildren) && $value.isChildren}isChildren{/if} col-lg-12">

and Replace :
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if}">
by :
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if} {if isset($value.isChildren) && $value.isChildren}isChildren{/if}">

3°) File /themes/theme/css/modules/blocklayered/blocklayered.css

Add :
#layered_block_left ul li.isChildren {
    padding-left: 20px;
}

4°) clear all cache PS and Browser

5°) Enjoy

@++ Loulou66

loulou66

loulou66

HI

here's the solution for PS 1.6.x.x1°) file /modules/blocklayered/blocklayered.php into fonction function getFilterBlock()

ine 2679 replace :
case 'category':
    $tmp_array = array();
    if (isset($products) && $products)
    {
        $categories_with_products_count = 0;
        foreach ($products as $category)
        {
            $tmp_array[$category['id_category']] = array(
                'name' => $category['name'],
                'nbr' => (int)$category['count_products']
            );

            if ((int)$category['count_products'])
                $categories_with_products_count++;

            if (isset($selected_filters['category']) && in_array($category['id_category'], $selected_filters['category']))
                $tmp_array[$category['id_category']]['checked'] = true;
        }
        if ($categories_with_products_count || !Configuration::get('PS_LAYERED_HIDE_0_VALUES'))
            $filter_blocks[] = array (
                'type_lite' => 'category',
                'type' => 'category',
                'id_key' => 0, 'name' => $this->l('Categories'),
                'values' => $tmp_array,
                'filter_show_limit' => $filter['filter_show_limit'],
                'filter_type' => $filter['filter_type']
            );
    }
    break;

by :
case 'category':
    $tmp_array = array();
    $tmp_prod = $products;
    foreach ($products as &$category) {
        foreach ($tmp_prod as $cat) {
            if ($cat['id_category'] == $category['id_parent']) {
                $category['isChildren'] = true;
            }
        }
    }
    if (isset($products) && $products)
    {
        $categories_with_products_count = 0;
        foreach ($products as $category)
        {
            $tmp_array[$category['id_category']] = array(
                'name' => $category['name'],
                'nbr' => (int)$category['count_products']
            );

            if ((int)$category['count_products'])
                $categories_with_products_count++;

            if (isset($selected_filters['category']) && in_array($category['id_category'], $selected_filters['category']))
                $tmp_array[$category['id_category']]['checked'] = true;
            if (isset($category['isChildren']))
                $tmp_array[$category['id_category']]['isChildren'] = true;
        }
        if ($categories_with_products_count || !Configuration::get('PS_LAYERED_HIDE_0_VALUES'))
            $filter_blocks[] = array (
                'type_lite' => 'category',
                'type' => 'category',
                'id_key' => 0, 'name' => $this->l('Categories'),
                'values' => $tmp_array,
                'filter_show_limit' => $filter['filter_show_limit'],
                'filter_type' => $filter['filter_type']
            );
    }
    break;

2°) File /themes/theme/modules/blocklayered/blocklayered.tpl

Replace :
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if} col-lg-12">
by:
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if} {if isset($value.isChildren) && $value.isChildren}isChildren{/if} col-lg-12">

and Replace :
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if}">
by :
<li class="nomargin {if $smarty.foreach.fe.index >= $filter.filter_show_limit}hiddable{/if} {if isset($value.isChildren) && $value.isChildren}isChildren{/if}">

3°) File /themes/theme/css/modules/blocklayered/blocklayered.css

Add :
#layered_block_left ul li.isChildren {
    padding-left: 20px;
}

4°) clear all cache PS and Browser

5°) Enjoy

@++ Loulou66

×
×
  • Create New...