Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2011
    Posts
    287
    Plugin Contributions
    0

    Default Multiple product listings based on product type

    Hi Everyone,

    So I use different product types to style the different product infos differently. I would also like to change the style slightly of the product listing, I asked about this a while ago and basically I think what I have to do is:

    1. create a separate tpl_index_product_list.php with a new name
    2. In /includes/modules/pages/index/main_template_vars.php check for which category (cPath) is set, and choose which tpl file to use based on that cPath.
    3. Then use the new tpl_index_product_list_tabbed.php (or whatever name you call it) and probably also a new tpl_modules_product_listing_tabbed.php to affect the new layout you want to the page when that category is selected.

    The problem I have is on number two, I have no idea how I would check for the category and then chose the tpl file base on it, Does anyone know how I would achieve this?

    Daniel

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,971
    Plugin Contributions
    96

    Default Re: Multiple product listings based on product type

    You could use the zen_get_products_category_id function, which retrieves the product's "master category id".
    Code:
    $category_id = zen_get_products_category_id ($_GET['products_id']);
    Depending on the number of "special processing" categories, you'd set up arrays that contain the master-category-id of the associated products, e.g.
    Code:
    $special_list1 = array (1, 2, 3, 4);
    $special_list2 = array (5, 6, 7, 8);
    and then check to see if the current product's category id falls into one of the "special" ranges:
    Code:
    if (in_array ($category_id, $special_list1)) {
      $tpl_page_body = 'tpl_special_list1_info.php';
    
    } elseif (in_array ($category_id, $special_list2)) {
      $tpl_page_body = 'tpl_special_list2_info.php';
    
    }

 

 

Similar Threads

  1. Shipping based on Product type?
    By snowgoose in forum Built-in Shipping and Payment Modules
    Replies: 6
    Last Post: 12 Jul 2011, 01:14 AM
  2. Specific text in product listings based on category
    By alexwoolfson in forum Templates, Stylesheets, Page Layout
    Replies: 15
    Last Post: 31 Oct 2008, 08:20 AM
  3. Display Cart After Adding Product based on Product Type?
    By dharma in forum General Questions
    Replies: 2
    Last Post: 26 Jun 2008, 11:31 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