Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Featured Listing Not displaying on Product Listing Page

Featured Listing Not displaying on Product Listing Page

Views: 3,019

Results 1 to 20 of 25
18 Aug 2015, 1:58 AM
#1
cyberfolli avatar

cyberfolli

New Zenner

Join Date:
Sep 2010
Posts:
64
Plugin Contributions:
0

Featured Listing Not displaying on Product Listing Page

I am using the mars template. I have double checked the settings in config >> indexlisting ----- See Attachement .

this is the code below I can't see the difference between the stock code and this ?

<?php
    if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_LISTING_BELOW_FEATURED_PRODUCTS') { ?>
<?php
/**
 * display the Featured Products Center Box
 */
?>
<?php require($template->get_template_dir('tpl_modules_featured_products.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_featured_products.php'); ?>
<?php } ?>

<?php
    if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_LISTING_BELOW_SPECIALS_PRODUCTS') { ?>
<?php
/**
 * display the Special Products Center Box
 */
?>
<?php require($template->get_template_dir('tpl_modules_specials_default.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_specials_default.php'); ?>
<?php } ?>

<?php
    if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_LISTING_BELOW_NEW_PRODUCTS') { ?>
<?php
/**
 * display the New Products Center Box
 */
?>
<?php require($template->get_template_dir('tpl_modules_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_whats_new.php'); ?>
<?php } ?>

<?php
    if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_LISTING_BELOW_UPCOMING') {
      include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS));
    }
?>
<?php
  $show_display_category->MoveNext();
  } // !EOF
?>

<?php
} //// eof: categories
?>

</div>
18 Aug 2015, 2:18 AM
#2
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Featured Listing Not displaying on Product Listing Page

A link to your site will be useful.

Cheers
RodG

18 Aug 2015, 4:49 PM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,081
Plugin Contributions:
56

Re: Featured Listing Not displaying on Product Listing Page

Do you have any products configured in Catalog->Featured Products? The "Featured Products" block will only display if there is one or more ***active ***featured product.

19 Aug 2015, 1:50 PM
#4
cyberfolli avatar

cyberfolli

New Zenner

Join Date:
Sep 2010
Posts:
64
Plugin Contributions:
0

Re: Featured Listing Not displaying on Product Listing Page

lat9:

Do you have any products configured in Catalog->Featured Products? The "Featured Products" block will only display if there is one or more ***active ***featured product.

Yes I have Made Sure this works. If you click on the featured products link it displays the products. But It doesn't work when you look for the display on the products listing page.

19 Aug 2015, 1:57 PM
#5
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,081
Plugin Contributions:
56

Re: Featured Listing Not displaying on Product Listing Page

Echoing RodG's request: a link to the site in question would help us help you!

19 Aug 2015, 5:17 PM
#7
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Featured Listing Not displaying on Product Listing Page

Try switching to the classic template
If this displays correctly then it is in your template files

19 Aug 2015, 5:50 PM
#8
cyberfolli avatar

cyberfolli

New Zenner

Join Date:
Sep 2010
Posts:
64
Plugin Contributions:
0

Re: Featured Listing Not displaying on Product Listing Page

kobra:

Try switching to the classic template
If this displays correctly then it is in your template files

I did switch up . I also tried the stock code on that specific page and no dice!.

That is why I am really confused on why it's not showing. Are my settings wrong? is there a specific setting in the admin that I am missing that should control the availability of that specific page?

I am not worried about the homepage just the product listings

20 Aug 2015, 11:48 AM
#9
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,081
Plugin Contributions:
56

Re: Featured Listing Not displaying on Product Listing Page

The "Featured Products" block shows up on product-listing pages (like the one you indicated was showing "correctly")*** if and only if*** the currently-displayed category has any featured products defined.

20 Aug 2015, 12:35 PM
#10
cyberfolli avatar

cyberfolli

New Zenner

Join Date:
Sep 2010
Posts:
64
Plugin Contributions:
0

Re: Featured Listing Not displaying on Product Listing Page

lat9:

The "Featured Products" block shows up on product-listing pages (like the one you indicated was showing "correctly")*** if and only if*** the currently-displayed category has any featured products defined.

Yes that is why i was showing the featured products listed here.

http://www.aurumjewelers.net/index.php?main_page=featured_products

then the category they are listed under here

