Page 2 of 6 FirstFirst 1234 ... LastLast
Results 11 to 20 of 52
  1. #11
    Join Date
    Feb 2009
    Posts
    31
    Plugin Contributions
    0

    Default Re: Is this possible ? Two or more product listing layouts (one per category)?

    @gjh42:
    Thank you for your reply, I didn't see it before.

    So this code goes in the products_listing.php file in the module directory.

    Then you create a file named products_listing_c_'category_id'.php for each category.

    Am I correct?

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

    Default Re: Is this possible ? Two or more product listing layouts (one per category)?

    The selection code can't go in the file that it is selecting. I would have to research to find the file that calls product_listing.php (or its alternate).
    At any rate, you really don't need to do the extra work if you just want to switch between the "columns" and "rows" layout styles. That is best handled with bunyip's examples.

    It sounds like you somehow messed up the edits; best to go back and get those right than to try to fix it with significantly more complex editing.

  3. #13
    Join Date
    Oct 2004
    Posts
    1,045
    Plugin Contributions
    0

    Default Re: Is this possible ? Two or more product listing layouts (one per category)?

    Quote Originally Posted by yellow1912 View Post
    This is what I did, worked like a charm if you want to select the product listing module you want to use:

    PHP Code:
    $listing_module_loaded false;
     if(!
    $is_index_listing && $_GET['main_page'] == 'index' && !empty($cPath)){
         
    $category_array explode('_'$cPath);
         
    $category_array array_reverse($category_array);
         foreach (
    $category_array as $c){
             
    $listing_module_file DIR_WS_MODULES zen_get_module_directory("product_listing_c_$c.php");
             if(
    file_exists($listing_module_file)){
                 include(
    $listing_module_file);
                 
    $listing_module_loaded true;
                 break;
             }
        }
     }
     if(!
    $listing_module_loaded)
         include(
    DIR_WS_MODULES zen_get_module_directory(FILENAME_PRODUCT_LISTING)); 
    What file would you put this code in?

    Thanks!
    Danielle

  4. #14
    Join Date
    Jul 2011
    Posts
    138
    Plugin Contributions
    0

    Default Re: Is this possible ? Two or more product listing layouts (one per category)?

    Hopefully I can revive this thread. Bunyip's solution seems straight forward and may be the quick fix, but I would prefer to implement the long term solution. Can anyone offer help regarding yellow1912 solution.

    1) will this work for ZC 1.3.9h or is there a better solution
    2) where does the code go
    3) once I implement the code do I just add a layout column in my categories table and populate with "row", "grid", "xx", "xy", and so on or would the assignment need to be the actual .php file name for each layout.

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

    Default Re: Is this possible ? Two or more product listing layouts (one per category)?

    If you want two layouts, a row and a grid style, bunyip's code is the best way to do it. It is simple and elegant and doesn't take extra code in the codebase.

    If you want (say) two kinds of grid layout, or three different layouts, yellow1912's solution will allow total flexibility as long as you are willing to write all the code for your desired layouts.
    It works by testing for the existence of a file matching the current category id, so there is nothing to do in database tables; just make custom listing module files for each custom category and the code will find and use them where appropriate. The standard listing file will be used for any category that doesn't have a custom one.
    Last edited by gjh42; 28 Jul 2011 at 03:38 AM.

  6. #16
    Join Date
    Jul 2011
    Posts
    138
    Plugin Contributions
    0

    Default Re: Is this possible ? Two or more product listing layouts (one per category)?

    Bunyip's code worked fine for me when doing a single category, but I need to do around 100 categories.

    I think yellow1912 is the way to go, but that will have to wait until my programming knowledge improves. Oh well, back to Bunyips code.

    I have tried several variations of "OR" "||" etc with undesirable outcomes. It almost looks as if the result are both row & column/grid format in one. I'm using ZC1.3.9 with column grid addon and sorry the site is not live. The last code I used, which I think is the proper way, was

    if (PRODUCT_LISTING_LAYOUT_STYLE == 'rows' OR (int) $current_category_id == 2260 || (int) $current_category_id == 104150)

    and

    if (PRODUCT_LISTING_LAYOUT_STYLE == 'columns' AND (int) $current_category_id !== 2260 || (int) $current_category_id !== "104150")


    My questions are:
    1)What am I missing?
    2)Is there a shorter way to do the or statement because I have about 100 categories to do this for?
    3)Or with this many categories should I beg and plead for help to implement yellow1912 version?

    Thanks

  7. #17
    Join Date
    Jul 2011
    Posts
    138
    Plugin Contributions
    0

    Default Re: Is this possible ? Two or more product listing layouts (one per category)?

    Anyone? Did I not provide enough info? I'm sure it's the simple fact that I didn't code the statement correctly due to my lack of programming knowledge.

    Thanks
    ZC 1.5.5
    Add ons: - Column/Grid 1.3.8 - Dual pricing 1.7 - ImageHandler3

  8. #18
    Join Date
    Jul 2011
    Posts
    138
    Plugin Contributions
    0

    Default Re: Is this possible ? Two or more product listing layouts (one per category)?

    Update:
    Part of the initial problem was that I had the category 104150 in qoutes

    I've revised the code for product_listing.php to these lines
    if (PRODUCT_LISTING_LAYOUT_STYLE == 'columns' AND (int) $current_category_id !== 2260 || PRODUCT_LISTING_LAYOUT_STYLE == 'columns' AND (int) $current_category_id !== 104150) {

    if (PRODUCT_LISTING_LAYOUT_STYLE == 'rows' OR (int) $current_category_id == 2260 || PRODUCT_LISTING_LAYOUT_STYLE == 'rows' OR (int) $current_category_id == 104150)

    and I've revised the code for tpl_modules_product_listing.php to this line
    if (PRODUCT_LISTING_LAYOUT_STYLE == 'columns' AND (int) $current_category_id !== 2260 || PRODUCT_LISTING_LAYOUT_STYLE == 'columns' AND (int) $current_category_id !== 104150) {


    When applying to only category 2260 (everything past the || deleted) it worked fine. Once I added the information past the || it worked fine for category 104150 but seemed to mess up category 2260. Category 2260 looked as though it was displaying both in row & grid format.

    1) Any idea how I can fix this
    2) This will be like a lot of code to paste if I have 100 categories to apply this two. Any other shortcuts out there?

    Thanks
    ZC 1.5.5
    Add ons: - Column/Grid 1.3.8 - Dual pricing 1.7 - ImageHandler3

  9. #19
    Join Date
    Aug 2011
    Posts
    21
    Plugin Contributions
    0

    Default Re: Is this possible ? Two or more product listing layouts (one per category)?

    I tried the simple method...but I don't know what went wrong. I can't seem to find a problem. I use the column grid mod and I have the newest version of Zencart. It seems to work fine even though the mod is not meant for the version.

    I changed both php files. the first one.
    there is either (two instances)
    PHP Code:
      if (PRODUCT_LISTING_LAYOUT_STYLE == 'rows') OR $current_category_id == ^2$) 
    or (3 instances)
    PHP Code:
    if (PRODUCT_LISTING_LAYOUT_STYLE == 'columns') AND $current_category_id != ^2$) 

    in the other file there's just this.
    PHP Code:
     if (PRODUCT_LISTING_LAYOUT_STYLE == 'columns') AND $current_category_id != ^2$) {
      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');

    is something wrong with this? it shows me a blank listing...

    what I need is actually to have all subcategories of category id 2 to have the listing.

    (http://outcast.cz)

  10. #20
    Join Date
    Jul 2011
    Posts
    138
    Plugin Contributions
    0

    Default Re: Is this possible ? Two or more product listing layouts (one per category)?

    stsung, I'm not knowledgeable as to if ^2$ should imply all subcategories (would be interesting to know as I'm still trying to fix my issue), but have you tried to set your category to = 9

    This might be a good test to see if it works. I bet you probably have the same issue as me in that you need to apply this to multiple categories. Sorry I can't help any more than the above suggestion.
    ZC 1.5.5
    Add ons: - Column/Grid 1.3.8 - Dual pricing 1.7 - ImageHandler3

 

 
Page 2 of 6 FirstFirst 1234 ... LastLast

Similar Threads

  1. How can I implement multiple product listing layouts based on category
    By idc1 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 15 Jul 2011, 07:44 PM
  2. Two Site with One Paypal account...is this possible?
    By PinkLeopard in forum PayPal Website Payments Pro support
    Replies: 7
    Last Post: 12 Jan 2010, 04:04 AM
  3. Newbie - Possible to create more than one category filter?
    By henrytan in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 11 Oct 2008, 09:22 AM
  4. One product database + two kinds of handling possible?
    By pe7er in forum General Questions
    Replies: 2
    Last Post: 21 Mar 2008, 05:32 PM
  5. Is it possible to have two different Prod Listing Layouts?
    By rwoody in forum Setting Up Categories, Products, Attributes
    Replies: 16
    Last Post: 14 Oct 2006, 05:24 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