MoritzLost
  • Member for 10 months
  • Last seen this week
How can I display just the "lowest" categories assigned to an entry and not parent categories?
1 votes

A bit late, but I've just come across this very problem and found a solution that works well enough. Thought I'd post it here in case anyone is trying to do something similar. As far as I can tell, ...

View answer
Filter a channel entry by dropdown value inside a matrix related filed
Accepted answer
1 votes

Relations won't work here because they only apply to elements (Entries, Categories, Assets, etc). Instead, you can use the field handle to filter by field values depending on the field's type. See, ...

View answer
Cumulative Addition of Matrix field elements with Feed Me
Accepted answer
1 votes

In general, Matrix fields support delta saves, so you can mix existing blocks with new blocks when saving matrix fields. This is documented here. Retaining existing blocks involves passing a sortOrder ...

View answer
Template URL/path alias
1 votes

For the entry URI format, you can use Twig, so you can include environment variables in the URL of an entry: {{ getenv('CURRENT_THEME') }}/{slug} However, the entry URI is parsed when the entry is ...

View answer
Converting nested XML (SOAP) feed to HTML
1 votes

Still not quite sure I understand the problem completely, but here are some ideas to get you started. Your workflow requires three steps: Fetch the XML data from the external API. Parse the XML (the ...

View answer
Craft Event Date Range in Craft
1 votes

To debug issues like this, you can put {% dd %} tags in your template to inspect the value of variables and find errors in your logic: {% dd currentDate %} The main issue with your template is that ...

View answer
Is It Possible to Hide the Plugin Store in the Production Environment?
Accepted answer
1 votes

You can use an event hook for the event Cp::EVENT_REGISTER_CP_NAV_ITEMS to modify the Control Panel navigation – see Control Panel Sections in the documentation. To determine if the site is in devMode,...

View answer
Set Default Shipping Option for specific User Group
1 votes

Based on your comment, you're probably just missing quotes around the shipping handle: {% elseif cart.shippingMethodHandle == 'regularFreightPrepayAndAddToPurchaseOrder' and (currentUser.isInGroup(...

View answer
Loop when removing existing ID's
Accepted answer
1 votes

Based on the example you linked: You can prevent duplicate entries by explicitly excluding the entries you've already seen using the id method. Since you already have an array of IDs you have already ...

View answer
Update matrix block field before saving entry
Accepted answer
1 votes

Looks like you're not actually saving the block with the lightswitch field. Try adding this after setting the blockProcessed value: // Update lightswitch field in current block in Entry $block->...

View answer
Reapplying Users and Related Content to Database During Pipeline Promotion
Accepted answer
1 votes

I started this out as a comment but it got too long. Maybe not a complete answers, but some thoughts on your proposed solution. I think the key point to contest (when talking to your management) is ...

View answer
Creating a channel (or entries) using a similar channel
1 votes

You define the template to load for a channel's URL for each site in the site settings on the section settings page. See the screenshot below: In the table at the bottom, you can set a URL format for ...

View answer
Using a language cookie with Craft
1 votes

You need to modify your language switcher to redirect to the current entry with the URL appended. You can use Entry::getSupportedSites() to get an array of all sites the entry exists in. If all your ...

View answer
Filter entries based multiple category groups
1 votes

You can use either query parameters or a second URL segment to have both the store and the country available for filtereing. For example, let's say your base URL for a store page is something like ...

View answer
Supertable bilingual (multi-site)
1 votes

Usually, site association for elements is controlled using the $siteId property. Try this: $superTableData['new1'] = [ 'type' => $blockType->id, 'enabled' => true, 'siteId' => ...

View answer
Persist session from frontend login form to craft dashboard on headless install
1 votes

You can use defaultCookieDomain config setting to make all Craft cookies use your root domain: // config/general.php // mind the dot at the start 'defaultCookieDomain' => '.mydomain.com', This ...

View answer
Craft Script: Environment variable GLOBAL_DB_DRIVER was neither 'mysql' nor 'pgsql'
1 votes

The error you're seeing is probably caused by this: ./.env.sh: line 128: $'\r': command not found This error indicates that your OS doesn't recognise the line endings in this file. This means the file ...

View answer
Display entry data dynamicly in textfield
1 votes

Instead of splitting the content up into multiple fields, you can put your editors in charge of outputting the product headlines by using reference tags. So your field content could look like this: {...

View answer
How to reference a specific Sprout Form by handle?
1 votes

The error indicates that SproutForms::$app is not an object, which would mean it has not been initialized yet. If you look at the source code, you can see that SproutForms::$app is a static property ...

View answer
Cropping with NY Studio Image Optimize Plugin
Accepted answer
1 votes

Have you checked the documentation for your plugin? You can configure image variants and force specific aspect ratios in the field settings. If you don't want to configure those sizes for the entire ...

View answer
What is the best way to create a designed Facebook feed on Craft CMS website?
1 votes

If you don't want to directly embed a Facebook feed using the Page Plugin, you'll have to either use Facebook's API directly or find a third-party service to take care of this for you. Facebook API ...

View answer
Twig Template spits out jibberish when trying to access user-defined fields
1 votes

I'm assuming that groupChair is an entries field, correct? So what you're expecting from groupChair is a related entry associated with the current entry through that field? The output you're seeing is ...

View answer
Search results URL appearing in search results
1 votes

Without access to the code, it's hard to tell you where the error lies. There are multiple ways to build a search functionality both using built-in Craft functionality, custom code or external ...

View answer
Sequential numbering from global field
1 votes

You can use event hooks to hook into the saving process for elements to achieve this behaviour. In particular, you can use the hooks Entry::EVENT_BEFORE_SAVE and Entry::EVENT_AFTER_SAVE to perform ...

View answer
Craftcms 3 Module - API call validation (on EVENT_BEFORE_SAVE, EVENT_BEFORE_VALIDATE, EVENT_AFTER_VALIDATE, EVENT_AFTER_SAVE)
Accepted answer
1 votes

You can check if an element is valid by calling Entry::validate() yourself. The problem is that if you do that inside the EVENT_BEFORE_VALIDATE hook, it might cause an infinite loop (not sure if Yii2/...

View answer
Using sprig for category filter but keep getting deprecation errors
1 votes

One thing that stands out is that you're checking myQuery | length instead of items | length. Though I've tested it and this doesn't actually cause a deprecation error in my setup. Have you tried ...

View answer
How do you call an asset field from an entry Craft CMS 3?
Accepted answer
1 votes

The documentation on this is a bit scattered about, it took me a while to get the whole picture as well. You need multiple pieces of information: The documentation on querying assets only mentions ...

View answer
get next entry with entry.getNext(), based on a multiple category filter
1 votes

Your entry detail page needs to be aware of the filters applied on the overview page in order for this to work. I see a couple of ways to do this: Whenever the filters change, use JS to make an AJAX ...

View answer
How to Auto-generate a Title based on a multiple entries titles? (using a Entries field type)
1 votes

Not sure if this can be done in the shorthand syntax, but you can do this using Twig for the dynamic title format. The key is to use map to turn an array of entries into an array of titles and then ...

View answer
TWIG dataUrl function for resized images
1 votes

You can use Asset::setTransform or Asset::copyWithTransform to get (a copy) of the asset object with your transform applied. Then you can pass that into dataUrl(). {# Apply the transform to myAsset ...

View answer