Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

E-Commerce Modules /

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, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

ChildProducts in template code?


Go to End


2 Posts   1910 Views

Avatar
Double-A-Ron

Community Member, 607 Posts

3 March 2009 at 5:30pm

Edited: 03/03/2009 5:31pm

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

Avatar
Kalileo

Community Member, 127 Posts

15 April 2009 at 6:34am

Edited: 15/04/2009 6:37am

@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 %>