New answers tagged

1

The results query could not be the same, you have to separate them. use craft\commerce\elements\Product; use craft\elements\Entry; return [ 'endpoints' => [ 'search/product.json' => function () { // settings $phrase = Craft::$app->request->getParam('query'); $criteria = [ 'search' ...


2

Entry templates are assigned on a per-section basis, and each section can only have a single entry template per site. The workaround is to create a "proxy" template and use that as your section's entry template. The only responsibility for the proxy template is to {% include %} another template (the actual entry template), based on some conditions. ...


2

I believe you're looking for something like: $purchasable->product->yourEntriesFieldHandle->one()->title


2

With the help of Oli from Craft, it turns out the solution is simpler than I thought: {% set items = craft .entries() .section('works') .anyStatus() .all() %} This returns all entries, enabled and disabled.


1

No, but make sure devMode is turned on in your development environment.


2

This worked just fine. https://craftcms.stackexchange.com/a/35846/10953 I did all steps execpt steps 3. and 4. Thanks all!


3

At the risk of being too general/closed for off-topic, before you choose any platform, I would ask these questions: What sort of functionality does your client require—now or in the future? What kinds of products will the store support (eg bundles, custom products, variants, donations, etc). What sort of budget / developer support can the client support or ...


2

Try this: {{ sprig('_layouts/_categories/_loadMore', {limit: 6, category: category}) }} {{ sprig.script }} After query category is not defined.


1

I think you need to make two separate queries, get two arrays, combine them using the merge method and leave them unique, since these are different searches, textual and by related elements. It's like a quick fix, if I find something I will answer.


2

Sprout forms has hooks you can latch on to in your own custom module/plugin, so when a form is saved you can grab the asset and re-name at that point.


3

If you are faced with such a task, then I think it's better to use user IDs, getting from the method a ids from the field in which users are stored, and check the received array using the in method. Another option is a plugin https://plugins.craftcms.com/user-group-field. {% set usersIds = entry.usersField.ids %} {% if currentUser.id in usersIds %} ...


2

As of Craft 3.5, that setting will be disabled by default when creating new fields (see craftcms/cms#6390).


0

From a quick look at the code, I think you can pass enabledForSite: [true, false] to get both the enabled and disabled entries. So in your case: {% set items = craft.entries({ section: 'works', enabledForSite: [true, false], status: [ 'live', 'pending', 'disabled', 'expired' ] }).all() %}


1

This is a known issue with dompdf on php 7.4: https://github.com/dompdf/dompdf/issues/2003 You can either downgrade your php version to 7.3 or install dompdf/dompdf 0.8.4.


1

We were having the same issue. Our logs were getting so dense with SQL statements that it was hard to find our errors. And for the most part, seeing Craft's internal SQL would not help us debug the problem. What we've found is we can use the onelogger plugin. After installing it, we just needed to add a file called onelogger.php to our config file. This ...


1

Maybe this reference helps you; https://docs.craftcms.com/v3/date-time-fields.html Your date field will be like this. {% set tz = craft.app.getTimezone() %} {% set df = craft.app.locale.getDateFormat('short', 'php') %} <input type="text" id="startDate" name="fields[startDate][date]" {%- if user is defined %} value="{{ ...


1

For me, saving dates as a timestamp seems to do the trick to correctly save to the date field in Craft. You can still use the datepicker and have the human readable date, just use the altField and altFormat options (https://jqueryui.com/datepicker/#alt-field) to fill a hidden field with the timestamp that gets submitted.


2

You could add a new param to the request called skip and use that on your homepage, and default it to zero to allow you to reuse the endpoint elsewhere. $skipEntries = Craft::$app->request->getParam('skip') ?? 0; $criteria = [ 'section' => $settings['section'], 'limit' => $settings['limit'], 'offset' => ($settings['limit'] * ...


1

Craft are hoping to release this as an update to Commerce in the next month or so!


2

If you always want to skip the first 6 entries, you can modify the Element API endpoint to add 6 to the offset number in the query criteria: $criteria = [ 'section' => $settings['section'], 'limit' => $settings['limit'], 'offset' => ($settings['limit'] * Craft::$app->request->getParam('offset')) + 6, 'order' => $settings['...


2

Here's a cut-down version of what I'm using on https://cld.agency/showcase It's using jQuery because that's the way I like it: {% set theLayout = craft.app.request.isAjax and not craft.app.request.isLivePreview ? '_ajaxLayout' : '_layout' %} {% extends theLayout %} {% set entries = craft.entries.section('news').limit(12) %} {% paginate entries as pageInfo, ...


Top 50 recent answers are included