Skip to main content

New answers tagged

0 votes

can I 'switch' entry types rather than using if statements?

If your projectData is static, I would not use case, in this case. {% set projectData = { 'clients': entry.clients.all(), 'partners': entry.partners.all() } %} {% for key, data in projectData ...
geschud's user avatar
  • 11
0 votes

How to query variants for structured products (commerce 5.2) to sort products

Tweak your code a bit. Instead of using hasProduct, which can jumble up the order, call variants on each product as you loop through: // grab current category to filter products {% set currentCategory ...
RitterKnight's user avatar
  • 6,582
0 votes

can I 'switch' entry types rather than using if statements?

I figured this out — with a steer from the help here and also Ryan Irelan's article Seems I needed to 'gather' my entry types before running the switch... I'm sure there's other ways to achieve this, ...
dezbat's user avatar
  • 45
0 votes

can I 'switch' entry types rather than using if statements?

If the switch can be made based on entry.type, I might suggest: a separate twig template for each entry type. one template as an entry point. I assume this is the situation you have 2 entry types: ...
geschud's user avatar
  • 11
2 votes

can I 'switch' entry types rather than using if statements?

Yes, you can. Switch is not native to Twig, but Craft adds its own switch tag to the language, as per the Tags documentation here, which works exactly as you have demonstrated: https://craftcms.com/...
James Smith's user avatar
  • 5,689
0 votes

“email: Unable to save user:” Craft Solo & Commerce 5: Guest Checkout fails

I imagine a 'Guest' in this context is simply an un-priveleged, un-authenticated user, against which the order is stored. Not sure how else Craft would be able to create an order, if not against a ...
Seth Warburton's user avatar

Top 50 recent answers are included