Jump to:

2076 Posts in 857 Topics by 449 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » Product Group pages nested products..

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

Page: 1
Go to End
Author Topic: 712 Views
  • Kiwipearls
    Avatar
    Community Member
    34 Posts

    Product Group pages nested products.. Link to this post

    Hi there,

    The site I am working on using Ecommerce 0.8.1 and SS 2.4.6.

    I want the top level product group - to be the first page, introducing our online shop and what type of products they can find here.

    But I do not want any lower product level group products to be displayed on this page. Just only on the next level group pages.

    How do I achieve this?

    Products <<--- do not want products displayed on this product group page - just the text
    -2nd product group <<--- only want products displayed on the this level product group pages
    - Product in 2nd product group <<- Normal product page, displaying normally
    - Another product in 2nd product group
    - 3rd product group
    - product in 3rd product group

    I hope this makes sense to you as it does to me.

    Here is my Layout/ProductGroup.ss page

    <h2 class="pageTitle">
          $Title
       </h2>   

       <% if Content %>
          <div class="typography">
             $Content
          </div>
       <% end_if %>
       
          
       <% if Products %>
          <div id="Products" class="category">
             <div class="resultsBar typography">
                <% if SortLinks %><span class="sortOptions">Sort by <% control SortLinks %><a href="$Link" class="sortlink $Current">$Name</a> <% end_control %></span><% end_if %>
             </div>
             <div class="clear"><!-- --></div>
             <div id="productList">
             
                <% control Products %>
                   <% include ProductGroupItem %>
                <% end_control %>
             </div>
             <div class="clear"><!-- --></div>
          </div>
       <% end_if %>
       
       <% if IsTopLevel %>
       
             <% if ChildGroups %>
             
                <% if ChildProducts %>
                   <ul class="list first">
                      <% control ChildProducts %>
                      <% end_control %>
                   </ul>
                <% end_if %>
                <% control ChildGroups %>
                   <% if ChildGroups %>
                      <h3 class="productGroupTitle"><a href="$Link" title="<% sprintf(_t("VIEWGROUP","View the product group &quot;%s&quot;"),$Title) %>">$Title</a></h3>
                      <ul class="list first">
                         <% control ChildGroups %>
                            <% if ChildProducts %>
                            <% end_if %>
                         <% end_control %>
                      </ul>
                   <% end_if %>
                <% end_control %>
             
          <% else %>
             
                <% if ChildProducts %>
                   <ul class="list first">
                      <% control ChildProducts %>
                         <% end_control %>
                   </ul>
                <% end_if %>
             
          <% end_if %>
       <% end_if %>

    I eagerly look forward to hearing from someone on this.

    Kind Regards
    KP

  • Kiwipearls
    Avatar
    Community Member
    34 Posts

    Re: Product Group pages nested products.. Link to this post

    I really wish someone could answer this for me or point me in the right direction. I have still not figured out how to do this.

    Complete nub when it comes to coding, I try my best, but it is still gobbly gook at times.

  • Jedateach
    Avatar
    Forum Moderator
    227 Posts

    Re: Product Group pages nested products.. Link to this post

    Hi KP, sorry I missed this post,

    I'm not sure I fully understand, but I think I do understand you want a different template for your homepage.

    You could achieve this by creating a HomePage class like this:

    mysite/code/HomePage.php

    class HomePage extends ProductGroup{
    ...
    }
    class HomePage_Controller extends ProductGroup_Controller{
    ..
    }

    mysite/templates/Layout/HomePage.ss or themes/mytheme/templates/Layout/HomePage.ss

    /// your template code here

    Note that ProductGroup has been renamed to ProductCategory in the latest version of the code.

    hope this helps,
    Jeremy

  • Kiwipearls
    Avatar
    Community Member
    34 Posts

    Re: Product Group pages nested products.. Link to this post

    Hi there,

    I guess I didn't word my post properly.

    The products page - that says "This is the top level products page, it uses the product group page type, and it allows you to show your products checked as 'featured' on it. It also allows you to nest product group pages inside it."

    It displays all the products, but I do not want it too.

    I only want to show the products when users click on the productgroup/category pages I have created underneath it.

    For example my tree is:

    Products
    -- Hosting
    -- Domains

    Do not want to display any products on the products page - only the hosting and the domain pages - but if I remove some code to remove products displaying on the products page, then you can't see products on the hosting or domains product group pages.

  • Jedateach
    Avatar
    Forum Moderator
    227 Posts

    Re: Product Group pages nested products.. Link to this post

    Hi KP,

    I assume you just want to show featured products, like it says (that default content is a bit outdated)

    Here are some new docs for you:
    http://demo.ss-shop.org/docs/developer/en/Recipes/FeaturedProducts

    regards,
    Jeremy

  • Kiwipearls
    Avatar
    Community Member
    34 Posts

    Re: Product Group pages nested products.. Link to this post

    Yes, but not on the home page, on the productgroup.ss page that comes with ecommerce.

    I guess for now I will just have to put up with it.

    Because if I edit that page, I get no products displaying on the group pages.

    712 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.