Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Aug 2007
    Posts
    91
    Plugin Contributions
    0

    Default Separate Product Listing by Category

    I'm working on a Jewelry site and I would like to separate the product listing page by category. For instance, I have "Gemstones" listed as a category, when someone clicks on a gemstone, I'd like to divide the page into three categories:

    Bracelet
    Earrings
    Necklace

    Here is an example of what I'm trying to do:

    http://www.stonehinged.com/amethyst_jewelry.html

    Here is the site I'm working on: http://twistjewelrydesign.com/shoppi...php?main_page=

    Is this possible? What do I need to change? Would it mess up my other categories? I'm currently using the add-on that shows subcategories all the time.

    Thanks,
    Cindy

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

    Default Re: Separate Product Listing by Category

    It would not be a big deal to sort the products by type and then start a new row and add a heading above the first item in each type; but if you only want three of each type per page, that will require some involved coding or perhaps very picky sorting.

  3. #3
    Join Date
    Aug 2007
    Posts
    91
    Plugin Contributions
    0

    Default Re: Separate Product Listing by Category

    gjh42,

    Sorting the products by type and then starting a new row and adding a heading above the first item in each type would work fine.

    How would I go about doing that?

    Thanks,
    Cindy

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

    Default Re: Separate Product Listing by Category

    The Main Category - sub heading sort - is it possible? thread discusses this.
    We got it working for the category/subcategory page, but I think the code as first given will work for the product listing page.
    Try it and let me know.

  5. #5
    Join Date
    Aug 2007
    Posts
    91
    Plugin Contributions
    0

    Default Re: Separate Product Listing by Category

    Hi Glenn,

    I tried it, but it didn't work. Nothing changed on my site. Any ideas?

  6. #6
    Join Date
    Aug 2007
    Posts
    91
    Plugin Contributions
    0

    Default Re: Separate Product Listing by Category

    Here is my code:

    // Following code will be executed only if Column Layout (Grid Layout) option is chosen
    if (PRODUCT_LISTING_LAYOUT_STYLE == 'columns') {
    $section_check = $listing->fields['products_name'];
    $section_header = '';
    if (in_array($section_check,explode(",",'Bracelets,Earrings,Necklaces'))) {
    $column = -1;
    $rows ++;
    switch ($section_check) {
    case "First Name":
    $section_header = 'First Section';
    break;
    case "Second Name":
    $section_header = 'Second Section';
    break;
    case "Third Name":
    $section_header = 'Third Section';
    break;
    } //switch
    $section_header = '<div class="sectionHeader">' . $section_header . '</div>';
    } //if
    $lc_text = $section_header . implode('<br />', $product_contents);
    $list_box_contents[$rows][$column] = array('params' => 'class="centerBoxContentsProducts centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => $lc_text);
    $column ++;
    if ($column >= PRODUCT_LISTING_COLUMNS_PER_ROW) {
    $column = 0;
    $rows ++;
    }
    }
    // End of Code fragment for Column Layout (Grid Layout) option in add on module

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

    Default Re: Separate Product Listing by Category

    The cases given are generic:
    case "First Name":

    You need to customize them to match your installation:
    case "Bracelets":

  8. #8
    Join Date
    Aug 2007
    Posts
    91
    Plugin Contributions
    0

    Default Re: Separate Product Listing by Category

    Thanks Glenn.

    I changed the Case names. Still not working... Below is my updated code:

    // Following code will be executed only if Column Layout (Grid Layout) option is chosen
    if (PRODUCT_LISTING_LAYOUT_STYLE == 'columns') {
    $section_check = $listing->fields['products_name'];
    $section_header = '';
    if (in_array($section_check,explode(",",'Bracelets,Earrings,Necklaces'))) {
    $column = -1;
    $rows ++;
    switch ($section_check) {
    case "Bracelets":
    $section_header = 'First Section';
    break;
    case "Earrings":
    $section_header = 'Second Section';
    break;
    case "Necklaces":
    $section_header = 'Third Section';
    break;
    } //switch
    $section_header = '<div class="sectionHeader">' . $section_header . '</div>';
    } //if
    $lc_text = $section_header . implode('<br />', $product_contents);
    $list_box_contents[$rows][$column] = array('params' => 'class="centerBoxContentsProducts centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => $lc_text);
    $column ++;
    if ($column >= PRODUCT_LISTING_COLUMNS_PER_ROW) {
    $column = 0;
    $rows ++;
    }
    }
    // End of Code fragment for Column Layout (Grid Layout) option in add on module

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

    Default Re: Separate Product Listing by Category

    First, you need to use the product names in the explode, not the section names.
    As your product names are long and may include commas, they will be cumbersome if not fatal to use. It will be better to use product ids, which are short and unique.
    PHP Code:
        // Following code will be executed only if Column Layout (Grid Layout) option is chosen
        
    if (PRODUCT_LISTING_LAYOUT_STYLE == 'columns') {
          
    $section_check $listing->fields['products_id']; // subheadings - gjh42 20080913 
          
    $section_header '';
          if (
    in_array($section_check,explode(",",'list_ids_to_start_new_lines_here,separated_by_commas,and_no_spaces'))) { 
            
    $column != 0?$rows ++:''
            
    $column = -1;
            switch (
    $section_check) {
            case 
    "first id":
              
    $section_header 'First Section';
            break;
            case 
    "second id"//repeat case/$section/break for other ids to start headings
              
    $section_header 'Second Section';
            break;
            } 
    //switch
            
    $section_header '<div class="sectionHeader">' $section_header '</div>';
          } 
    //if
          
    $lc_text $section_header implode('<br />'$product_contents);  // /subheadings
          
    $list_box_contents[$rows][$column] = array('params' => 'class="centerBoxContentsProducts centeredContent back"' ' ' 'style="width:' $col_width '%;"',
                                                     
    'text'  => $lc_text);
          
    $column ++;
          if (
    $column >= PRODUCT_LISTING_COLUMNS_PER_ROW) {
            
    $column 0;
            
    $rows ++;
          }
        }
        
    // End of Code fragment for Column Layout (Grid Layout) option in add on module 

  10. #10
    Join Date
    Aug 2007
    Posts
    91
    Plugin Contributions
    0

    Default Re: Separate Product Listing by Category

    Glenn,

    I'm not sure I totally understand. Do I need to list out every single product ID? This site will have over 300 products. Each "gemstone" page would have a different set of product ids, will this script work for that?

    Sorry, if these are dumb questions, but I'm new to all of this.

    Thanks,
    Cindy

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v151 View a product/category in the catalog from a link in admin product/category listing
    By torvista in forum Customization from the Admin
    Replies: 4
    Last Post: 25 Jan 2013, 06:13 PM
  2. Change Category Product Listing Layout To Match All Product Listing
    By Alfonzo in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 21 Sep 2010, 11:49 AM
  3. Product listing different in separate categories
    By chingy in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 9 Nov 2009, 05:27 PM
  4. Category Listing - Separate sections by Sort Order
    By JJDoench in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 5 Aug 2009, 06:55 PM
  5. IE(Problem) Product Category Listing Bleeds Into Category Header?
    By allen875 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 17 Dec 2007, 05:09 AM

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