How To Limit Popular Brands Block?

The popular brands blocks shows icons of our brands on our homepage. 7 icons on first load and then you can scroll for more.

The block loads icons for all our 135 brands. This significantly increases page load time. Is there anyway to limit this? No one is going to scroll through all those brands so there is no need to load all those icons.

i use this addon and i am very happy.

https://www.hungryweb.net/cs-cart-addons/custom-manufacturers-brands-carousel.html

[quote]

The popular brands blocks shows icons of our brands on our homepage. 7 icons on first load and then you can scroll for more.

The block loads icons for all our 135 brands. This significantly increases page load time. Is there anyway to limit this? No one is going to scroll through all those brands so there is no need to load all those icons.

[/quote]



For CS-Cart 4.3.1:


  1. Open app/functions/fn.catalog.php
  2. Find “function fn_get_all_brands()”
  3. Add “array_splice($variants, 7);” before “return $variants;”



function fn_get_all_brands()
{
$params = array(
'exclude_group' => true,
'get_descriptions' => true,
'feature_types' => array(ProductFeatures::EXTENDED),
'variants' => true,
'plain' => true,
);

list($features) = fn_get_product_features($params, 0);

$variants = array();

foreach ($features as $feature) {
$variants = array_merge($variants, $feature['variants']);
}

array_splice($variants, 7);

return $variants;
}




You will get only 7 brands in this block.



I hope it helped.

Hello again,



That's a good solution to play around it by Cart-Power, but just don't forget that with the addon you can choose which manufacturers to show and by which order you want them to be.

Brands have a sort order. Combining sort order with a limit will allow me to select which brands to show, in which order and how many. And all without adding another addon, so thats preferable. Thanks Leonid!