Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How To Limit Popular Brands Block? Rate Topic   * * * * * 1 votes

 
  • P-Pharma
  • Junior Member
  • Members
  • Join Date: 30-Jun 10
  • 1138 posts

Posted 01 June 2015 - 05:32 PM #1

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.

 
  • panto
  • Member
  • Members
  • Join Date: 14-Aug 11
  • 30 posts

Posted 01 June 2015 - 06:04 PM #2

i use this addon and i am very happy.
https://www.hungrywe...s-carousel.html
www.singular.com.cy
www.xpcpro.com

 
  • Cart-Power
  • Senior Member
  • Authorized Reseller
  • Join Date: 12-May 14
  • 1631 posts

Posted 01 June 2015 - 06:24 PM #3

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.


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.
Cart-Power.com / Cart-Power.ru (sales@cart-power.com) offers you:
CS-Cart add-ons :: CS-Cart themes :: CS-Cart development :: CS-Cart license
Работаем с англоязычными и русскоязычными клиентами (work with English-speaking and Russian-speaking customers)

 
  • panto
  • Member
  • Members
  • Join Date: 14-Aug 11
  • 30 posts

Posted 01 June 2015 - 06:57 PM #4

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.
www.singular.com.cy
www.xpcpro.com

 
  • P-Pharma
  • Junior Member
  • Members
  • Join Date: 30-Jun 10
  • 1138 posts

Posted 02 June 2015 - 12:01 AM #5

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!