5

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.

1
  • I'm wondering if I should abandon categories all together? Just have a landing page based on the index template, with child pages based on a country template or stockist-details template (depending upon whether they have states/counties or not) which would, in turn, have child pages based on the stockist-details template displaying assets containing the stockists information. Would this work more easily?
    – Mosaik
    Nov 23, 2012 at 10:43

4 Answers 4

4

I would only use categories for details about the retail outlet, like (I'm guessing here) payment types available, stock types available, etc.

I'd create 3 channels, 1) Country, 2) Region and 3) Retailer. Country and Region can use the same field group with just a body field, unless you need additional detail at their levels. I'd have at least a matrix field in the Retailer field group.

Within Structure, I'd set the Country channel to a page, with the Region channel as a child page of Country, and the Retailer channel would be a listing under Region.  Asset would work as well, but pages and assets are on different tabs, so there's a bit of a disconnect.

Use the matrix field on the Retailer entry page for the retailer-specific content, and categories for common details to keep the matrix field manageable.  Or, the retailer entry could be mostly category selections. There are always a few ways to go at things with EE.

This provides an entry interface for your client that's easy to navigate and update.

Haven't used NSM's add-on, but I's say that Low's Seg2Cat would be quite useful in this build.

Might be worthwile to work up a quick prototype with one of the current frameworks to test the logic before you get too far into content entry.

4
  • Thanks for your response. This makes sense to me until I assign the Retailer channel as a listing under Region because you can only assign a listing to one page. So, if I have set up, say, Australia as a country page with it's 6 states as Region pages, I can only assign the listing channel to one of the state's pages. Is that correct? How do I get the retailer information to the other state's pages, let alone all the other countries with their state?
    – Mosaik
    Nov 26, 2012 at 3:09
  • Not sure if I'm interpreting correctly, but the limitation is 1 listing channel per channel, not page. So every entry under Region will have a Retailer listing available.
    – dbigca
    Nov 26, 2012 at 3:19
  • Sorry, yes, I'm mistaken, it is limited to 1 page. Assets under Structure is one way, but I'd go with everything within separate channels, within child pages. Still the easiest for client to manage.
    – dbigca
    Nov 26, 2012 at 3:40
  • Have you done anymore with this, or did you find a better solution? I'm running into the same issue but with States > Cities > Category setup. Looking for something that would be a "best practice" scenario. Sep 3, 2013 at 18:08
3

It's possible that just using pages in Structure will be easier, but a couple of things to consider if using categories: Low Seg2Cat and NSM Categories.

1
  • Thank you. I've read about so many plugins and confused all their documentation! I'll see if these might help me - I'd read about Low Seg2Cat but not NSM Catgories.
    – Mosaik
    Nov 23, 2012 at 11:29
2

Are you able to use Playa and Matrix? If so you could approach this like so:

Your regions would either be categories assigned to a countries channel or they could simply be a select field with all the possible regions listed, even if they aren't used right now.

Each of these countries would then have a matrix list for handling the states. This also allows for more metadata about the states as well. Then in the stockists channel add an EE relationship field (or a Playa field if one stockist can be in multiple countries).

Then your templates simply use conditionals to determine what's being displayed to the user.

1

I'd say categories would work absolutely fine for this and if you ask me make sense. Along with Seg2cat this is another excellent categories handling add-on - http://devot-ee.com/add-ons/gwcode-categories.

1
  • Thanks, yes, I'm using GWCode Categories on my landing page (as per code above). I wasn't sure how to get the categories showing on the subsequent pages but I think Seg2cat may be the way to go. I'll these suggestions and post my progress.
    – Mosaik
    Nov 25, 2012 at 2:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.