Questions tagged [craft3]

For use with questions relating to the Craft 3 version of Craft CMS, including the Beta and RC releases.

329 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
0answers
335 views

Search weighting

Is there a way to control the weighting of certain fields in Craft when using search in the front-end? I have a Products Channel which I am trying to search against and I want to be able to boost ...
5
votes
0answers
515 views

Autocomplete for Visual Studio Code for plugin development

How to achieve autocompletion for Craft 3 for PHP inside Visual Studio Code? I mean, what is required (like installing PHP locally, folder structure etc.) if at all possible? I assume many people who ...
5
votes
0answers
356 views

How to load components into Craft 3 plugin?

what is the correct way to load third-party components into Craft 3 plugin I'm developing? I tried adding $this->setComponents([ 'authClientCollection' => [ 'class' => '\yii\...
4
votes
0answers
831 views

How to handle Craft 3 events in a plugin? Element API is returning null data

The below refers to Craft 3 and the Element API plugin for Craft 3. I would like to do something when the Element API plugin fires its onBeforeSendData event, I can see in the controller for element ...
3
votes
0answers
811 views

Multiple Entry Types on GraphQL Fragment

So I am building out a Gatsby Site, which is using Craft in Headless mode as it's content source. In one Section, I have three entry types. Currently they have identical fields, but may diverge in the ...
3
votes
0answers
57 views

Freeform: Change field conditions between multi-page forms

I'm trying to only show some fields on Page 2, if a condition from a <select> box is met on Page 1. However, when I add Field Rules, I only have access to fields from the same page of the form. ...
3
votes
0answers
252 views

User Event before Login - check if user has password and logged in before

Is there a User Event before the authentication is fired? I want to show a message if the user doesn't have a password yet and if it's his first login / check if he never logged in before - All in ...
3
votes
0answers
107 views

Craft Commerce: Create new shipping zone by excluding other zones

I need to create 3 shipping zones in Craft Commerce 2 (currently on v2.1.7): UK Europe Rest Of The World Having to manually add the countries to the UK and Europe zones isn't too much of an issue, ...
3
votes
0answers
549 views

Searching for Multiple Categories and Tags

I've been pulling my head for the past day on how to filter products with multiple categories. After a long search, I found and implemented on my project, Advanced Search with tags and categories It ...
3
votes
0answers
412 views

Mailer config in Craft 3 not getting merged

I have this custom config in config/app.php, but Craft seems to keep using the default Control panel Sendmail config. It seems this doesn't get merged in the main.php file. (as promised) return [ '...
2
votes
0answers
27 views

Express Form: Get submitted data on success page

I have a very simple question. In Craft CMS, using Express Forms (free edition), I have a classic scenario. Page with the form, created by the form.openTag() method A success page which has '/success'...
2
votes
0answers
32 views

Disable Two-Step Publish Workflow?

I recently updated to Craft v3.6, which appears to have changed the publishing workflow to require first publishing the draft, then saving the file in order to get back to the entries list. Is there ...
2
votes
1answer
119 views

How to define table attribute in the record file