http://www.aurumjewelers.net/bracelets/chrysalis

20 Aug 2015, 2:00 PM
#11
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,081
Plugin Contributions:
56

Re: Featured Listing Not displaying on Product Listing Page

Hmm, what happens if you temporarily disable your URL rewriting plugin? Does the Featured Products box show then?

20 Aug 2015, 2:17 PM
#12
cyberfolli avatar

cyberfolli

New Zenner

Join Date:
Sep 2010
Posts:
64
Plugin Contributions:
0

Re: Featured Listing Not displaying on Product Listing Page

lat9:

Hmm, what happens if you temporarily disable your URL rewriting plugin? Does the Featured Products box show then?

Yep nothing changes

I don't understand why new items are showing at the bottom? Why would they show up? The code is similar just relying on a different code .

21 Aug 2015, 3:35 AM
#13
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Featured Listing Not displaying on Product Listing Page

cyberfolli:

Yep nothing changes

I don't understand why new items are showing at the bottom? Why would they show up? The code is similar just relying on a different code .

OK, so lets take a look at the different code. Please post the contents of the file

/includes/templates/YOUR_TEMPLATE/templates/tpl_modules_featured_products.php

Cheers
RodG

24 Aug 2015, 2:05 PM
#14
cyberfolli avatar

cyberfolli

New Zenner

Join Date:
Sep 2010
Posts:
64
Plugin Contributions:
0

Re: Featured Listing Not displaying on Product Listing Page

[QUOTE=RodG;1290272]OK, so lets take a look at the different code. Please post the contents of the file

/includes/templates/YOUR_TEMPLATE/templates/tpl_modules_featured_products.php

<?php
/**
 * Module Template
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_modules_featured_products.php 2935 2006-02-01 11:12:40Z birdbrain $
 */
  $zc_show_featured = false;
  include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_FEATURED_PRODUCTS_MODULE));
?>

