Questions tagged [craft3]
For use with questions relating to the Craft 3 version of Craft CMS, including the Beta and RC releases.
1,901
questions
1
vote
0
answers
7
views
Object of class craft\commerce\models\ShippingMethod could not be converted to int Error generating from craft commerce
At a little bit of a loss here, just updated a Craft 3 site and I've started getting an error thrown whenever the cart is accessed.
Relevant updates were:
CraftCMS 3.7.11 -> 3.7.27.2
Craft ...
1
vote
1
answer
27
views
With GraphQL why am I getting the error "Cannot query field \"save_personEvents_default_Entry\" on type \"Mutation\". "?
In Craft 3 I am trying to use GraphQL to mutate an existing entry in the section PersonEvents.
Here is what I have in PHP
$mutation = <<<QUERY
mutation saveEntry(\$id: ID, \$avatarUrls: ...
0
votes
0
answers
16
views
What happened to preferredLocale in craft3
I upgraded to craft 3 from craft 2. My users don't have access to the control panel so I created a plugin where they can select from the front end their preferredLocale to determine which language to ...
0
votes
0
answers
17
views
Issue with custom field plugin - conversion from Craft 2 to 3
I have a custom field I created for Craft 2. It is a usergroup field where it will show a variety of checkboxes where an entry can be apart of multiple usergroups. The plugin has worked fine in ...
1
vote
2
answers
254
views
Group by related entries field
I have a channel of Musical Compositions:
Now all these Compositions have a Composer.
All the composers are stored in a separate channel and then linked with their respective compositions trough a ...
0
votes
0
answers
36
views
How make custom order fields required with "event_define_rules" like a required address fields?
I want to make a craft commerce custom order field required (server side). I already use this for require the default address fields. But how to add custom fields? Because this is done on the Address ...
5
votes
3
answers
5k
views
"Craft isn't installed yet" error after updating to Craft 3.1
I just updated to Craft 3.1 and logged into the admin to make the required updates to the database and this all worked fine. However, when I use the new ./craft update CLI feature, it responds with "...
1
vote
1
answer
321
views
Headless Craft CSRF
I have a site that is using Craft CMS headless and React. There are a few forms that need to post to controllers but I'm not sure how to set up the CSRF tokens and keep it secure.
Can anyone advise ...
0
votes
1
answer
38
views
Optimise this repeated entry query? (which groups entries by a shared field value)
This loop containing a query is (surprise surprise) proving very intensive.
There is also a second very similar query on the page to get all of the events related to this year and list them by just ...
0
votes
1
answer
21
views
How to get event target asset in PHP module
I have been implementing my PHP module for Craft website. Could I ask how can I get the target asset in this if-statement?
protected function initRestrictUserIndex()
{
Event::on(
ElementQuery::...
2
votes
2
answers
35
views
Plugin 'editableTable' settings field returns incorrect type when empty
My plugin uses a {{ forms.editableTable({...}) }} field within the settings.twig. When the field has row items it will save just fine, but when the table is empty it attempts to save it as an empty ...
1
vote
1
answer
27
views
Proper Localhost Setup in MacOS Catalina
I installed Craft CMS in /Volumes/Drive2/WWW/Craft using command line process and successfully done.
But when sign-in in admin it will not proceed because it has error "Failed to load resource: ...
1
vote
0
answers
90
views
CraftCMS Image Transform returning NULL on asset.url when stored on AWS S3 Bucket
So i'm using Craft as a headless CMS with a React frontend.
When querying assets on a S3 bucket and applying a transform to them in my GraphQL query the URL response is NULL.
This isn't the case when ...
0
votes
1
answer
233
views
An unknown error has occurred in asset reindex
I am getting the error: An unknown error occurred for each file in a folder when I try Update Asset Indexes. The folder is a local folder that is outside of webroot. The files just contain json data....
3
votes
3
answers
518
views
Ensure @web alias is explicitly overridden
I just stumbled upon this advice in my Craft3-system report:
"Ensure @web alias is explicitly overridden"
In which file do I need to put the override? "config/general.php" doesn't ...
6
votes
1
answer
581
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 ...
1
vote
1
answer
18
views
Editing users preferredLocale from a plugin controller
Recently upgrade from Craft 2 to Craft 3. Also had to update all the custom plugins. Once of them is to run a daily import of users from a file. In that file we try to set the preferredLocal of that ...
2
votes
1
answer
54
views
Queued Job Failing
I have a rather large Craft CMS queued job that copies multiple entries which is repeatedly failing.
The error I get is:
The process "'/usr/local/bin/php' './craft' 'queue/exec' '621803' '300' '1'...
1
vote
2
answers
75
views
How to make comments on craft CMS?
Нow to create comments on this CMS?
So far, I see only such a way -
to create a separate section and write a module for adding entries to it. But something tells me that I will face a lot of problems ...
0
votes
1
answer
25
views
Deleting a matrix block type that was copied in code
I'm somewhat new to Craft, and struggling a bit with copying matrix block types. Any help would be greatly appreciated.
So, I have some code that copies a matrix block and its fields, but when I go to ...
1
vote
1
answer
36
views
How do I generate a slug based on another field?
Is it possible to somehow generate a SLUG not from the title field, but, for example, from your own created field?
Example: A website for analyzing complex mathematical solutions. Each entry in the ...
1
vote
1
answer
25
views
How to set settings of plugin Redactor
I install plugin "Redactor"(version. 3.0.3) (https://github.com/craftcms/redactor/blob/v2/README.md). I use this type field for full text of article. I cant understand how to set the place ...
2
votes
1
answer
17
views
How to display a category on the site?
Please help me to display the categories. I have a category group with a huge category tree. Can I somehow output not the whole group of categories, but only a certain category with its child ...
1
vote
1
answer
806
views
ERR_EMPTY_RESPONSE when accessing order data (MAMP)
I've got a local installation of Craft 3.0.37 and Craft Commerce 2.0.0-beta.15 running on MAMP. When completing an order, an empty response is given by the browser. The same thing happens when trying ...
1
vote
1
answer
253
views
Composer was unable to install the updates. Error: Unknown package has no name defined
Hi I cannot install Craft CMS updates. I have version 3.1.18 and I'm trying to update to 3.7.50
I have updated Composer successfully. I did however have a platform PHP 7 issue listed in composer.json ...
1
vote
1
answer
44
views
Way to translate days in CraftCMS 'Opening Hours'
Maybe I'm overlooking something here, but I can't find a way to translate the week day names.
This is my template code:
{% set storeHours = storeHoursGlob.storeHours.getRange(1) %}
<div class=&...
4
votes
2
answers
479
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 [
'...
1
vote
1
answer
235
views
Update Cart’s address ID from plugin
I want to try and stop Commerce 3 creating a new customer address if it’s a duplicate of an existing one.
As an example, a store selling digital products has a checkout form that simply asks for the ...
1
vote
1
answer
38
views
Can't access Cookie from controller in plugin
In the frontend my website sets a cookie wich i need during a controller action. When calling the controller action from my plugin this Cookie gets duplicated and the value is replaced with an ...
4
votes
2
answers
608
views
Craft 3 Custom Plugin: model validation
Struggling a bit here - have created a custom plugin where I want to validate form submission against a predefined model before saving to the database. All pretty straightforward so far …
However, if ...
1
vote
1
answer
509
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
1
answer
102
views
GraphQL query orderBy number including null
I am attempting to query entries via that have a field (ex numberField) with field type Number. Some of the entries don't have a value for this field, so in the response it has null. I am wanting to ...
1
vote
2
answers
389
views
Calls to /actions return 400 Bad Request
I'm trying to use jquery ( and/or VueJS with axios) to delete an asset from a frontend form (user is logged in and they have permissions to delete assets from this volume)
I have an HTML element that ...
2
votes
2
answers
56
views
How to make the number of article views?
Please tell me how to make the number of article views? Is there some free plugin or something else? Or does Craft CMS already have some kind of built-in tool for these purposes?
1
vote
1
answer
44
views
DB Falling Over
Currently helping out on a family run craft commerce site after agency was not very helpful. We are having issues with downtime and I can see a LOT of errors in phperrors.log
This is an example of a ...
1
vote
1
answer
52
views
(Feed Me) Request Method
I am trying to import data but the remote API only allows POST requests for this endpoint. I have looked into the docs as well as Guzzle but can’t seem to find info on how to change the request method ...
1
vote
1
answer
58
views
The size of the database has increased. How to reduce it?
I have a problem with the database. It weighs a whopping 450 megabytes. That's a lot. It increases by about 20 megabytes per night. I suspect that this has something to do with the CRON task: an http ...
1
vote
1
answer
168
views
How to update a field?
please help me find a solution. Or at least tell me where to read about it.
Task: There is a PHP file price.php . It has one variable, for example $price = 100;
I created the "store" section....
0
votes
1
answer
136
views
How to create a simple contact form?
please help me write a simple form for adding entries to the section.
I have a twig template in which there is a simple form:
<div>
<form action="/add/contact/" method="...
1
vote
1
answer
81
views
How to create a filter of products?
Do you guys have a simple example of how to make a filter of products on the site?
In the Twig template, I output a list of products like this:
{% set products = craft.entries().section('products')....
1
vote
1
answer
64
views
How to create pager of elements
Who can tell me how to create a pager on craft CMS.
How would I implement this:
{% set games = craft.entries().section('games').limit(10).all() %}
I was thinking of getting the page number from the ...
1
vote
1
answer
28
views
How to create a structured catalog?
help me figure it out. I need to create a structured directory. So that there are categories nested inside each other. I created the "Examples" section. According to the idea, there should ...
1
vote
1
answer
32
views
How to convert slug to Latin?
Tell me please. I am adding an entry with a Russian title to the section. Slug is also obtained in Russian. How can this be fixed? I want to add an entry with the title "Привет мир", slug ...
2
votes
1
answer
39
views
How to organize a live search on a website?
I had a website on an old engine. And there I had a live search organized. Now I have decided to change the engine to CRAFT CMS and, accordingly, I need to organize a live search on the new engine.
I'...
0
votes
0
answers
78
views
Craft CMS + Docker Deployment Strategy
We are about to move to a new development and hosting environment (I am also new to Craft). Our planned development workflow is as follows: develop and test on a local craft cms docker container ...
1
vote
1
answer
31
views
Updating Craft from Terminal
I have a Craft 3 docker container. Craft is on version 3.7.44.
I log into the container with: docker exec -it [container id] /bin/sh
In the container I run: php craft update
Output:
Fetching ...
1
vote
1
answer
32
views
Craft CMS Docker Environment Variables for SMTP
Where can I find the possible environment variables that the craftcms docker images accept?
We want to be able to add our SMTP settings.
In some examples I have seen the following SMTP related ...
0
votes
0
answers
36
views
ElasticSearch plugin configuration for accents insensitive search
I'm new to Craft, so please bear with me!
We have an instance of Craft 3 with the ElasticSearch plugin. Until now we used the config in the backend of Craft.
I've found that indexing/searching for ...
1
vote
1
answer
27
views
Create a template for front end when plugin install
I have a plugin which embed a forum to front end website. For that i need a .twig template file to be created when craft admin install my plugin.
The template file will have html code <div id="...
2
votes
1
answer
43
views
Craft CMS: update workflow
I have a local environment in developer mode, and I have a remote environment in production mode.
I wish to install some Craft CMS updates.
First question is, do the databases of both environments ...