Jump to content
Latest News: (loading..)
vampirehunter

Bootstrap Home Page Carousel Banner Slider Module Plugin Complete - Testing Welcome

Recommended Posts

There are a number of Addons that allow you to hide one or more categories. I don't remember if there is one for the Bootstrap versions, but one that works for standard 2.3.4 should also work for Bootstrap.

 

You could automate this by using the products_to_categories table in the database. If there is no entry for a given categories_id, then there are no products in that category. You could also join the categories table in the SQL you are using to the products_to_categories table, as the join will automatically exclude any cases where a categories_id is not present in both tables.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

There are a number of Addons that allow you to hide one or more categories. I don't remember if there is one for the Bootstrap versions, but one that works for standard 2.3.4 should also work for Bootstrap.

 

You could automate this by using the products_to_categories table in the database. If there is no entry for a given categories_id, then there are no products in that category. You could also join the categories table in the SQL you are using to the products_to_categories table, as the join will automatically exclude any cases where a categories_id is not present in both tables.

 

Regards

Jim

 

Thanks, Jim.

 

I took your suggestion and wrote a bit of code. This is the entire function from the includes/functions/general.php file. I added comments to show what I changed...

function tep_build_category_info_array() {
    function bci_get_paths($categories_array = '', $parent_id = 0, $level = 0, $path='') {
      global $languages_id;
      if (!is_array($categories_array)) $categories_array = array();
      
      //I changed this...
      //$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");
       
      //To this...
      $categories_query = tep_db_query("select c.categories_id, cd.categories_name, p2c.categories_id, p2c.products_id, p.products_id, p.products_status from " . TABLE_CATEGORIES . " c left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on c.categories_id = p2c.categories_id left join " . TABLE_PRODUCTS . " p on p2c.products_id = p.products_id, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p2c.products_id <> '' and p.products_status <> '0' and parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");
      
      
      
      while ($categories = tep_db_fetch_array($categories_query)) {
        if (SHOW_COUNTS == 'true') {
          $count_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = " . (int)$categories['categories_id']);
          $products = tep_db_fetch_array($count_query);
          $count = $products['total'];
        } else {
          $count = 0;
        }
    	  $categories_array[$categories['categories_id']] = array('name' => $categories['categories_name'],
                                  'path' => $path . $categories['categories_id'],
                                  'id' => $categories['categories_id'],
                                  'indent' => str_repeat('  ', $level),
                                  'level' => $level,
                                  'has_subcat' => false,
                                  'prod_count' => $count,
                                  'parent' => $parent_id,
                                  'direct_children' => array(),
                                  'all_children' => array(),
                                  'with_children' => array($categories['categories_id']));
        $categories_array[$parent_id]['has_subcat'] = true;
        $categories_array[$parent_id]['direct_children'][] = $categories['categories_id'];
        if ($categories['categories_id'] != $parent_id) {
          $categories_array = bci_get_paths($categories_array, $categories['categories_id'], $level + 1, $path . $categories['categories_id'] . '_');
        }
      }
      return $categories_array;
    } // end bci_get_paths

    $cat_array = bci_get_paths();
    unset($cat_array[0]);
    foreach ($cat_array as $cat) {
      $parent = $cat['parent'];
      while ($parent > 0 ) {
        // add category product count to parent category product counts
        $cat_array[$parent]['prod_count'] += $cat['prod_count'];
        // build all_children and with_children arrays
        $cat_array[$parent]['all_children'][] = $cat['id'];
        $cat_array[$parent]['with_children'][] = $cat['id'];
        $parent = $cat_array[$parent]['parent'];
      }
    }
    return $cat_array;
  } // end tep_build_category_info_array

This seems to work great, but only for the main categories. I don't know how to make it look in the subcategories to find products. For example, I have a category called wheels. Inside that I have a subcategory called hubcaps. The wheels category will only show up if I have a product directly inside of it. It doesn't matter that I have a product in the hubcaps category; it doesn't look for that and the whole tree gets hidden if it doesn't find a product in the wheels category.

 

Can you please help point me in the right direction?

 

Thanks,

Randy 

Share this post


Link to post
Share on other sites

You have a function inside a function:

