Skip to main content

Questions tagged [craft3]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
331 views

yii\base\UnknownPropertyException: Setting unknown property: craft\records\Element::canonicalId

I updated Craft and plugins to the latest version, and now I cannot save any entries, it throws the following error about unknown property canonicalId: 2022-11-10 15:15:45 [-][1][...
Laurence Cope's user avatar
1 vote
1 answer
405 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')....
Dimi's user avatar
  • 325
1 vote
1 answer
193 views

Set preferred language for new users in CP in craft 3

I have a customer who is admin and creates new users in the backend, so they can have access in the frontend (with this login they see more content than non-logged in users). After that, these new ...
Henrik's user avatar
  • 425
0 votes
1 answer
46 views

If is not triggered by a cron http request. Why?

Please help me solve the problem. Task: to organize the unloading of reviews from a third-party service that gives reviews in the form of xml. I solved this problem through the module. I did all the ...
Dimi's user avatar
  • 325
1 vote
1 answer
94 views

"addTrailingSlashesToUrls" Config option being ignored

I have set the addTrailingSlashesToUrls option in the config file config/general.php as below: <?php /** * General Configuration * * All of your system's general configuration settings go in ...
themartin's user avatar
1 vote
1 answer
705 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="...
Dimi's user avatar
  • 325
0 votes
1 answer
166 views

How do I save my entry with my publication date?

please help me figure out how to add my entry to the section with my publication date? Here is my code: $date = 1666064471; $entry = new Entry(); $entry->sectionId = 10; $entry->enabled = true; ...
Dimi's user avatar
  • 325
0 votes
1 answer
46 views

How do I check the field for emptiness?

I use Craft CMS 4.2.5.2. I have a simple question, but I can't find an answer to it. I have a module. In it, I wrote a controller that runs through all the elements of the section and performs some ...
Dimi's user avatar
  • 325
1 vote
1 answer
190 views

File Issue "A server Error Occurr" when try to upload the file

When I try to upload the file OR go to the Asset section - I have Server Error Occurr error. In console I see the error that is somehow related with ?p=admin-lime/actions/element-indexes/get-elements ...
Vladimir Shapovalov's user avatar
0 votes
3 answers
33 views

Preventing <a> from self closing within conditional

When an <a> is used within a conditional, the output of the <a> adds a self-closing a </a>. Is there a way to prevent this from happening? I didn't realize this occurred. {% if true %...
user5965's user avatar
1 vote
2 answers
106 views

Class not found when migrating to DDEV from Nitro

I'm migrating from Nitro to DDEV, and on this particular project I'm running im some problems with a custom module. I'm getting this error: Error Class "modules\bcsmodule\services\TimeslotService&...
wesley's user avatar
  • 51
1 vote
1 answer
70 views

Hide/show tab dependant on Craft sites

I have multiple sites, in a Field Layout of section entry type, I have tab A and tab B. I want tab A to show in site A, but hide it(including all the fields under it) in site B. Is there a way to ...
Thomas's user avatar
  • 69
1 vote
1 answer
183 views

Can I detect if the event is saving entry?

I have been implementing my own module like this; protected function myFunction() { Event::on( ElementQuery::class, ElementQuery::EVENT_BEFORE_PREPARE, function(Event $event) { ...
Kota.M's user avatar
  • 423
0 votes
1 answer
48 views

Element-api get other entries by id inside a entry.json

I have few entry ids from a plugin(donkeytail), and are arranged in an array, I need to loop through that array and get title, slug, etc of each entry. $entry->pins = ["106","122&...
Prashant sharma's user avatar
0 votes
1 answer
267 views

Problems updating Craft CMS form 3.7.45.1 to 3.7.55.2

I have been trying to update Craft CMS getting the same error messages no matter if I try the CMS panel or the command line (see error messages below). I review the server permission everything seems ...
Azazel's user avatar
  • 101
0 votes
0 answers
29 views

Register own FieldType in Craft 3.x

I have the following struggle. I tried to register my FieldType in my init function of the module.php. Event::on( Fields::class, Fields::EVENT_REGISTER_FIELD_TYPES, function(...
Jonathan Fuchs's user avatar
1 vote
1 answer
80 views

Is there an Event that detects when all templates have been processed?

I'm working on a Content Security Policy and need to set an HTTP header after all templates have finished processing. Right now I'm doing that by calling a module variable at the bottom of the main ...
plaintxt's user avatar
  • 488
1 vote
0 answers
91 views

Search query working locally, but not in production

I noticed that search (both on the public website and in the entries admin area) was not searching a given field. I checked the field and noticed that the "Use this field's values as search ...
vlasits's user avatar
  • 203
2 votes
1 answer
63 views

Structure entries not displaying in date order within search results

I have created a search results page to display matching entries to a search term, ordered by the most recent. The set-up works well for all entries which are not part of a structure. Results of ...
michellelclement's user avatar
2 votes
1 answer
219 views

Adding New Matrix Block via Frontend in Craft 3

Referencing https://craftcms.com/docs/3.x/matrix-fields.html#saving-matrix-fields I believe I did this correctly according to the docs and other posts here. My Matrix field is able to save edits, but ...
cherrykoda's user avatar
  • 1,114
0 votes
1 answer
104 views

Custom Element Index stopped working after Update

So we had an "old" Craft 3.1.* instance that i needed to update. Which is now running on Craft 3.7.20. This instance does have a Module which introduces a new ElementType with its own custom ...
Leonardo's user avatar
  • 471
0 votes
2 answers
90 views

How to trim each string in an array?

I am looking for how to trim each string in an array, in Craft 3. I would like to check if a string is in an array of strings. The array is from a form submission, a checkbox group. For example, there ...
Kota.M's user avatar
  • 423
1 vote
1 answer
603 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....
Dimi's user avatar
  • 325
1 vote
2 answers
86 views

How do I add an element to a section from the site?

I use Craft CMS 4.2.3. I can't find information on how to add an element from the site to a certain section. Please help me solve the problem. It would be very cool if it were some simple example. ...
Dimi's user avatar
  • 11
0 votes
1 answer
215 views

How to find if there is a draft for a particular entry in control panel plugin

I am trying to display a notification to the user in CP, if the entry is having a draft so that the next user won't redo/overdo the other draft. For that how do we find the entry has drafts?
Parthiban's user avatar
1 vote
1 answer
27 views

Why is my redactor table converted to a text when saving?

I added the table plugin to my Redactor field. In the redactor field I can now include a table (see image below). Upon saving the Redactor field, the table content is converted into text and put ...
Droemmelbert's user avatar
0 votes
1 answer
41 views

Behaviour around {% exit %} is different on local VS production

I'm trying to get my site to display a message and exit on the basis of a querystring in the URL. I have this code at the top of my main template: {% set queryString = craft.app.request.queryString %} ...
Chris's user avatar
  • 55
0 votes
1 answer
824 views

Not instantiable – yii\di\NotInstantiableException when setting and reading cookies

Hello, within a craft template I query the existence of a cookie to visually highlight new entries in the CMS with CSS. This worked for a long time without any problems. A visitor told me that on ...
Andreas Ploch's user avatar
2 votes
2 answers
48 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 ...
Mark Notton's user avatar
  • 2,347
1 vote
1 answer
1k 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 ...
cannon303's user avatar
  • 309
0 votes
1 answer
54 views

Search query ignoring custom fields in search in search index

I have a site with around 300 entries and at least 50 custom fields. But I'm only getting results if the keyword(s) are part of the title field, I have the "Use this field's value as keywords&...
Azazel's user avatar
  • 101
0 votes
1 answer
28 views

P&T Contact Form Plugin - How to Retrieve the inserted values?

I have been looking for how to retrieve the inserted values when the submission is failed. Other than prepared fields (Name, Email, etc.), the inserted values disappear from the fields. I already ...
Kota.M's user avatar
  • 423
1 vote
1 answer
59 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=&...
Hielke's user avatar
  • 81
0 votes
1 answer
299 views

How to regenerate missing folders

TLDR: How do I re download / re generate the base Craft CMS folders / files if they are missing from a project? I know you can clone the base Craft CMS project from github (this might be the answer?) ...
Wally's user avatar
  • 343
1 vote
1 answer
929 views

Admin user can't login

I need help getting an admin user logged in. The password was reset and doesn't work. After resetting the admin user password using forgot password, I get prompted with Invalid username or password. I ...
danklingjr's user avatar
0 votes
1 answer
25 views

Is possible to select a site in a multisite installation to show his url, sitename, and more properties? (Craft 3)

I'm working on a multisite installation on Craft, and i want to know if it's possible to select a specific site to show for example a link to it, sitename and other attributes. I couldn't find a way, ...
Sebastian's user avatar
5 votes
1 answer
2k views

Uncaught TypeError Dotenv Create on updating to Craft CMS 4

Just updated to Craft 4, migrated my /web folder over as well as my /assets folder and trying to load the index page gives me the following error. Any help would be great as I can no longer access my /...
JMKelley's user avatar
  • 1,416
0 votes
1 answer
182 views

Order entries query of a structure by lightswitch field

I have a bunch of entries in a structure and I want to have all the "featured" entries returned first. Then everything else returned in the order set for that structure in the admin. The ...
Yann's user avatar
  • 103
1 vote
1 answer
75 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 ...
Gary's user avatar
  • 43
0 votes
1 answer
147 views

Where can I find documentation on built-in flash message for `users/save-user`?

I'm trying to customize my user profile twig template UX to be a little more user friendly, but I can't figure out where to find what the built-in default errors/notices flash messages for the users/...
Yann's user avatar
  • 103
1 vote
1 answer
150 views

Recommended Redis data eviction policy for Craft CMS

I have recently switched from memcached to Redis. The cache, session, template caching and mutex is now using Redis on a project. While Redis generally gets managed by Yii/Craft CMS, Redis features a ...
James White's user avatar
  • 1,171
1 vote
1 answer
563 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 ...
toddhf's user avatar
  • 11
0 votes
1 answer
181 views

Wheelform ~ Email Notification with file upload attachment, but **not** store the file upload in assets?

I have a craft v3 site using Wheelform plugin to power a custom 'job application' form. The 'job application' form has a 'CV' upload file field. The submissions from the form are sent as email user ...
Karl Bowers's user avatar
1 vote
1 answer
823 views

Get entries in an entry type in twig template

I have two channel types section namely "Services" and "Cases". I have added caseServices as entry field in cases. I can get services of a case in twig as entry.caseServices. But ...
Vinod Patidar's user avatar
1 vote
1 answer
107 views

Website transfer places /web in all urls, cs and js not loaded when moved up directory

I just transfered my website from one server to one.com. Now nothing works anymore cuz apparently one.com wants the index.php in the root directory but my index.php is in the "web" directory....
Masary's user avatar
  • 11
1 vote
1 answer
300 views

MySQL 5.7.8 or higher is required to run Craft CMS Error

I'm extremely new to Craft CMS and having to ensure it can be ran from a Azure Virtual Machine. I have added, Apache, PHP and MySQL and the website does run on the server. However the issue occurs ...
Richard Griffiths's user avatar
2 votes
1 answer
64 views

How can i disable channel list url?

I have a channel type entry where I'm inserting services. I have created a channel and add route services/{slug} and added template services\_entry.twig. I want to keep url for single service as ...
Vinod Patidar's user avatar
1 vote
0 answers
54 views

Editing entry without creating a new revision in particular scenario. is this possible?

I'm updating particular field in "A" section whenever a new entry is created in "B" section. In this scenario I don't want revision to be created for "A" section. Is this ...
Kishore Natarajan's user avatar
2 votes
1 answer
46 views

Problem running a sale on the site

Craft shows the sale running, and can tell which products are on sale using a: {% set saleProducts = craft.products() .hasVariant({ hasSales: true, hasStock: true }).all() %} loop, but on ...
madev's user avatar
  • 21
1 vote
1 answer
36 views

Is re-running the ConvertEntryRevisions queue job safe to run after migration to Craft CMS 3.7?

I have a fairly large Craft CMS 2 site was recently migrated to Craft CMS 3, because of the large amount of entry revisions, the migration that runs the ConvertEntryRevisions queue job did not ...
James White's user avatar
  • 1,171

1 2
3
4 5
39