Jump to content
Sign in to follow this  
YePix

Nivo Slider & Categories

Recommended Posts

Hi folks, i need an approach for my idea. It is the Nivo Slider module.

I would like certain banner groups to be displayed only if the corresponding category is also activated. Does anyone have some info for me that could help me realize it?

Share this post


Link to post
Share on other sites

In the table categories I added a new field "categories_slide_group".

How do I get this now to hide the slidegroup if this is the same as the one in the table "s.lindex_slides_group" All other groups should be displayed further.

 

    private function get_lindex_slides_data() {
      global $languages_id;
	  
	// select banners_group to be used
     $new_banner_search = '';
     if (MODULE_CONTENT_LINDEX_NIVO_SLIDER_GROUP != '') {	
       $selected_banners = explode(':', MODULE_CONTENT_LINDEX_NIVO_SLIDER_GROUP);
       $size = sizeof($selected_banners);
      if ($size == 1) {
        $new_banner_search .= " lindex_slides_group = '" . trim($selected_banners[0]) . "'"; // elimino espacios al principio y al final.
       } else {
        for ($i=0, $n=$size; $i<$n; $i+=1) {
          $new_banner_search .= " lindex_slides_group = '" . trim($selected_banners[$i]) . "'"; // elimino espacios al principio y al final.
           if ($i+1 < $n) {
            $new_banner_search .= ' or ';
           }
        }
       }
	
        if ($new_banner_search != '') {
         $new_banner_search = ' and (' . $new_banner_search . ')';
        } 
     } 

   	$lindex_slides_query_raw = tep_db_query("select 
   	                                         s.lindex_slides_id, s.lindex_slides_url, s.lindex_slides_image, s.lindex_slides_group,
   	                                         sd.lindex_slides_title, sd.lindex_slides_description,
   	                                         c.categories_id, c.categories_slide_group
   	                                         from lindex_slides s, lindex_slides_description sd, categories c
   	                                         where status = 1 " . $new_banner_search . " and s.lindex_slides_id = sd.lindex_slides_id and sd.language_id = '" . (int)$languages_id . "' and s.lindex_slides_group = c.categories_slide_group order by rand() limit " . MODULE_CONTENT_LINDEX_NIVO_SLIDER_LIMIT);

      return $lindex_slides_query_raw;
    }

 

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
Sign in to follow this  

×