Jump to:

2082 Posts in 1002 Topics by 452 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » ChildProducts in template code?

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: 1220 Views
  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    ChildProducts in template code? Link to this post

    Hi.

    I'm just testing Ecommerce for the first time and am customizing the layout and I have a problem I can't understand. My tree heirachy is:

    Products->Product Group->Product 1

    The code I am referring to is in ProductGroup.ss here:

    <% if IsTopLevel %>
          <% if ChildProducts %>
             <div class="product_summary">
                <ul id="ProductList">
                   <% control ChildProducts %>
                      <% include ProductGroupItem %>
                   <% end_control %>
                </ul>
             </div>
          <% end_if %>
          <% if FeaturedProducts %>
             <div class="product_summary">
                <h3 class="productGroupTitle"><% _t("FEATURED","Featured Products") %></h3>
                <ul id="ProductList">

    .....

    First, the problem is that nothing is displayed on the page. No child groups, no child products.

    Second, IsTopLevel is not being fired, I assume due to my tree structure.

    Third (and most importantly), there seems to be no method anywhere for "ChildProducts", so neither the if statement is passing nor is the control looping.

    Any ideas? This is version 0.5.2

    Cheers
    Aaron

  • Kalileo
    Avatar
    Community Member
    127 Posts

    Re: ChildProducts in template code? Link to this post

    @Aaron

    I ran into the same issue with trunk r73999, it seems to have worked before somewhat with 0.5.2, at least I could see FeaturedProducts .

    Checking the ProductGroup.ss in ecommerce trunk r73999 there is no ChildProducts etc. mentioned anymore, just FeaturedProducts and NonFeaturedProducts.

    The Product group setting at the products and the Child Groups setting at the product group define together if a product is shown in the NonFeaturedProducts or not.

    Thus all the code of the current ecommerce templates, at least for ProductGroup.ss, needs to get adapted to that change, if you wanna see your products.

    Based on that I assume that what you see and describe is not so much an error on your side but more likely the first steps of the changes visible in trunk now.

    Here's how it's handled in ProductGroup.ss in trunk, may be that can help you:

       <% if FeaturedProducts %>
          <h3 class="categoryTitle"><% _t("FEATURED","Featured Products") %></h3>
          <div id="FeaturedProducts" class="category">
             <div class="resultsBar typography">
                <p class="resultsShowing">Showing <span class="firstProductIndex">1</span> to <span class="lastProductIndex">$FeaturedProducts.Count</span> of <span class="productsTotal">$FeaturedProducts.Count</span> products</p>
             </div>
             <div class="clear"><!-- --></div>
             <ul class="productList">
                <% control FeaturedProducts %>
                   <% include ProductGroupItem %>
                <% end_control %>
             </ul>
             <div class="clear"><!-- --></div>
          </div>
       <% end_if %>
       
       <% if NonFeaturedProducts %>
          <h3 class="categoryTitle"><% _t("OTHER","Other Products") %></h3>
          <div id="NonFeaturedProducts" class="category">
             <div class="resultsBar typography">
                <p class="resultsShowing">Showing <span class="firstProductIndex">1</span> to <span class="lastProductIndex">$NonFeaturedProducts.Count</span> of <span class="productsTotal">$NonFeaturedProducts.Count</span> products</p>
             </div>
             <div class="clear"><!-- --></div>
             <ul class="productList">
                <% control NonFeaturedProducts %>
                   <% include ProductGroupItem %>
                <% end_control %>
             </ul>
             <div class="clear"><!-- --></div>
          </div>
       <% end_if %>

    1220 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.