0

I search how to have a entry with multiple pages if the product created has multiples colors.

Indeed, i work on a product website and my client want to have the possibility to define a product in different color but he wants one channel in admin but several pages in front-end. And in search system, he wants to find only one product :-(

There is a possibility (module, add-on, custom field) to have a system in admin when it's activate it's create multiple pages but with only one channel.

I hope someone'll understand what i try to do :-)

Thanks.

1

This is perfectly feasible in EE without any add-ons. Since EE doesn't really have a concept of pages, a single channel entry can appear at multiple URIs no problem - You'll just need to use some logic in your template to show the right entry.

There are lots of different ways to approach this, but let's say you want your URIs to be:

/products/widget-A/in/blue
/products/widget-A/in/red
/products/widget-B/in/blue
/products/widget-B/in/red

You could use a category or custom field to define the colours and then pipe the values through to a channel entries query. For example, with categories, your products/index template could look a bit like this (also using Low Seg2Cat to get the cat ID here):

{exp:channel:entries
    channel="products"
    disable="member_data|pagination"
    dynamic="no"
    category="{segment_4_category_id}"
    url_title="{segment_2}"
    limit="1"
}
    <h1>{title}</h1>
{/exp:channel:entries}

You could do the same thing with a custom field, such as checkboxes or radio buttons and the search parameter. Just be a little bit careful that you don't pipe URI segments directly into a channel entries tag as this could be a (minor) security risk (exposing private entries etc if you're not careful). I would usually use Stash to pre-screen/normalise any incoming segments to prevent this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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