We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

how to handle this? channel entry with many common assets, but not 100% common

How Do I?

liberty79's avatar
liberty79
135 posts
8 years ago
liberty79's avatar liberty79

racking my brain on this one!

Let’s say I have a product line…we’ll use bicycles for an example. Each bicycle is available in 10 colors; the same 10 colors across the entire product line.

I have generic color swatch images for each color (a green square, a red square, etc). These can be shared across the entire product range. On each bicycle model page, I have a grid/table showing all of the available colors.

That would be easy to do: just use an embedded template for each bicycle model.

THE HARD PART:

For some of the bicycles, I have an image of the color on a photo of the actual bicycle, and I’d like to show that instead of the generic color swatch. So some pages would show that same color grid, but if I have an actual photo of the bicycle in green, I’d like to show it instead of the color swatch.

I can’t think of a good way to do this. I could have a custom field for each color and manually load each and have some conditionals that say “if {green_img} exists, show {green_img}” but that’s not possible if there are hundreds of products.

Does anyone have any suggestions? I appreciate your brainpower and time on this one!

(edit: i’m attaching a very simple graphic to demonstrate what I’m talking about)

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
8 years ago
Ingmar Greil's avatar Ingmar Greil

A quick approach: each bicycle is an entry in your channel, and each entry has custom fields; you leave them empty unless there’s a special image to show. In your template, you check for those custom fields and provide a default value if they’re empty. Makes sense?

       
liberty79's avatar
liberty79
135 posts
8 years ago
liberty79's avatar liberty79
A quick approach: each bicycle is an entry in your channel, and each entry has custom fields; you leave them empty unless there’s a special image to show. In your template, you check for those custom fields and provide a default value if they’re empty. Makes sense?

it does make sense and I appreciate the reply.

I’m leaning this way unless I can come up with something different. The only problem to that approach is that I was hoping the custom fields for the bicycle would be a little more evergreen than that. For example, if the next year’s lineup has totally different color options, I don’t want to have “Bicycle Channel Fields 2016”, “Bicycle Channel Fields 2017” etc. Though that may be the only way to go.

Thanks again!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.