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
2
votes
1answer
757 views

What is the difference between the Translation Methods when creating a new site

I am creating a new multi-lingual site and the documentation does not explain the difference between the options in the translation method dropdown. What is different for each of these and when is it ...
2
votes
2answers
753 views

Visual editor for Craft 3

Client is coming from WP and is used to Elementor (https://elementor.com/). Can create own rows, columns, etc. in content. Is there a visual editor for Craft 3? Client hasn't specifically requested ...
2
votes
1answer
2k views

Security Key and Boilerplate

We have set up a Craft 3 installation with composer to serve as boilerplate for a number of upcoming projects. The installation sits in a private git repository and the plan is to clone it when we ...
2
votes
2answers
2k views

Problem installing plugin via path repository

I am starting to play with writing a plugin in Craft 3.0. I have followed the following page. I used Plugin Factory to create my plugin structure (very nice). My folder structure is as follows: /...
2
votes
1answer
3k views

How do you query entries by field values?

I need to arbitrarily query entries based on the values of various fields. For example, if I have an entry type called "Widgets" I can grab them like this: $widgets = Entry::find()->section('...
2
votes
3answers
2k views

How to create menu in backend using Craft 3

How to create menus from admin panel of Craft 3 so I can render into frontend header and footer?
2
votes
2answers
2k views

Error on Craft 3 install

When attempting to install Craft 3 in OSX El Cap, I'm getting the following errors: Script @php craft setup/welcome handling the post-create-project-cmd event returned with error code 255 /Craft3/...
2
votes
3answers
546 views

Including the category group in nested category URIs?

I've asked already about nested categories here, but I've just upgraded to Craft 3 and things seem to have changed a little. I have three top-level category groups: - Home - About - Funding Each of ...
2
votes
1answer
1k views

Git configuration for CraftCMS

Please excuse this newbie question (newbie to Git that is). I'm trying to set up my CraftCMS environments with Git and wonder about best practices and how others configure your repositories. In ...
2
votes
1answer
46 views

How to make custom element types restorable?

In Craft CMS 3, custom element types support soft-deletion out of the box. But once soft-deleted, there is now way to restore elements that are now listed in the Trashed status, the only available ...
2
votes
2answers
45 views

How to reliably determine if an entry is being duplicated?

On a Craft 3.7 site, I need to make some changes when duplicating an element: set the dateCreated, dateUpdate & postDate to the current date ensure the entry is disabled clear the value of an ...
2
votes
2answers
300 views

How to filter entries by checkboxes using Sprig

I am using the Sprig plugin to filter news entries on a news overview page. I have three checkboxes for the categories related to the news entries. I have the page working for the basic functions by ...
2
votes
1answer
43 views

Partially pay for an order

Is there any way of partially paying for an order, so if the order total amount was $100, how can I programmatically set the payment amount to $50, and then pay the other $50 using another payment ...
2
votes
1answer
410 views

Why is $DEFAULT_SITE_URL appearing in entries URL?

I have an entry loop on my homepage that uses {{ entry.url }} that links to the full entry. When I click on the entry, the url looks like this mydomain.com/$DEFAULT_SITE_URL/the-entrys-slug Even ...
2
votes
1answer
7k views

composer update missing zip extension (ext-zip) on MacOS

When doing a composer update in a Craft project on MacOS Catalina, I suddenly get the following error: ***** requires ext-zip * -> the requested PHP extension zip is missing from your system. Any ...
2
votes
2answers
839 views

API access to Craft 3

Does anyone know if there is an API for CRAFT 3 where I can authenticate to and query (CRUD) all the elements (channels, etc.) I have created on it? Thanks.
2
votes
1answer
148 views

Payment currency not allowed

Craft 3.3.8 Commerce 2 Lite Version If I change the base currency from default(USD) to NZD or AU in the setting CP > Commerce > Store Settings > Payment Currencies and browse to /shop/ or ...
2
votes
1answer
259 views

How to build contact form from scratch (no plugin)

I want to build a simple contact form without plugin, i am new to craft cms coming from wordpress, how can i build a simple form that will be save on entries and will send an email.
2
votes
1answer
442 views

How can I change variant price in Craft Commerce 2 form

I want to add range field that will change price based on its value. How can I send updated price to the cart? Is there something easy like: {% set product = craft.products.one() %} {% set variant = ...
2
votes
2answers
780 views

Entry Query relatedTo Two Categories

This has to be something that is easy, but I've been beating my head on my desk for a a few hours with this. Most solutions I have come across are way to complex - when all I need to do is query a ...
2
votes
2answers
63 views

Best practice for year based paging

Is there a best practice for a paging based on the years of entries (instead of page numbers)? Example: I have 3 records with post dates 2019-01-01 2018-01-01 and 2016-01-01. So my paging should look ...
2
votes
1answer
136 views

How can I return only 1 random block in a Matrix in Craft using Twig?

I have a matrix with a couple of text fields for a caption, location and URL and an image Every time this page loads I want a random slide to show - so the background image is random, as well as the ...
2
votes
1answer
179 views

Any reason why {% requirePermission 'editEntries:1' %} would stop working within the past week or so?

This worked fine last week when the site was in development: {% requirePermission 'editEntries:1' %} We made the site live a few days ago. I dont know if its related, but when I now go to pages with ...
2
votes
1answer
506 views

Simple webshop solution (Craft Commerce)?

I am looking for a simple shopping solution for one of my customers. Since their website is already running with CraftCMS, I am looking if there is any integrated solution available. However, so far ...
2
votes
3answers
535 views

How to deploy website from dev to staging from localhost to remote server using composer

I want to upload all my Craft files along with the database to an Ubuntu server using composer. This server is an EC2 instance of AWS. Thanks for the help!
2
votes
1answer
2k views

CSRF in “Headless” Applications

There are a number of answers here about how to send CSRF tokens along with AJAX requests, but I think my question is a little different. Please excuse the abstractness here: In a headless ...
2
votes
2answers
2k views

Action URLs from CP to a Craft 3 plugin controller

I'm working on my first Craft 3 plugin and want to add some buttons to my plugin's control panel section which post form data to a controller. My plugin is called 'myplugin', the controller I wish to ...
2
votes
1answer
661 views

Working locally after cloning Craft 3 from Hyperlane

I'm trying out the recommended Hyperlane hosting with Craft CMS. After installing on Hyperlane, I then clone the repo on to my local machine and run 'composer install'. That runs fine, and I create a ....
2
votes
2answers
547 views

Craft 3 query children of sub categories

Just wondering how to only query the children on subcategories. For example... Food ├── Fruit │ ├── Apples │ ├── Bananas │ └── Oranges └── Vegetables ├── Brussels sprouts ├── Carrots ...
2
votes
1answer
147 views

How do I differentiate between entries after merging an array?

I'm trying to plot entries from two different Solspace Calendars and an Entries section on one map, and use different markers for all types. Alll of the events are related to the current Entry through ...
2
votes
1answer
675 views

How to get the previous or next two entries

I have an entry which needs to display the previous two entries, and the next two. I see in the docs there's a nextSiblingOf method. That does nothing in a channel, and in a structure it will only ...
2
votes
1answer
2k views

How to render a template from within a module?

I'm currently developing a module that contains a custom field and I'd like to create a template to be used in the getInputHtml method. I try using the Craft::$app->view->renderTemplate method ...
2
votes
2answers
1k views

From a Twig template, how to retrieve the content of a HTTP header in the current request?

I would like to detect if a header in the current request is present and obtain its value, directly within a Twig template. I know that craft.app.request gives access to a few variables like isAjax ...
2
votes
1answer
1k views

Craft 3 Controller giving 404

Updating a plugin to Craft 3 (also changed its name). I know this is probably something very simple, like capitalization, but can anyone point out what's wrong? Firefox console shows a 404 for http://...
2
votes
1answer
3k views

What is the best way to deploy a Craft CMS 3 site?

I'm unclear as to the best way to deploy a Craft CMS 3 site. I'm looking for some best practices and guidance. I'm currently using Rocketeer to deploy the code from my local environment to my staging ...
2
votes
1answer
1k views

Group and Sort Alphabetically

I have a list of categories that I am listing out, grouping by alphabet. The issue is the list goes A H B C D E...and so on. Why would it go in that order? {% set categories = craft.categories....
2
votes
2answers
608 views

504 error on home page of Craft 3 website

Recently, I developed a Craft 3 website. Its working perfectly on development server. But after deploying to another server, I am getting 504 error for home and all front end pages while Craft ...
2
votes
1answer
699 views

Craft 3 multi-lingual multi-sites setup with shared assets

I have 2 almost identical websites. Both have almost the same layout but different colors (so different CSS file). They share most of the same templates and assets (images, css, js, videos, etc.). ...
2
votes
1answer
2k views

Craft 3 : What are the advantages to use PostgreSQL and when should I use it instead of MySQL?

Craft 3 now supports PostgreSQL. I know this a very general question, but: I have absolutely no experience with PostgreSQL I don't know when should I use it instead of MySQL To quote Bob Olde ...
2
votes
1answer
2k views

Craft 3 Template - Getting Image URLs

I am having a problem getting image urls from Craft 3. I understand that there is a new syntax but I cannot find the syntax to use. The craft 2 version of what I am trying to accomplish is {% set ...
2
votes
2answers
25 views

How to set SMTP Enrcyption with an environment variable

The official Craft documentation says it is possible to set the "Encryption Method (SMTP)" , Snipped from the documentation, with an Environment Variable. I think i am missing something but ...
2
votes
1answer
256 views

Site url is not generated correctly when using environment variables

I'm working on a multi-site setup (for a localized website). In my .env file, I have defined a SITE_BASE_URL variable. Then, in the control panel, I set up each site's base url with that environment ...
2
votes
2answers
151 views

Video Asset URLs not rendering

I'm trying to output the video files from within a block but get a Calling unknown method: craft\elements\db\AssetQuery::url() error when using the following: {{ block.video.videoFileWebm.url }} ...
2
votes
1answer
250 views

Craft CMS Entries Disappearing

I've setup a Craft 3 site for a client and we are seeing the strangest thing where pages are just disappearing. Best we can tell no-one has deleted the entry, but we get a 404 on the front-end and it ...
2
votes
2answers
713 views

Craft 3.5.1 CLI Update Error: Failed to instantiate component or class "yii\shell\Bootstrap"

when I try to update Craft via CLI to 3.5.1. I get the following error: Failed to instantiate component or class "yii\shell\Bootstrap in /vendor/yiisoft/yii2/di/Container.php:449 Stack trace: #0 ...
2
votes
1answer
94 views

Help understanding hooks

I need to build a plugin or module that hooks into the Sprout form upload file function so I can add text programmatically to the user uploaded filename. I've had input before that I should work with ...
2
votes
2answers
244 views

Cleanup Craft Logs

Whenever I have PHP problems I'm looking into the Craft CMS logs. However, at first I noticed there's a ton of stuff getting logged which is useless for me. Under this amount of logs, I can't find ...
2
votes
1answer
504 views

Dynamically populating select input fields using jquery $.load and twig template

EDIT: the below code now works! I have two select inputs, the choice of 1 should populate the second. I have an external twig file (data.twig) (MAKE SURE TO PUT THIS IN YOUR TEMPLATES FOLDER) that ...
2
votes
1answer
1k views

How does Craft CMS cache with Redis?

I don't understand how Craft CMS processes cache with Redis especially when saving to database/s? My environment: Craft Pro 3.4.8 PostgreSQL 12.2 PHP-FPM 7.4.3 Redis 5.0.7 I followed examples from ...
2
votes
1answer
1k views

How to get the hash/anchor in the URL?

I am using an entry's slug as the anchor for a page. How do I grab the anchor from the request? For example I want to get #article-one from /blog/#article-one If it's not possible, is there a way ...

1
3 4
5
6 7
36