Following code is working on Craft 2: class My_TableRecord extends BaseRecord { public function getTableName() { return 'my_table'; } protected function defineAttributes() { return [ ...
2
votes
0answers
276 views

How to Upload Multiple Assets Using Frontend Form

I'm trying to create a more interactive experience to upload moultiple images on a frontend entry form. Things I have done: I have implemented the code here: https://docs.craftcms.com/v3/dev/...
2
votes
0answers
52 views

Restricting entry editing in the admin section

We have custom permission setup where we have certain admins that are only allowed to edit specific entries. This is done by modifying the entries sources: Event::on( Entry::class, Element::...
2
votes
0answers
214 views

How to wire html template to twig extension? (Mainly `Twig\Error\SyntaxError: Unknown filter Error`)

I am going to use a Twig filter function by using Twig extension in my HTML file. I followed this guide. https://cameronspear.com/craft-cms-twig-filter-extension/ But when I run <p>{{ 123 | ...
2
votes
1answer
332 views

How can I debug `craft\web\User::_validateUserAgentAndIp()` warnings

On a production site, we're seeing a ton of the following warning in our web.log files for (seemingly) every request, creating a ton of noise in the logs and making it hard to spot "real" issues: &...
2
votes
0answers
198 views

change core element index pages

Is it possible to change core elements index pages -like entry index page- by plugin in PHP way, like extending their twig, using events, hooks and not manipulating DOM with Javascript? Currently ...
2
votes
0answers
165 views

Project config only partially syncing

Not sure if this belongs here but decided to post it after all... I've set up a craft site (Version 3.3.x) and since we're about to add more sites to it etc, we decided to start using a project ...
2
votes
0answers
167 views

Line item not found when trying to remove item from cart

I'm trying to remove a product from a cart but i'm getting an {error: "Line item not found"} error and I can't figure out why. Here is my code: $('.js-item').on('click', function(e) { e....
2
votes
0answers
453 views

How to download private assets (without public URL) from dashboard

I would like to download asset files from Craft 3 dashboard. Those files are out of web folder because of security reason. I made "documents" folder just under the root of the project, and the files ...
2
votes
0answers
218 views

Move an asset to another volume with volume specific OptimizedImages Field and on the entry a volume restricted Asset Field

I have three volumes: content, hero and overview. Each volume has his specific OptimizedImages Field(s). Asset Fields are restricted to its specific source volume. For example: A Super Table Field ...
2
votes
0answers
298 views

Diagnosing Slow Database Connection for Entries (Frontend and Craft Admin)

We have set up a remote database connection for Craft CMS so that I and my colleague can work on the same database locally. The connect seems very slow both front end and in the admin area. ...
2
votes
0answers
354 views

Group by Date Field in Element API Query

I have a custom field called releaseDate in one of my entry types. I would like to use Element API to get all the distinct years assigned to those entries. I dump all the years for all entries just ...
2
votes
0answers
268 views

Craft reCAPTCHA Plugin (Matt West)

Has anyone tried using the Craft reCAPTCHA plugin from Matt West? The issue I am experiencing is that if a Contact Form is submitted without ticking the reCAPTCHA widget, the form does not submit - ...
2
votes
0answers
77 views

Add custom column to the orders list page

Does anybody know if it is possible to add a column to the orders list page? I can choose the 'Foo' label, but when the page want to show the orders list I get the following error: "{"error":"An ...
2
votes
0answers
89 views

Recommendations on integrating Craft 3 and FormAssembly

I was wondering if anyone could give me some advice. We have a client that we are in the process of moving away from a Drupal build to a new Craft build, however, they have a large number of forms ...
2
votes
0answers
146 views

Track downloads on assets

I need to figure out if there's a way to track the amount of times an asset was downloaded. I need to display this in the back end on the site. I don't need to display it anywhere but on the back end ...
2
votes
0answers
60 views

Creating an archive with linked asset

I'm trying to create an archive of PDF newsletters in Craft 3. I want to create a list of entries sorted by month and year. Then each year would appear separately. Finally, I want each asset within ...
2
votes
0answers
433 views

Craft Commerce 2: Adding subscriptions to cart

I am porting a Shopify "multi-site" to CraftCMS using Commerce and I need to be able to add subscriptions to the shopping cart (customers can subscribe to a monthly box), together with other products. ...
2
votes
0answers
632 views

Craft 3 Plugin - Only default action works

I'm working on a Cloudflare integration plugin for Craft 3. I set up the plugin with settings, which works fine so far. Now I intended to verify the Cloudflare credentials using an AJAX call. I set ...
2
votes
0answers
445 views

Can't find assets publicly via URL

Basically, I have an asset volume called Images, with base URL: /photos/ file system path: ~media/images Then I go to upload the asset and I try to view it, it gives me a 404 "Template not Found" ...
1
vote
0answers
8 views

GraphQL next does not accept 'relatedToCategories'

I'm trying to get the next project in the "projects" section but with the same category. So because I can't do it in one query (the value of my category is in the result), I do another query ...
1
vote
0answers
32 views

Element API relatedTo not working

I'm creating a lazy load/infinite scroll based on the tutorial but I want it to grab entries that are in categories. It doesn't seem to be doing anything with it at all though. It's returning the list ...
1
vote
0answers
47 views

Help with understanding Controller routing

I'm building a module, and all is going well. I can access all "routes" except actionIndex. I have a controller named SendController.php And, I can access the method below using "...
1
vote
0answers
23 views

Removing or hiding certain fields from the CP new entry for a specific user group

I'm trying to make some fields unavailable for a certain user group when they create or edit a new entry. These fields should only be available to admin users. I had implemented this by extending the ...
1
vote
0answers
24 views

Non-admin users cannot preview/view entries when site front end is disabled (multisite)

I am running a multisite setup on 3.6.11.2. We are attempting to generate a new site and while we work on the structure/content I have the 'Enable on the front end' setting switched off. As an admin, ...
1
vote
0answers
28 views

Craft 3 entry.author.getPhoto() is coming up null on template, but the author has a photo uploaded in the user > details section, any ideas why?

The site is utilizing a Servd bucket to store all assets. The backend shows a photo successfully uploaded to the user > details section, but does not provide a url in the entry.author.getPhoto(), ...
1
vote
0answers
33 views

Problems cloning an old production Craft CMS project

I'm attempting to clone a craft CMS (v3.3.15) project into a new local development environment and as expected, I'm experiencing many dependency issues. For various reasons, including having to ...
1
vote
1answer
87 views

how to get request url?

I'm trying to get url from request, {{ craft.app.request.url }} but the uri is chinese, like "localhost/測試", it print out "http://localhost/����" did i miss some setting in craft ...
1
vote
0answers
107 views

Craft warning: Tried to release a savepoint, but it does not exist

I'm working on a plug-in for Craft 3. For this plug-in is a migration is needed. When this migration runs and adds the entries, fields, and groups then the following warning occurs in the logs. [...
1
vote
0answers
50 views

How to programatically (e.g. in a custom a plugin) create a Discount Code? (Craft Commerce)

I've been working on some custom plugins recently to handle various bits of API functionality for the project I'm working on, and I'm now roughly familiar with Craft's OO approach to carrying out this ...
1
vote
1answer
64 views

Craft Setup 3.6.5.1 with MYSQL with SSL version 5.7.29

I'm trying to install Craft version 3.6.5.1 with MYSQL version 5.7.29 from Azure. While setup it fails with the following error Testing database credentials ... failed: SQLSTATE[HY000] [9002] SSL ...
1
vote
0answers
90 views

Craft Commerce 3 calling commerce/payments/pay from Axios returns errors

I have headless Craft CMS + Craft Commerce 3 + Mollie for Craft Commerce as backend and decoupled Nuxt.js frontend I'm trying to use POST request to "?action=commerce/payments/pay&note=from+...
1
vote
0answers
27 views

Update field within Table using column handle in CraftCMS

I am writing a CraftCMS plugin out of which I need to update an existing Entry. Within this entry there is a field of type table which has some columns (with custom handles). No I d like to update one ...
1
vote
0answers
44 views

autoLoginAfterAccountActivation doesn't seem to be working

In the midst of an upgrade from 2 > 3 (Commerce on top of that too). When a user creates an account, it fires an 'Activate your account' email That email goes through to account/activation-success ...
1
vote
0answers
25 views

Translation filter in Sprout Email plugin

I would like to make a notification of Sprout Email plugin bilingual. However, in the body field, the translation filter does not work. The tag of {{ fieldname.label|t }} is not translated. How is it ...
1
vote
1answer
69 views

How to auto enable a plugin after install?

I am developing a plugin for craft 3 and the plugin just got published to the store. I can browse through the store and install the plugin but it stays disabled. The user will have to goto Settings -&...
1
vote
1answer
116 views

Get entry by language in a module

I'm trying to get some auto translating done in a craft module. In order to do this I need to get the entry of another language in a save event. Is it possible to get this by language? Event::on( ...
1
vote
0answers
94 views

Test Craft Plugin without the use of a database

We'd like to add Unit Tests to our Craft Plugin. I have used the Plugin Factory generator to generate the files and the basic setup seems to work. I am however struggling getting the tests to work ...

1
2 3 4 5
7