Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1
    Join Date
    Aug 2004
    Location
    Fountain Hills, AZ
    Posts
    515
    Plugin Contributions
    1

    Is it possible to have two different Prod Listing Layouts?

    I would like to have to different product listing layouts based on category. The grid for all but one category. Could that be done by using Product type? I know that product type generally only effects the product detail, but I was wondering if this was possible using different file nameing conventions as is done with .css and if so could someone guide me just a bit.

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Is it possible to have two different Prod Listing Layouts?

    This could be managed with a case statement or if statement based on $current_category_id
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Aug 2004
    Location
    Fountain Hills, AZ
    Posts
    515
    Plugin Contributions
    1

    Default Re: Is it possible to have two different Prod Listing Layouts?

    Hmmm... which file are you referencing to make the change...

    In reading further in the forums... I noted a similiar question and the answer was the modules/pages/some_name/main_tpl_vars - I was wondering if this was possible using that method? Of course I still don't quite get how to set up the naming conventions there so the system would know to use those two files for that category... - it would seem that since changing to the column layout only required the two files and you set those up using the custom template naming convention that "if I could get my brain around the naming convention here" for this one category it would be possible to refer the layout back to the standard. Working till 4am makes the brain foggy... and I just can't seem to get my brain around this and I know this should be simple...LOL

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Is it possible to have two different Prod Listing Layouts?

    /includes/templates/template_default/templates/tpl_index_product_list.php

    calls the file:
    /includes/templates/template_default/templates/tpl_modules_product_listing.php

    This then calls the file:
    PHP Code:
     include(DIR_WS_MODULES zen_get_module_directory(FILENAME_PRODUCT_LISTING)); 
    which is the file:
    /includes/modules/product_listing.php
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Aug 2004
    Location
    Fountain Hills, AZ
    Posts
    515
    Plugin Contributions
    1

    Default Re: Is it possible to have two different Prod Listing Layouts?

    Thanks.. let me play with that and see how I do. I'll try writing a case statement and see if it works... If I get stuck I'll post my code. This could be very helpful for future sites also!!

  6. #6
    Join Date
    Aug 2004
    Location
    Fountain Hills, AZ
    Posts
    515
    Plugin Contributions
    1

    Re: Is it possible to have two different Prod Listing Layouts?

    Ok... I'm stuck...LOL - I can't seem to get past the parse errors to even see if it will do what I want... bad day at Bed Rock - any help here would be really appreciated.

    I modified tpl_modules_product_listing - to the following:


    PHP code:

    include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_PRODUCT_LISTING));
    ?>
    <div id="productListing">
    <?php
    // only show when there is something to submit and enabled
    if ($show_top_submit_button == true) {
    ?>
    <div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_ADD_PRODUCTS_TO_CART, BUTTON_ADD_PRODUCTS_TO_CART_ALT, 'id="submit1" name="submit1"'); ?></div>
    <br class="clearBoth" />
    <?php
    } // show top submit
    ?>

    <?php if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
    ?>
    <div id="productsListingTopNumber" class="navSplitPagesResult back"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></div>
    <div id="productsListingListingTopLinks" class="navSplitPagesLinks forward"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, zen_get_all_get_params(array('page', 'info', 'x', 'y', 'main_page'))); ?></div>
    <br class="clearBoth" />
    <?php
    }
    ?>

    <?php
    /**
    * load the list_box_content template to display the products based on category ID - category_id == 1 - tabular display all others to be columnar
    */
    switch (expression) {
    case 'PRODUCT_LISTING_LAYOUT_COLUMNS':
    PRODUCT_LISTING_LAYOUT_STYLE == 'columns';
    require($template->get_template_dir('tpl_columnar_display.php',DIR_WS_TEMPLATE, $current_page_base,'common'). ' /tpl_columnar_display.php');
    [break;]
    case 'PRODUCT_LISTING_LAYOUT_ROWS':
    if (category_id == '1');
    PRODUCT_LISTING_LAYOUT_STYLE == 'rows';
    require($template->get_template_dir('tpl_tabular_display.php',DIR_WS_TEMPLATE, $current_page_base,'common'). ' /tpl_tabular_display.php');
    [break;]
    }
    ?>

  7. #7
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Is it possible to have two different Prod Listing Layouts?

    I am not saying the code is right ... this is what is wrong with the code you posted:

    Change to:
    PHP Code:
    switch (expression) {
      case 
    'PRODUCT_LISTING_LAYOUT_COLUMNS':
        
    PRODUCT_LISTING_LAYOUT_STYLE == 'columns';
        require(
    $template->get_template_dir('tpl_columnar_display.php',DIR_WS_TEMPLATE$current_page_base,'common'). '/tpl_columnar_display.php');
        break;
      case 
    'PRODUCT_LISTING_LAYOUT_ROWS':
        if (
    category_id == '1') {
          
    PRODUCT_LISTING_LAYOUT_STYLE == 'rows';
          require(
    $template->get_template_dir('tpl_tabular_display.php',DIR_WS_TEMPLATE$current_page_base,'common'). '/tpl_tabular_display.php');
          break;
        }

    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  8. #8
    Join Date
    Aug 2004
    Location
    Fountain Hills, AZ
    Posts
    515
    Plugin Contributions
    1

    Re: Is it possible to have two different Prod Listing Layouts?

    Thanks for getting back to me... I had played around with it and figured out my bad coding, but as you stated... it's not correct... I really wasn't thinking this through completely.

    Each layout has two files - modules/product_listing and tpl_modules_products_listing.php as you mentioned - so just pointing to just the template isn't going to get the job done

    So I'm back to the drawing board on how to get it to point to both files to pull back in the rows..... for the one category.

    I know I'm making this harder than it is, but I'll keep playing with it, unless someone wants to save me here...LOL

    Thanks Ajeh as usual for your ray of light in the dark tunnel... at least I know it's not the train. : ' )

  9. #9
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Is it possible to have two different Prod Listing Layouts?

    Isn't there already a switch to go back and forth between column and row with that add-on?

    Couldn't you locate that switch ... and make your adjustment there to more or less flip it how you want it to be vs the default?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  10. #10
    Join Date
    Aug 2004
    Location
    Fountain Hills, AZ
    Posts
    515
    Plugin Contributions
    1

    Default Re: Is it possible to have two different Prod Listing Layouts?

    That's where I pulled this case from -

    the code before my changes on tpl_modules_product_listing - the version for columns is as follows

    PHP:

    <?php
    /**
    * load the list_box_content template to display the products
    */
    if (PRODUCT_LISTING_LAYOUT_STYLE == 'columns') {
    require($template->get_template_dir('tpl_columnar_display.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_columnar_display.php');
    } else {// (PRODUCT_LISTING_LAYOUT_STYLE == 'rows')
    require($template->get_template_dir('tpl_tabular_display.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_tabular_display.php');
    }
    ?>


    I tried first writing code that merely un commented the "else" statement with a condition of - if category_id =='1' - and all it merely did was disabled the product listing and gave me a blank page when I went to that category... I really thought I had stumbled onto the perfect answer... but no joy - maybe I didn't approach this correctly -

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 31 Jan 2014, 01:50 AM
  2. Is this possible ? Two or more product listing layouts (one per category)?
    By risant in forum Templates, Stylesheets, Page Layout
    Replies: 51
    Last Post: 15 Nov 2013, 02:53 AM
  3. I'm Stumped...same layouts two different results...
    By bigblue in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 15 Apr 2011, 06:10 PM
  4. Different product listing layouts for different categories?
    By kbascombe in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 13 Apr 2010, 09:36 AM
  5. Two different login page layouts
    By JackA in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 29 Dec 2007, 10:42 PM

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