Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Disable Product Type Sideboxes

    I have created a new Product Type - The extra fields appear in drop down select sideboxes on my site.

    I want to disable those sideboxes except when on pages of that product type.

    Example - this new product type will have its own category, so I only want those sideboxes to appear in that category.

    I have tried several if statements even
    // test if box should display
    if ($this_is_home_page) {
    $show_custom_sidebox = false;
    } else {
    $show_custom_sidebox = true;
    }

    nothing seems to be working

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Disable Product Type Sideboxes

    PHP Code:
    // test if box should display
    if (isset($cPath) and $cPath == 'xx') {
    $show_custom_sidebox true;
    } else {
    $show_custom_sidebox false;

    where xx is the category id for your product type's category.
    If it has subcats the test needs to be a little more sophisticated.

  3. #3
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Disable Product Type Sideboxes

    no sub-categories & doesn't work

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Disable Product Type Sideboxes

    The question becomes, what file are you using the test in? Post the beginning of the file with the test and surroundings. What is the cPath for the product type category?

  5. #5
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Disable Product Type Sideboxes

    I copied all the music/music_genre files to create new product type.

    So I copied music_genres.php located here /includes/modules/sideboxes

    Put the new sidebox here /includes/modules/sideboxes/CUSTOM_TEMPLATE

    Beginning of file:

    <?php
    /**
    * tv_display_size sidebox - displays list of available tv_display_size to filter on
    *
    * @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: tv_display_size.php 2834 2006-01-11 22:16:37Z birdbrain $
    */

    Category Id would be 976 with no subcategories

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Disable Product Type Sideboxes

    Post the beginning of the file with the test and surroundings.
    It's good to know what & where the file is, but debugging requires seeing the code that is not working.

  7. #7
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Disable Product Type Sideboxes

    PHP Code:
    <?php
    /**
     * tv_display_size sidebox - displays list of available music genres to filter on
     *
     * @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: tv_display_size.php 2834 2006-01-11 22:16:37Z birdbrain $
     */

      
    $tv_display_size_query "select tv_display_size_id, tv_display_size_name
                              from " 
    TABLE_TV_DISPLAY_SIZE "
                              order by tv_display_size_name"
    ;

      
    $tv_display_size $db->Execute($tv_display_size_query);

      if (
    $tv_display_size->RecordCount()>0) {
        
    $number_of_rows $tv_display_size->RecordCount()+1;

    // Display a list
        
    $tv_display_size_array = array();
        if (!isset(
    $_GET['tv_display_size_id']) || $_GET['tv_display_size_id'] == '' ) {
          
    $tv_display_size_array[] = array('id' => '''text' => PULL_DOWN_ALL);
        } else {
          
    $tv_display_size_array[] = array('id' => '''text' => PULL_DOWN_TV_DISPLAY_SIZE);
        }

        while (!
    $tv_display_size->EOF) {
          
    $tv_display_size_name = ((strlen($tv_display_size->fields['tv_display_size_name']) > MAX_DISPLAY_TV_DISPLAY_SIZE_NAME_LEN) ? substr($tv_display_size->fields['tv_display_size_name'], 0MAX_DISPLAY_TV_DISPLAY_SIZE_NAME_LEN) . '..' $tv_display_size->fields['tv_display_size_name']);
          
    $tv_display_size_array[] = array('id' => $tv_display_size->fields['tv_display_size_id'],
                                           
    'text' => $tv_display_size_name);

          
    $tv_display_size->MoveNext();
        }
          require(
    $template->get_template_dir('tpl_tv_display_size_select.php',DIR_WS_TEMPLATE$current_page_base,'sideboxes'). '/tpl_tv_display_size_select.php');

        
    $title '<label>' BOX_HEADING_TV_DISPLAY_SIZE '</label>';
        
    $title_link false;
        require(
    $template->get_template_dir($column_box_defaultDIR_WS_TEMPLATE$current_page_base,'common') . '/' $column_box_default);
      }
    ?>

  8. #8
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Disable Product Type Sideboxes

    There is no product page display test code in the file you posted, so I can't tell what you did wrong.
    However, there is a display test in place to only execute the file if there is something to display, and we can piggyback the product page test on that.
    Add
    and (isset($cPath) and $cPath == 'xx')
    to this line
    PHP Code:
      if ($tv_display_size->RecordCount()>0) { 
    to get
    PHP Code:
      if ($tv_display_size->RecordCount()>and (isset($cPath) and $cPath == 'xx')) { 

  9. #9
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Disable Product Type Sideboxes

    my entire site disappeared, nothing but the header left

  10. #10
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Disable Product Type Sideboxes

    Post that line as it now exists in your file with the added test. Did you replace 'xx' with '976'?

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Product Type Filter Sideboxes
    By rbarbour in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 27 Sep 2011, 04:25 AM
  2. New product type doesn't display errors nor sideboxes
    By icecold in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 30 Oct 2009, 06:18 PM
  3. Auction Product Type: Can't add a product of the type.
    By sw0rdz in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 5 Sep 2009, 02:11 AM
  4. Disable right sideboxes for manufacturers product pages.
    By shackle in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 7 Jul 2007, 03:36 AM
  5. Disable shipping type based on weight
    By onadisc in forum Built-in Shipping and Payment Modules
    Replies: 8
    Last Post: 5 Nov 2006, 03:02 PM

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