function tep_build_category_info_array() {
    function bci_get_paths($categories_array = '', $parent_id = 0, $level = 0, $path='') {

That can't possibly work. Getting rid of that, your SQL does exactly what you said you wanted: if removes all categories that have no products. Apparently what you really wanted is to remove all categories that have no products or subcategories. That's quite a bit harder to do.

 

I suggest that you go find an addon that is designed to hide categories. I remember there being several of those.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

You have a function inside a function:

function tep_build_category_info_array() {
    function bci_get_paths($categories_array = '', $parent_id = 0, $level = 0, $path='') {

That can't possibly work. Getting rid of that, your SQL does exactly what you said you wanted: if removes all categories that have no products. Apparently what you really wanted is to remove all categories that have no products or subcategories. That's quite a bit harder to do.

 

I suggest that you go find an addon that is designed to hide categories. I remember there being several of those.

 

Regards

Jim

 

Thanks. That function inside of a function is part of the Enhanced Categories Box addon. I didn't write it; I only added it to my store. And it works fine. It just doesn't offer the "hide the category if it has no products or subcategories with products in it". I'm just trying to make this feature a little bit more useful for what I would like my store to do. That's all. 

 

And, yes, there are several addons that hide categories with no products. But I haven't found any that work with Bootstrap 2.3.4. I'm sorry to have bothered you. My apologies.

 

Randy

Edited by randyroy

Share this post


Link to post
Share on other sites

You're not bothering me. I'm trying to help, but the result that you want is not simple and would take some thought.

 

Any Addon for osC 2.3.4 can be made to work with the Bootstrap versions. Addons that just modify SQL, such as to block certain categories, are the easiest to adapt. Take a look and see what you come up with.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

There is no Add-on to Hide Categories for Bootstrap? a relay Important requirement, As an Old OsC user and Store owner I thing oscommerce goes away from the Good Old free times ...V2.2 and V2.3 after BS everything good and important have to be paid!

Edited by Pelvis

Share this post


Link to post
Share on other sites

LOL, you know those products that you'll have on your shop...will you be giving those away for free?

 

@@Pelvis


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

There is no Add-on to Hide Categories for Bootstrap? a relay Important requirement, As an Old OsC user and Store owner I thing oscommerce goes away from the Good Old free times ...V2.2 and V2.3 after BS everything good and important have to be paid!

 

To move osCommerce forward, we need to attract talented developers. How to do that? Make it rewarding for them to work. Their love of osCommerce can only go so far, so if developers can make money from their efforts they are far more likely to stick around. Your support, by buying addons or getting developers to do work on your site, helps immensely no matter how small.

 

If osCommerce is good to you, put something back. If funds are tight, ask how you can help. Every little bit helps.


Let's make things easier for new osCommerce users http://forums.oscommerce.com/topic/402638-discussion-about-hard-coded-database-tables/?p=1718900  Getting there with osCommerce 2.4! :thumbsup:

Share this post


Link to post
Share on other sites

Hi,

Thank you for this add-on... Great.

I had the famous deprecated constructor with PHP7.

===========================
I change this line :

    function cm_carousel() {
 

For this line :

    function __construct() {

===========================

No more error... 

Is anybody found how to change the height of the carousel ?

I tried some setting in user.css and the file cm.carousel.php but no Cigar !!!

Cheers.


John

--------------------

osCommerce 2.3.4 Bootstrap Edge

Share this post


Link to post
Share on other sites


 

tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Banner Rotator Max Banners', 'MODULE_FRONT_PAGE_BANNER_ROTATOR_MAX_DISPLAY', '5', 'Maximum number of banners that the Banner Rotator will show', '6', '0', now())");
    }

I am trying to increase the number of banners that show,  it looks like the max was set to four,  I have 5. tried increasing here -no luck

'MODULE_FRONT_PAGE_BANNER_ROTATOR_MAX_DISPLAY', '5',

thanks 

zpupster

Edited by zpupster

Share this post


Link to post
Share on other sites

Hi all,

I created and installed all three files told here but it is not working on my edge version.

Is that ALL I need, just these there files, I can see the module in the admin area and I can edit the module in admin but no banner shows up in the front page! Do I need to install any other files like the full module from the add on area or just the three files are enough!

Many thanks in advance

Mitchell

 

Share this post


Link to post
Share on other sites

I have banner_rotator.php v1.1.2 20110108 Kymation installed

However, I would like it to feed from the left instead of feed from the right.

Can I change this?


Not too experienced, but very willing to learn.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×