James Smith
  • Member for 7 years, 6 months
  • Last seen this week
1 answers
1 votes
146 views
Possible bug when using Entries fieldtype with multi-site
Accepted answer
2 votes

In order to fetch cross-site entries in element queries you'll need to specify the site parameter, otherwise it'll default to the current site only: https://docs.craftcms.com/v3/dev/element-queries/...

View answer
1 answers
1 votes
292 views
Change base URL for email activation link?
2 votes

You can use a Twig replace filter in the email template to replace the URL with whatever you like. (I'm using this method myself because we have a similar problem on multi-site installs). To do this ...

View answer
1 answers
1 votes
49 views
Show custom fields on cart
Accepted answer
2 votes

{% for item in cart.lineItems %} and {% for lineItem in cart.lineItems %} are the same loop - you're just assigning a different name to the iterable item! Just remove the inner loop and rename the ...

View answer
1 answers
1 votes
199 views
Add new error to macro errorList - User Registration
Accepted answer
2 votes

I've done something similar recently... The errors returned by that macro are errors on the user model. Therefore, rather than creating errors on the user session, why not create them on the user ...

View answer
1 answers
1 votes
88 views
Cannot delete user that was subscribed to a subscription
Accepted answer
2 votes

This is a known bug: https://github.com/craftcms/commerce/issues/1048 And some more characters for Stack Overflow's benefit.

View answer
1 answers
1 votes
103 views
EVENT_AFTER_CREATE_SUBSCRIPTION can someone confirm this means successful purchase?
Accepted answer
2 votes

I've looked into this in more detail now, and whilst it used to be the case that EVENT_AFTER_CREATE_SUBSCRIPTION only worked for successful payments, it's now (post Commerce 2.2.0), no longer the case ...

View answer
1 answers
1 votes
989 views
Can I call a dynamically named variable through twig?
Accepted answer
2 votes

Unless I'm misunderstanding, the title of your question is a bit misleading as you're not trying to call a Craft function in Twig, you're trying to output a dynamically named variable (a variable ...

View answer
1 answers
2 votes
271 views
pass data to _layout?
Accepted answer
2 votes

Are you on Craft 3 or 2? In 3, you can use the built-in {% js %} ... {% endjs %} tag to inject scripts into tags named {{ endBody() }} or {{ beginBody() }} that you place wherever you like in your ...

View answer
1 answers
1 votes
20 views
Images uploading corrupt
1 votes

I suggest double-checking that the new server meets Craft's requirements, especially in terms of ImageMagick and/or GD. You can run an automated check using the wizard: https://github.com/craftcms/...

View answer
1 answers
1 votes
31 views
Wrong default mail view directory?
Accepted answer
1 votes

It's not clear exactly in what context you're sending your email (i.e., whether it's in response to some event on the front/back end), but here's an example of how I'd send an email in a plugin or ...

View answer
1 answers
1 votes
19 views
in array not matching
Accepted answer
1 votes

I've bumped into this a few times. It's because entry.fieldHandleName when used on a field type with multiple options (dropdowns/radios etc) is in fact a magic shortcut for entry.fieldHandleName.value....

View answer
4 answers
1 votes
50 views
Querying all content entries for a page
Accepted answer
1 votes

I can see what you're trying to do here, and it's really not a great idea to be honest: Just to clarify for anyone else - we're not talking about "Entry Types" here - you're talking about ...

View answer
1 answers
1 votes
35 views
Freeform to show via Vue Js
1 votes

It sounds to me like you're running into a collision with Vue's template delimiters vs Twig's, which by default are the same as each other ({{ ... }}). The solution is to change Vue's delimiters to ...

View answer
1 answers
0 votes
25 views
Add a form field into the details bar on the entry edit screen and do something with the value
Accepted answer
1 votes

Just take your value direct from the $_POST array.

View answer
1 answers
1 votes
108 views
Redactor adds <figure> to both image and video embeds, how to style differently
Accepted answer
1 votes

It's probably not the answer you want to hear, but the best way to avoid these kind of problems is to modernise your content model so that videos are stored in their own dedicated section, and then ...

View answer
2 answers
1 votes
101 views
Why is Craft loading jQuery via cpresources? And can I stop it?
1 votes

If any of your image transforms have not previously been processed they will make a call to /cpresources/... To prevent this, generate all your transforms before page load with the ...

View answer
1 answers
1 votes
68 views
Eager load commerce order data in custom ElementExporter for Users
1 votes

Your code looks like it actually has a further problem that you're only fetching the first order for a given user. Rather than eager loading (which is basically creating joins so that the relevant ...

View answer
1 answers
1 votes
188 views
Craft Commerce — Update order status from frontend?
Accepted answer
1 votes

This feels a bit dirty, but you can actually do this directly in a Twig template like this: {% set order = craft.orders.id(123).one() %} {% do order.setAttributes({orderStatusId: 4}, false) %} {% do ...

View answer
1 answers
1 votes
163 views
Grouping Super Table Results via Twig Multidimensional Array
Accepted answer
1 votes

For grouping arrays, use Craft's group filter or index filter, then for joining the array items with commas use Twig's join filter. Something like this might be what you're looking for (I've also ...

View answer
1 answers
1 votes
20 views
Direct link to form using freeform
1 votes

The short answer is no... but that kind of thing is not really Freeform's responsibility - Craft gives you the flexibility to output whatever you want wherever you want, but in order to do so you need ...

View answer
1 answers
1 votes
44 views
Search form - Passing only field params that are not empty or selected
Accepted answer
1 votes

That's just the way forms work in html. If you don't want to use a POST method, (because that would make the results not URL-addressable at all), I'd recommend using an intermediary Twig template to ...

View answer
1 answers
1 votes
34 views
Problem with SUM on Matrix blocks
1 votes

I haven't tested this, but I think .sum() will execute your query, so put it at the end: {% set reimbursementAmount = craft.matrixBlocks() .relatedTo(cat) .fieldId(9) .specialCase(':empty:') ....

View answer
2 answers
1 votes
279 views
How to check if an entry is enabled for a particular site?
1 votes

Just in case it helps anyone else, here's a reasonably efficient complete template I needed which outputs entries and their per-site statuses: {% set entriesQuery = craft.entries .siteId('*') ....

View answer
2 answers
1 votes
63 views
How to loop through multiple entries fields
1 votes

You don't mention what your related entries field handle is, but remember that calling any related element (entries/assets/categories/users/tags) will require a .all() (or .one() or .ids() or one of ...

View answer
1 answers
1 votes
113 views
Forgot Password - Success Message/Flash Message after setting new password on the login screen
1 votes

The way I handle this is by simply includeing the same template as the login page and passing a Twig variable along with it. So more specifically, my setPasswordSuccessPath is set to a unique template ...

View answer
1 answers
1 votes
55 views
Display related entries on a category page filtered by another category field
Accepted answer
1 votes

You'd typically use the group filter for this. Depending on what you need to output, be sure to also use eager loading to improve performance. {% set groupedEntries = craft.entries.with(['...

View answer
2 answers
1 votes
41 views
How can I ensure certain items always display at the end of a list?
1 votes

How would you like to identify that particular entry? If you're happy to hardcode its id, then I'd do it like this with the filter filter and the without filter: {% set allEntries = craft.entries....

View answer
1 answers
1 votes
25 views
Use locale not included in Craft
1 votes

I think you should be ok to just copy the ca_ES file and rename it to whatever handle you like. Full instructions here: https://craftcms.com/knowledge-base/adding-additional-locales-in-craft-2#...

View answer
3 answers
1 votes
148 views
Order Entries Query by a Featured Light Switch
1 votes

You're looking for the filter filter. Here's how you might do it: {% set entriesInCat = craft.entries.relatedTo(category).all() %} {% set featuredEntriesInCat = entriesInCat|filter(entry =&gt; entry....

View answer
1 answers
1 votes
24 views
How to show to profile related data inside Users page in admin dasboard, also showing some addtional filters
Accepted answer
1 votes

I might be misunderstanding your question, but you can choose which columns are shown on all of Craft's element index pages using the little cog at the bottom of the sub-nav sidebar. You can also add ...

View answer