<!-- bof: featured products  -->
<?php 
	$sum = 0;
	for($row=0;$row<sizeof($list_box_contents);$row++) {
		for($col=0;$col<sizeof($list_box_contents[$row]);$col++) {		
			if (isset($list_box_contents[$row][$col]['text'])) {
			 $sum ++;
			}    
		}
	}
	
	if ($zc_show_featured == true){
		if ($sum > $homepage_options->fields['homepage_featured_products_hide_below']) { ?>
			<div class="centerBoxWrapper" id="featuredProducts">
				<?php
				/**
				 * require the list_box_content template to display the product
				 */
				  require($template->get_template_dir('tpl_columnar_display.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_columnar_display.php');
				?>
			</div>
<?php 
		} 
	}	
?>
<!-- eof: featured products  -->
25 Aug 2015, 1:28 AM
#15
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Featured Listing Not displaying on Product Listing Page

Sorry, but I think we need to dig a little deeper still.

please post the contents of
/includes/modules/YOUR_TEMPLATE/featured_products.php

Thnks
RodG

25 Aug 2015, 12:12 PM
#16
cyberfolli avatar

cyberfolli

New Zenner

Join Date:
Sep 2010
Posts:
64
Plugin Contributions:
0

Re: Featured Listing Not displaying on Product Listing Page

<?php
/**
 * featured_products module - prepares content for display
 *
 * @package modules
 * @copyright Copyright 2003-2007 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: featured_products.php 6424 2007-05-31 05:59:21Z ajeh $
 */
if (!defined('IS_ADMIN_FLAG')) {
  die('Illegal Access');
}

// initialize vars
$categories_products_id_list = '';
$list_of_products = '';
$featured_products_query = '';
$display_limit = '';

if ( (($manufacturers_id > 0 && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > 0 || $_GET['record_company_id'] > 0) || (!isset($new_products_category_id) || $new_products_category_id == '0') ) {
  $featured_products_query = "select distinct p.products_id, p.products_image, pd.products_name, p.master_categories_id
                           from (" . TABLE_PRODUCTS . " p
                           left join " . TABLE_FEATURED . " f on p.products_id = f.products_id
                           left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
                           where p.products_id = f.products_id
                           and p.products_id = pd.products_id
                           and p.products_status = 1 and f.status = 1
                           and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
} else {
  // get all products and cPaths in this subcat tree
  $productsInCategory = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $display_limit);

  if (is_array($productsInCategory) && sizeof($productsInCategory) > 0) {
    // build products-list string to insert into SQL query
    foreach($productsInCategory as $key => $value) {
      $list_of_products .= $key . ', ';
    }
    $list_of_products = substr($list_of_products, 0, -2); // remove trailing comma
    $featured_products_query = "select distinct p.products_id, p.products_image, pd.products_name, p.master_categories_id
                                from (" . TABLE_PRODUCTS . " p
                                left join " . TABLE_FEATURED . " f on p.products_id = f.products_id
                                left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id)
                                where p.products_id = f.products_id
                                and p.products_id = pd.products_id
                                and p.products_status = 1 and f.status = 1
                                and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                                and p.products_id in (" . $list_of_products . ")";
  }
}
if ($featured_products_query != '') $featured_products = $db->ExecuteRandomMulti($featured_products_query, MAX_DISPLAY_SEARCH_RESULTS_FEATURED);

$row = 0;
$col = 0;
$list_box_contents = array();
$title = '';

$num_products_count = ($featured_products_query == '') ? 0 : $featured_products->RecordCount();

// show only when 1 or more
if ($num_products_count > 0) {
  switch (SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS) {
    case 1: $col_width = 'col_12_of_12'; break;
    case 2: $col_width = 'col_1_of_2'; break;
    case 3: $col_width = 'col_1_of_3'; break;  
    case 4: $col_width = 'col_1_of_4'; break;  
    case 5: $col_width = 'col_1_of_5'; break; 
    case 6: $col_width = 'col_1_of_6'; break;
    case 7: $col_width = 'col_1_of_7'; break;
    case 8: $col_width = 'col_1_of_8'; break;  
    case 9: $col_width = 'col_1_of_9'; break;
    case 10: $col_width = 'col_1_of_10'; break;
        
    default: $col_width = 'col_12_of_12'; break;
  }
  
  $currentListingPage = "featuredProducts";

  while (!$featured_products->EOF) {
    $products_price = zen_get_products_display_price_mars($featured_products->fields['products_id']);
    if (!isset($productsInCategory[$featured_products->fields['products_id']])) $productsInCategory[$featured_products->fields['products_id']] = zen_get_generated_category_path_rev($featured_products->fields['master_categories_id']);

    $featured_product_carousel_class = ($homepage_options->fields['homepage_featured_products_display'] == 1) ? 'centerBoxContentsFeatured' : 'centerBoxContentsFeatured col '.$col_width;

    $link = '<a href="' . zen_href_link(FILENAME_PRODUCTS_ALL, zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT) . '</a> ';
    $buy_now_button = ($homepage_options->fields['homepage_featured_products_buy_now_button_display'] == 1) ? '<div class="buyNowCont">'.$link.'</div>' : '';

    // Effect 1
    if($homepage_options->fields['homepage_featured_products_hover_effect'] == 1){
      $list_box_contents[$row][$col] = array(
        'params' => 'class="'.$featured_product_carousel_class.'"',
        'text' => (($featured_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a class="listingProductLink" href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '</a><br />') . '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . $featured_products->fields['products_name'] . '</a></h3><br /><span class="price">' . $products_price.'</span>'.$buy_now_button
      );

      $sliderEffect = 'featured_he_1';
    }
    
    // Effect 2
    if($homepage_options->fields['homepage_featured_products_hover_effect'] == 2){
      $list_box_contents[$row][$col] = array(
        'params' => 'class="'.$featured_product_carousel_class.'"',      
        'text' => '
          <div class="productStyle_2">
            ' . zen_image(DIR_WS_IMAGES . $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '
            <a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">
              <div class="info">
                <h4>' . $featured_products->fields['products_name'] . '</h4>
                <h6>' . $products_price.'</span></h6>
              </div>
            </a>
          </div>          
        '      
      );

      $sliderEffect = 'featured_he_2';
    }

    // Effect 3
    if($homepage_options->fields['homepage_featured_products_hover_effect'] == 3){
      $list_box_contents[$row][$col] = array(
        'params' => 'class="'.$featured_product_carousel_class.'"',              
        'text' => '          
          <figure class="productStyle_3">
            ' . zen_image(DIR_WS_IMAGES . $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '
            <figcaption>
              <a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '"><h4>' . $featured_products->fields['products_name'] . '</h4></a>
              <h6>' . $products_price.'</h6>
              <div class="button_cont">'.$buy_now_button.'</div>
            </figcaption>
          </figure>      
        '
      );

      $sliderEffect = 'featured_he_3';
    }

    // Effect 4
    if($homepage_options->fields['homepage_featured_products_hover_effect'] == 4){
      $list_box_contents[$row][$col] = array(
        'params' => 'class="'.$featured_product_carousel_class.'"',      
        'text' => '          
          <figure class="productStyle_4">
            <a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '</a>
            <figcaption>
              <h4><a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . $featured_products->fields['products_name'] . '</a></h4>
              <h6>' . $products_price.'</h6>            
            </figcaption>
          </figure>            
        '
      );

      $sliderEffect = 'featured_he_4';
    }

    $col ++;
    if ($col > (SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS - 1)) {
      $col = 0;
      $row ++;
    }
    $featured_products->MoveNextRandom();
  }

  if ($featured_products->RecordCount() > 0) {
    if (isset($new_products_category_id) && $new_products_category_id !=0) {
      $category_title = zen_get_categories_name((int)$new_products_category_id);
      $title = '<h2 class="centerBoxHeading">' . TABLE_HEADING_FEATURED_PRODUCTS . ($category_title != '' ? ' - ' . $category_title : '') . '</h2>';
    } else {
      $title = '<h2 class="centerBoxHeading">' . TABLE_HEADING_FEATURED_PRODUCTS . '</h2>';
    }
    $zc_show_featured = true;
  }
}
?>
26 Aug 2015, 12:42 AM
#17
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Featured Listing Not displaying on Product Listing Page

OK, so I think I may have identified the cause,but I've no easy way to prove/disprove it - So please humour me one this one.

In the file /includes/modules/YOUR_TEMPLATE/featured_products.php

Find the part of code that reads:

    // Effect 1
    if($homepage_options->fields['homepage_featured_products_hover_effect'] == 1){
      $list_box_contents[$row][$col] = array(
        'params' => 'class="'.$featured_product_carousel_class.'"',
        'text' => (($featured_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a class="listingProductLink" href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '</a><br />') . '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . $featured_products->fields['products_name'] . '</a></h3><br /><span class="price">' . $products_price.'</span>'.$buy_now_button
      );

      $sliderEffect = 'featured_he_1';
    }

Then comment out the first and last lines, so it reads :

    // Effect 1
[B] // [/B]  if($homepage_options->fields['homepage_featured_products_hover_effect'] == 1){
      $list_box_contents[$row][$col] = array(
        'params' => 'class="'.$featured_product_carousel_class.'"',
        'text' => (($featured_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a class="listingProductLink" href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '</a><br />') . '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . $featured_products->fields['products_name'] . '</a></h3><br /><span class="price">' . $products_price.'</span>'.$buy_now_button
      );

      $sliderEffect = 'featured_he_1';
[B]// [/B]   }

Save the file and then check to see if the featured products now display where you expect them to.

NOTE: The output may look like crap and it'll probably also make a bit of a mess with the featured products on the home page. Don't worry about this at the moment - the modifications are simply to let me know if I/we are on the right track or not.

Please report on the results/effects .

Cheers
RodG

26 Aug 2015, 1:00 PM
#18
cyberfolli avatar

cyberfolli

New Zenner

Join Date:
Sep 2010
Posts:
64
Plugin Contributions:
0

Re: Featured Listing Not displaying on Product Listing Page

I changed the code and nothing happened. Isn't it strange that the new products show up and the featured do not. Could the Database not be storing the data as a featured product ?

26 Aug 2015, 1:21 PM
#19
cyberfolli avatar

cyberfolli

New Zenner

Join Date:
Sep 2010
Posts:
64
Plugin Contributions:
0

Re: Featured Listing Not displaying on Product Listing Page

I also double checked the data in the database an there are two records there. i changed the dates to make sure they were featured today.

Is there any other relational tables that data needs to be associated with?

26 Aug 2015, 2:01 PM
#20
cyberfolli avatar

cyberfolli

New Zenner

Join Date:
Sep 2010
Posts:
64
Plugin Contributions:
0

Re: Featured Listing Not displaying on Product Listing Page

Also the Specials are working fine. So the Code is functioning.

http://www.aurumjewelers.net/penn-state-jewelry