Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Jan 2009
    Location
    Vegas Baby!
    Posts
    332
    Plugin Contributions
    0

    Default Featured Products

    Is there a way for me to show Featured Products on the category page without it also showing on the subcategory pages?
    Completed: BellaFavori.com
    In Progress: WeddingDivasLV.com
    Coming Soon: ???

  2. #2
    Join Date
    Jan 2005
    Location
    NY
    Posts
    149
    Plugin Contributions
    0

    Default Re: Featured Products

    I'm sure there is a more elegant way to handle this with php, but if you can't find another solution you can use CSS to hide the featured products from the subcategory pages. This could become very tedious if you have a large number of subcategories.

    It would require creating individual stylesheets for each of the subcategories and adding #featuredProducts {display: none;}

    Each stylesheet should be name based on the cpath of the subcategory. c_??_??.css.

  3. #3
    Join Date
    Jan 2009
    Location
    Vegas Baby!
    Posts
    332
    Plugin Contributions
    0

    Default Re: Featured Products

    Quote Originally Posted by pjb923 View Post
    I'm sure there is a more elegant way to handle this with php, but if you can't find another solution you can use CSS to hide the featured products from the subcategory pages. This could become very tedious if you have a large number of subcategories.

    It would require creating individual stylesheets for each of the subcategories and adding #featuredProducts {display: none;}

    Each stylesheet should be name based on the cpath of the subcategory. c_??_??.css.
    Thanks for the suggestion but I do have ALOT of subcategories. Wishful thinking I suppose but I thought maybe there's a particular page that generates the subcats that could just be edited...
    Completed: BellaFavori.com
    In Progress: WeddingDivasLV.com
    Coming Soon: ???

  4. #4
    Join Date
    Jan 2005
    Location
    NY
    Posts
    149
    Plugin Contributions
    0

    Default Re: Featured Products

    I was determined to figure this out because I am also interested in the answer.

    Since all subcategories contain an underscore in the cPath, I used a simple regular expression to selectively display the featured products.

    Go to line 85 of your tpl_index_categories.php file and make the following changes.

    Replace:
    PHP Code:
    <?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_CATEGORY_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 
    ?>
    With this:
    PHP Code:
     <?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_CATEGORY_FEATURED_PRODUCTS') { ?>
    <?php
    /**
     * display the Featured Products Center Box
     */
    ?>
    <?php
    if (preg_match("._."$cPath)) {
        echo 
    'disable featured products';
    } else { 
    ?>
    <?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 
    ?>
    You can remove the "echo 'disable featured products';" line. I put it in just to make sure everything was working properly.

  5. #5
    Join Date
    Jan 2009
    Location
    Vegas Baby!
    Posts
    332
    Plugin Contributions
    0

    Default Re: Featured Products

    I tried that but the code doesn't work for me In fact, I don't get any featured products, just the centerbox.
    Completed: BellaFavori.com
    In Progress: WeddingDivasLV.com
    Coming Soon: ???

  6. #6
    Join Date
    Jan 2005
    Location
    NY
    Posts
    149
    Plugin Contributions
    0

    Default Re: Featured Products

    Try reverting back to the original code and just add the following.

    PHP Code:
    <?php
    if (preg_match("._."$cPath)) {
        echo 
    'disable featured products'

    else { 
    echo 
    'enable featured products'; }?>
    Place it just before
    PHP Code:
      <?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_CATEGORY_FEATURED_PRODUCTS') { ?>
    Now you should see text displayed right above the featured products box and it will either say disable featured products, or enable featured products.

  7. #7
    Join Date
    Jan 2009
    Location
    Vegas Baby!
    Posts
    332
    Plugin Contributions
    0

    Default Re: Featured Products

    Yes, I actually have text 3 times (?). This is my test page
    Completed: BellaFavori.com
    In Progress: WeddingDivasLV.com
    Coming Soon: ???

  8. #8
    Join Date
    Jan 2009
    Location
    Vegas Baby!
    Posts
    332
    Plugin Contributions
    0

    Default Re: Featured Products

    Sorry that's the wrong page, this is it
    Completed: BellaFavori.com
    In Progress: WeddingDivasLV.com
    Coming Soon: ???

  9. #9
    Join Date
    Jan 2005
    Location
    NY
    Posts
    149
    Plugin Contributions
    0

    Default Re: Featured Products

    The good news is that the expression match is working correctly because navigating to a sub-directory shows the disabled text string.

    It's hard to say why it's showing up multiple times.

    Also, if you entered the code as I described it should not effect the featured products display at all, and I'm not seeing anything in the featured products box on your page. If you remove the code do they display properly?

    I would probably need to see your entire tpl_index_categories.php file to figure out what is going on.

  10. #10
    Join Date
    Jan 2009
    Location
    Vegas Baby!
    Posts
    332
    Plugin Contributions
    0

    Default Re: Featured Products

    Quote Originally Posted by pjb923 View Post
    The good news is that the expression match is working correctly because navigating to a sub-directory shows the disabled text string.

    It's hard to say why it's showing up multiple times.

    Also, if you entered the code as I described it should not effect the featured products display at all, and I'm not seeing anything in the featured products box on your page. If you remove the code do they display properly?

    I would probably need to see your entire tpl_index_categories.php file to figure out what is going on.
    That's odd, I reverted back to the original page but I get an empty Featured Products centerbox...I actually don't know if it's always been like that or not, because I usually don't have it turned on.

    Maybe I messed something up, this is my tpl_index_categories.php:
    Code:
    <?php
    /**
     * Page Template
     *
     * Loaded by main_page=index<br />
     * Displays category/sub-category listing<br />
     * Uses tpl_index_category_row.php to render individual items
     *
     * @package templateSystem
     * @copyright Copyright 2003-2006 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_index_categories.php 4678 2006-10-05 21:02:50Z ajeh $
     */
    ?>
    <div class="centerColumn" id="indexCategories">
    <?php if ($show_welcome == true) { ?>
    <h1 id="indexCategoriesHeading"><?php echo HEADING_TITLE; ?></h1>
    
    <?php if (SHOW_CUSTOMER_GREETING == 1) { ?>
    <h2 class="greeting"><?php echo zen_customer_greeting(); ?></h2>
    <?php } ?>
    
    <!-- deprecated - to use - uncomment
    <?php if (TEXT_MAIN) { ?>
    <div id="" class="content"><?php echo TEXT_MAIN; ?></div>
    <?php } ?>-->
    
    <!-- deprecated - to use - uncomment
    <?php if (TEXT_INFORMATION) { ?>
    <div id="" class="content"><?php echo TEXT_INFORMATION; ?></div>
    <?php } ?>-->
    
    <?php if (DEFINE_MAIN_PAGE_STATUS >= 1 and DEFINE_MAIN_PAGE_STATUS <= 2) { ?>
    <div id="indexCategoriesMainContent" class="content"><?php
    /**
     * require the html_define for the index/categories page
     */
      include($define_page);
    ?></div>
    <?php } ?>
    
    <?php } else { ?>
    <h1 id="indexCategoriesHeading"><?php echo $breadcrumb->last(); ?></h1>
    <?php } ?>
    
    <?php
    if (PRODUCT_LIST_CATEGORIES_IMAGE_STATUS_TOP == 'true') {
    // categories_image
      if ($categories_image = zen_get_categories_image($current_category_id)) {
    ?>
    <div id="categoryImgListing" class="categoryImg"><?php echo zen_image(DIR_WS_IMAGES . $categories_image, '', SUBCATEGORY_IMAGE_TOP_WIDTH, SUBCATEGORY_IMAGE_TOP_HEIGHT); ?></div>
    <?php
      }
    } // categories_image
    ?>
    
    <?php
    // categories_description
        if ($current_categories_description != '') {
    ?>
    <div id="categoryDescription" class="catDescContent"><?php echo $current_categories_description;  ?></div>
    <?php } // categories_description ?>
    <!-- BOF: Display grid of available sub-categories, if any -->
    <?php
      if (PRODUCT_LIST_CATEGORY_ROW_STATUS == 0) {
        // do nothing
      } else {
        // display subcategories
    /**
     * require the code to display the sub-categories-grid, if any exist
     */
       require($template->get_template_dir('tpl_modules_category_row.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_category_row.php');
      }
    ?>
    <!-- EOF: Display grid of available sub-categories -->
    <?php
    $show_display_category = $db->Execute(SQL_SHOW_PRODUCT_INFO_CATEGORY);
    
    while (!$show_display_category->EOF) {
      // //  echo 'I found ' . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS);
    
    ?>
    <?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_CATEGORY_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_CATEGORY_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_CATEGORY_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_CATEGORY_UPCOMING') { ?>
    <?php include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS)); ?><?php } ?>
    <?php
      $show_display_category->MoveNext();
    } // !EOF
    ?>
    </div>
    Completed: BellaFavori.com
    In Progress: WeddingDivasLV.com
    Coming Soon: ???

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Displaying 'Add to Cart' button on New Products and Featured Products
    By KenshiroU in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 28 Jun 2013, 05:30 AM
  2. clone featured products for category featured products
    By justbecause in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 18 Jan 2011, 06:49 AM
  3. Category featured image: I want to show only subcategories, not featured products!
    By ilmarchez in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 3 Dec 2010, 05:33 PM
  4. change Featured products to Featured Categories?
    By chrismaddox3d in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 22 Oct 2010, 01:25 AM
  5. Can I increase the Number of Featured products in Featured Sidebox
    By OhISeekYou in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 9 Aug 2007, 08:28 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR