After struggling for a day I hope that someone may be able to help me. I have a site that has a list of stockists worldwide. I would like to have a landing page where you can choose your country (grouped by regions) as per:
Oceania
- Australia
- New Zealand
United Kingdom
- England
- Scotland
- Wales
etc.
Currently there are 31 countries but the client needs to be able to add more. Some, but not all, need to also be broken down into states/counties (which the client can add to) but I don't want to be able to see all of these on the landing page as there a lot for some countries. When you select the country you need to be taken to a page specific for that country. Some will have a promotion displayed based on the country. Also on the country page will be a country distributor and either a list of retail stockists (some countries don't have any) or the ability to choose a state or county (as some countries have several states/counties with many retail stockists) which can then be selected to display that state or county's retail stockists.
I have been struggling with this for so many days now that this doesn't seem to make sense anymore - please let me know if you need further clarification.
What I would like to know is how you would set this up in EE which has Structure installed. Assets for each retail stockist? A page for the landing page, a page for the country? Would you use categories for the Region/Country/State? How would you then pull the data into the templates?
So far I have tried using categories for each retail stockist and they are being entered as assets on a country page. I have managed to create a landing page using GWCode Categories which links to the page, but none of the category information is passed to the page. Do I need to use another plugin to get the category information? How would I then display a list of states, if there are any, for that particular country? Am I over thinking this and there is a much simpler way?!
My landing page is stockists/index and has the following code displaying the categories so far (it's a responsive site so I have the countries set up in 3 columns):
<div class="grids grids-three clearfix">
<div class="grid grid-1 clearfix">
<div class="grid-a">
<h2>Oceania</h2>
<ul>
{exp:gwcode_categories
channel="stockists"
cat_id="26"
depth="2"
}
<a href="stockist-details/{cat_url_title}">{cat_name}</a>
{/exp:gwcode_categories}
</ul>
</div>
<div class="grid-b">
<h2>United Kingdom</h2>
{exp:gwcode_categories
channel="stockists"
cat_id="7"
depth="2"
}
<a href="stockist-details/{cat_url_title}">{cat_name}</a>
{/exp:gwcode_categories}
</div>
<div class="grid-c">
<h2>North America</h2>
{exp:gwcode_categories
channel="stockists"
cat_id="8"
depth="2"
}
<a href="stockist-details/{cat_url_title}">{cat_name}</a>
{/exp:gwcode_categories}
</div>
</div>
The country page is stockists/stockist-details and contains the following code which only displays the ENTIRE list of countries and states/counties when you click through to it, but if you select one of the countries or states you get a list of stockist below the huge list of categories.
<!-- STOCKIST DETAILS -->
<div class="stockist-details">
<header>
{exp:channel:category_heading channel="stockists"}
<h1>{category_name}</h1>
{/exp:channel:category_heading}
</header>
{exp:channel:categories
channel="stockists"
disable="member_data|pagination|trackbacks"
}
<a href="{path='stockists/stockist-details'}">{category_name}</a>
{/exp:channel:categories}
<div class="stockist-listing">
<ul>
{exp:channel:entries
channel="stockists"
disable="member_data|pagination|trackbacks"
}
<li>
<h3>{title}</h3>
<p>{stockist_address}<br />
{stockist_city} {postcode_zip}</p>
<p><span>Phone:</span> {stockist_phone}</p>
</li>
{/exp:channel:entries}
</ul>
</div>
<!-- / .stockist-listing -->
</div>
<!-- / #stockist-details -->
I hope that someone is able to make sense of all of this and make some suggestions as to where I'm going wrong, or a better approach. Thanks.