Jump to content

Outcydaz
 Share

Recommended Posts

I have a site structure as follows

Shirts
-- Shirt One
-- Shirt Two
Shoes
-- Shoe One
-- Shoe Two

Category
-- Spring Summer
-- Fall Winter

Each page has a 'category' page field.

I'm trying create a navigation that shows only the child categories as follows:

Shirts
-- Spring Summer
-- Fall Winter
Shoes
-- Spring Summer 
-- Fall Winter

When Shirts -> Spring Summer is clicked i'd see only spring summer shirts. Same for Shoes, you'd only see Spring summer items for shoes.

Help please.

 

Link to comment
Share on other sites

You can use URL segments for the category name. Or a GET variable - the principle is the same but the URL segments are nicer. Look for the URL segment in your template and then use it in a selector for your product pages.

If you read through Ryan's URL segments tutorial you should get the gist of it.

Make your navigation links by iterating over the category options, or if you want to get fancy, just the categories that are used by products in that section.

Link to comment
Share on other sites

1 hour ago, Robin S said:

You can use URL segments for the category name. Or a GET variable - the principle is the same but the URL segments are nicer. Look for the URL segment in your template and then use it in a selector for your product pages.

Thanks for the quick response. The first paragraph in your answer threw me off a little. Would i have to activate URL segments on the Category Template OR the Category Child Template? Otherwise would URL segments have to be enabled in the product templates instead?  Thank you.

Here's and example of what i'm hoping to achieve. http://www.etro.com/en_wr/ 'Man' and 'Woman' under collections both have the same categories i.e. 'Autumn Winter 16-17' although they list different items for 'Man' and 'Woman'F / .W 2016 -17

Link to comment
Share on other sites

You would enable URL segments on the template used for "Shirts" and "Shoes". You would allow segments that match the names of your category pages and throw a 404 for anything else.

For example:

if($input->urlSegment1) {
    $category_names = $pages->find('template=category')->explode('name');
    if(in_array($input->urlSegment1, $category_names)) {
        // build your selector to filter the products using $input->urlSegment1
    } else {
        throw new Wire404Exception();
    }
} else {
    // show all the products
}

 

  • Like 2
Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...