Hot answers tagged

3

The error indicates that you're type-hinting the wrong class. Note this line in the error message: Argument 1 passed to amss\amss\AMSS::amss\amss{closure}() must be an instance of amss\amss\RegisterComponentTypesEvent, instance of craft\events\RegisterComponentTypesEvent given This comes from the type-hint in your function: function(...


2

We will need to uncomment this line to allow |filter used in condition formulas: https://github.com/craftcms/commerce/blob/develop/src/services/Formulas.php#L198 If you do that manually yourself this formula works: order.lineItems|filter(v => (v.sku == 'BBB' and v.qty >= 3) ) You were missing the v. in front of qty. Look in the next version of commerce ...


2

I've never had a lot of luck using the custom styles drop down to do things like this, so I created a Redactor plugin that inserts a class name drop down directly to the image edit modal. Full code and documentation is here: https://github.com/simplicate-web/redactor-image-class When I saw your question I realized I could whip this up pretty quickly by ...


2

The debug toolbar is available to Admin users only, see https://craftcms.com/features/all#debug-toolbar There's no way of customising this, the line of code that enforces it can be seen at https://github.com/craftcms/cms/blob/a859f09df6d90bfa92ca1818418eab508c0e82df/src/web/Application.php#L405


2

You can use $this->handle to access the field handle. Make sure you're using the trait craft\base\FieldTrait which includes the handle property.


2

For anyone who may come to this in future, I've found a workaround that achieves the same thing: Retrieve data from each matrix block separately do any filtering needed on each block separately merge the two resulting arrays, and use the 'sort' filter https://twig.symfony.com/doc/3.x/filters/sort.html Resulting code is as below: {# Get data from first ...


2

Craft cms provide a plugin to convert currency. Here is the link: https://github.com/leowebguy/craft-currency-converter You can use this plugin as we have already used it and it's very easy to implement with Craft Commerce. You can convert the currency value using one line code in a twig template using this plugin. This plugin is using rapidapi for live ...


1

There are so many Extensions available on visual studio code. You can install for the language snippets, for auto-suggest code, and for checking syntax. If you are looking for the debug page load process then you have to try the default debug toolbar of Craft CMS. To enable the default to debug toolbar you can go to the profile page -> Preferences from ...


1

You can use the level() parameter (docs) on your query: {% set entries = craft.entries() .section('yourSectionHandle') .level(1) .all() %}


1

This looks like it’d be in a closure registered on the UrlManager::EVENT_REGISTER_CP_URL_RULES event, like this: Event::on( UrlManager::class, UrlManager::EVENT_REGISTER_CP_URL_RULES, function (RegisterUrlRulesEvent $e) { $e->rules['my/route'] => 'module/controller/action'; }); The above explains it almost in context—when ...


1

I'm going to lay out the answer here, in case someone else runs into someone else's issue. We are using Postmark to process emails. All of the failures in the queue are email addresses that have previously hard bounced in postmark. The reason it's always the shipping confirmation email has nothing to do with the shipping confirmation email, but the fact that ...


1

Instead of using the native multiselect field, try using one of these plugins... LJ Dynamic Fields Super Dynamic Fields Either of them should allow you to create a dynamic multiselect field.


1

Please follow the below steps. Use a sorting class for each field. <table class="data"> <thead> <tr> <th class="sorting" >Name</th> <th class="sorting">Age</th> <th class="sorting">City</th> <th class=&...


1

In viewController you can simply access your method like this: public function actionDetails(){ $data = DefaultController::statistics(); return $data; } I hope this will help. Thanks.


1

From 3.6.0, siteUrl has been deprecated, instead, in your instance, you could use {{ alias('@web') }}.


Only top voted, non community-wiki answers of a minimum length are eligible