Hi,
I am new to EE and working on a personal website to sell my products. I have somewhat of a 3 step flow for displaying my products on 3 separate pages.
{exp:channel:entries channel="products" disable="member_data|pagination" dynamic="no" sort="asc" }
{title}
<a href="http://{path=site_index}products/{url_title}">view products</a>
{/exp:channel:entries}{exp:channel:entries channel="items" disable="member_data|pagination" dynamic="no" sort="asc" }
{title}
{cf_item_photos}<div url('{cf_item_photo}')"></div>{/cf_item_photos}
<a href="http://{path=site_index}items/{url_title}">view product</a>
{/exp:channel:entries}Have not really worked on this page code as yet.Page 1 works fine but I cannot get the products to display on page 2 correctly. It is displaying all products within the system and not just those based on the link click from page 1.
Appreciate any help for this.
Thanks
You’re not defining a category group in Step 2, so it’s pulling all of the entries. You said Step 1 is showing your “featured product group”? You need to tell Step 2 what the product group (category) is, then add that to the channel entries tag - ie {exp:channel:entries channel="items" category_group="2"}
Am guessing that you are having category group called “Products” (with category id say, 1) and have various product categories defined inside it. Example categories and corresponding category ids can probably be Category id 1 : Furniture Category id 2 : Electronics Category id 3 : Computers etc.
You need to have a channel to store all the products, which I see you already have.
As you are displaying featured product categories on homepage, you can use GWCode Categories plugin to do that.
Step 1: Homepage
{exp:gwcode_categories
channel="products"
group_id="1"
style="linear"
status="Open"
show_empty="yes"
}
{if no_results}
{if:else}
{cat_name}
<a href="http://{path=products/listing/{cat_url_title}}">view products</a>
{/if}
{/exp:gwcode_categories}Note that the path is pointing to products/listing (template group/template)
Step 2: Entries listing from a specific category
I did this using NSM Categories addon
{exp:nsm_categories:archive
channel="products"
category_group="1"
enable="entries"
orderby="date"
}
{if category_url_title == '{segment_3}'} <!--Assuming that your category/sub-category url title shows up in segment 3-->
{category_channel_entries}
<ul>
<li><a href="http://{entry_id_path=products/details}">{title}</a></li>
</ul>
{/category_channel_entries}
{/if}
{if no_results}There are no products in this category!{/if}
{/exp:nsm_categories:archive}Step 3: Product Details
This is simple, as you will be using {exp:channel:entries} tag
{exp:channel:entries
channel="products"
category_group="1" <!--Important-->
status="open|all-your-other-statuses-seperated-by-pipe-character"
disable="member_data|pagination"
dynamic="no"
sort="asc"
}
All your custom fields and markup goes in here.
{/exp:channel:entries}Keep us posted
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.