Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [craft3]

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

1
vote
0answers
14 views

Passing optional variable values into an include template

Craft noob here. I have an include file which I'm calling a "component" so I can reuse it across the site. The component is set up like this. <h2>{{ heading }}</h2> {{ bodyContent }} {% ...
1
vote
0answers
9 views

Craft 3 Cannot Save Global Set

I am playing around with Craft 3 and for the life of me cannot get it to save an element programmatically. I am trying to save a Global Set from a module like so: $config = [ 'name' => "My ...
1
vote
1answer
9 views

Can I have non-boolean TargetBlank output using HTMLPurifier and the Redactor plugin?

I'm using the Redactor plugin throughout a Craft 3 site and I'm also using a custom HTML Purifier config to clean up the HTML (surprise). { "HTML.ForbiddenElements": ["&nbsp;", "br"], "...
1
vote
1answer
19 views

Events documentation for Craft 3

I've been looking for an Event Reference doc for Craft 3 just like what we had for Craft 2, but couldn't find one. The only events doc I found for Craft 3 is the plugin updating guide: https://docs....
1
vote
0answers
17 views

Craft 3 Feed-Me Auto run all feed

I currently use Feed-Me to pull data from an API-Endpoint. This API-Endpoint does change from time to time, providing new elements with each change. I don't want to manually trigger the Feed-Me-...
1
vote
0answers
23 views

XMLHttpRequest Craft Commerce Cart Update Issues

When using XMLHttpRequest to update cart like the following, I get a 500 error for 'lineItems': {[lineitem]: {'qty': value}} (and also {[lineitem]: {'remove': true}}, any other submission works); var ...
1
vote
1answer
14 views

Error with Contact Form plugin on submission

I am using the Craft Contact Form plugin (https://github.com/craftcms/contact-form) and am having an issue where I get an error page on submission. The form is submitting correctly (the submission is ...
1
vote
1answer
22 views

Ajax post request front-end csrf token

I'm trying to make a simple post request with ajax to a controller in plugin. The problem I'm having is that I always get a 400 Bad request because I don't send a valid CSRF Token. But I can't figure ...
0
votes
0answers
12 views

redactor or ckeditor unable to add bullet points

I am unable to add bullets points to an entry, where am I going wrong? snapshot of the backend of entry using redactor snapshot of what appears on the frontend P.S i've also tried CKeditor but with ...
1
vote
0answers
9 views

How to access a digital products information on the products page in Craft Commerce?

I have created a digital product type and a digital product but strangely on the digital products template I can't access any information regarding the product like for example, entry.title. I'm ...
1
vote
1answer
23 views

Updates on live server without using Control Panel

I'll freely admit to being a bit of a newb when it comes to SSH but wanting to start utilizing it more for my Craft3 sites. Maybe this is an irrelevant question but is it possible to update craft on ...
1
vote
2answers
16 views

Removing old Block Handles in Matrix Field?

I'm working with Matrix field. When adding and then removing and then adding again fields with the same handle I get the following error. Handle "videoUrl" has already been taken. Is there a way of ...
1
vote
0answers
20 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 ...
0
votes
0answers
9 views

How do I get admin console back after fatal error on upgrade? {“error”:“Class 'craft\\events\\RegisterTemplateRootsEvent' not found”}

I attempted an upgrade to 3.04 (before a breakpoint) and received a fatal error {"error":"Class 'craft\events\RegisterTemplateRootsEvent' not found"}. The CP is not accessible and website is ...
1
vote
1answer
25 views

Sprout Forms Email

I have an entry where I select which form displays on the page. Is there a way for me on the entry using a text input for an email address to use that email address for the sending of emails via the ...
0
votes
0answers
29 views

No users added to database after initial Craft3 installation [closed]

I have just setup another Craft 3 site the same way I usually do, however this time my user credentials set in the craft setup process from the CLI haven't been added to the database. And every ...
1
vote
1answer
34 views

Fetch the three entries before, and after, a given Structure entry, with wrapping

For a given structure entry, I need to return the previous three, and the next three entries as one array. But if the given entry is the last in the structure, I need the "next three" to wrap around ...
0
votes
0answers
8 views

Multi-site throwing a 404 — but only on staging server

I inherited a site and upgraded it from 2 » 3.1. The site is in both EN and ES. There's a button to toggle between languages and it works fine on my dev environment. site.co/en serves up English and ...
1
vote
1answer
27 views

Craft 3: how to call methods in another plugin's service?

In Craft 2, we used to be able to do so by doing: craft()->plugin1->myMethod(); from Plugin 2's service for example. Now in Craft 3, I couldn't figure out a way to do it. Plugin1::$plugin-&...
1
vote
0answers
13 views

RelatedTo relation - checking matrix block status is enabled

I need to search for all commerce variants related to a custom element "Account". The account element is related to a variant through a matrix field with handle varientaccountmapping, block handle ...
1
vote
1answer
35 views

Order entries by custom date and time fields

I have an events channel where each entry has three custom date/time fields: startDate (Date Only) startTime (Time Only) endTime (Time Only) I was originally using this code to set my entries, but ...
1
vote
1answer
23 views

Entries save but site doesn't update

Hey there and thanks in advance. We just moved our site to production as a beta site. The only thing that is different between this site and our local/staging site is the config file. The allowUpdates ...
0
votes
0answers
14 views

Issue with Matrix field after cloning with Field Manager plugin and Craft 3.1 update

We have an issue with a matrix field which we cloned using the Field Manager plugin. Since upgrading to Craft 3.1 we started having issues with the matrix fields which has been cloned. The first ...
0
votes
0answers
15 views

Updating asset indexes doesn't work

I have a page where updating the asset indexes is not working. If I hit «Update asset indexes» The loading animation shows and never stops the animation. Installed AsyncQueue = Same effect Increased ...
1
vote
0answers
25 views

Adding a row to a table field with CraftQL/GraphQL

I am trying to mutate/add a new row to a custom user field, which is a table. The problem is that the mutation does not add a value, neither is adding a new row, it just overwrites the existing row ...
0
votes
0answers
14 views

Craft 3 with Craft Commerce not cleaning up deleted products correctly

We have a Craft 3 install with the "Try" version of Craft Commerce. When we have a product type with variants we seem to be having issues with products cleaning up correctly after they have been ...
1
vote
1answer
26 views

baseUrl outputs environment variable

The newer versions of Craft CMS stimulate using environment variables in the CP. It works perfectly. I have set two variables for sites in my .env file: DUTCH_SITE_URL="http://company.test" ...
1
vote
1answer
22 views

Custom plugin field in Table Columns?

I just created my first Craft 3 plugin. In the plugin I also have a custom (select)field. Everything is working as expected, which is great! But I can't for the life of me figure out, how to add this ...
0
votes
0answers
19 views

New field creation is causing craft to give a PHP Warning – yii\base\ErrorException - array_merge(): Argument #1 is not an array

When I attempt to create a new field that is not a plain text type craft outputs PHP Warning – yii\base\ErrorException array_merge(): Argument #1 is not an array After the error, when I check the ...
1
vote
2answers
49 views

Craft 3: Cron job to run Controller actionIndex method of a Plugin

I have made a Craft 3 plugin that is manually used in the Craft Admin CP area; click a button and we sync products in Craft with a Shopify API. Now I am trying to automate the process. I would like ...
2
votes
1answer
68 views

Selling tickets to repeating events with Commerce (and Solspace Calendar?)

We need to build a ticketing system for venue tours, that happen every week within certain date ranges, and with an option to exclude specific dates from the availability list. Looking at Solspace ...
1
vote
1answer
38 views

_entry.twig isn't reading css while index does

This is the template im using and the index of the file is taking the css and printing it nicely however, the _entry.twig is only loading text, please check out the screenshots. Below is the index of ...
1
vote
1answer
20 views

MySQL “Access denied for user” after moving to new server

I've moved my Craft 3 installation to a new server. When connecting to the original database, everything works fine. However, when trying to connect to a new MySQL database (I've tried hosting this ...
0
votes
0answers
20 views

Subdomain don't work

I have a big website in 6 languages. Reachable at bar.com Now I want to create a Landingpage for a subdomain. So I created a new Site in Craft named "landingpage" and set the basic url to foo.bar.com ...
1
vote
1answer
18 views

Custom title using URI segment

I am working on my SEO and I am getting a duplicate title in Craft. I want to make a custom title using the URI segment in using PHP.
0
votes
0answers
21 views

Is it better to let Craft handle my API calls instead of recreating the same functions

First of all, I am just a student so please go easy on me. I am creating my first API for Craft cms and Commerce for an Android application. The steps I did was as follows: I created a plugin and ...
1
vote
2answers
15 views

Upload failed. The error message was: "SQLSTATE[23000]: Integrity constant violation:

I'm getting this strange error when I'm trying to upload an .jpg in the assets. Env: Localhost Craft version 3.1.8 MAMP: - PHP(7.2.7) - MySQL: 5.7.21 Upload failed. The error message was: "...
1
vote
1answer
30 views

How do I resolve dependency conflicts in Composer?

I'm new to using Composer and I'm having trouble deploying to Laravel Forge. I am getting an error message that says: Your requirements could not be resolved to an installable set of packages. ...
1
vote
3answers
31 views

Querying Entries by Month and Year

Good morning, If have have a URL that passes parameters: http://url?month=January&Year=2018, how would I go about querying all entries in section where the postDate equals January 2018? I can get ...
1
vote
1answer
22 views

Craft 3 redirecting me 404 after fill up registration form

I have created copy whole HTML from here (https://docs.craftcms.com/v3/dev/examples/user-registration-form.html). and trying to register but it's showing me an error or we can say it redirects me to ...
1
vote
1answer
42 views

Internal Server Error while migrating to new server

I'm trying to migrate to a server from my local environment. I keep getting Internal Server Error. I have the latest version of 3+ of CraftCMS. Everything works fine locally but on the server not so ...
1
vote
0answers
19 views

How to keep a users cart active after logout - Craft Commerce 2

How do I set the cart to save / stay active in a users account. When I add some products to my cart (when logged in) and logout or close my browser the next time I come back my cart is empty. I'd like ...
2
votes
1answer
23 views

Element API calling Module that integrates with third-party plugin

This is probably a bit niche but anyone especially au fait with the element api here? On project X I have a custom module within which I am referencing a service from another plugin (bolden/google-...
2
votes
0answers
33 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. ...
1
vote
1answer
28 views

How to duplicate a matrix field programatically in Craft 3.1?

Is there a "Craft" way of handling this in 3.1? Solutions to this question on SE are based on older versions of Craft which no longer work. Custom fields can be duplicated by doing: $newEntry->...
1
vote
2answers
32 views

Twig sometimes breaks JavaScript or CSS

Sometimes when your javascripts or stylesheets are formatted a certain way, twig seems to try and render those snippets (whom always include curly brackets in some way). For example, if you end you'...
1
vote
2answers
27 views

Blog template not displaying posts

The blog post should display the posts created but when I got to the slug /blog it says 404 not found as well as the press news should be displayed here /press-news but same thing happens. If i ...
0
votes
1answer
42 views

Page ignoring template

One of my clients' sites is https://anovaworks.com/. The second section on the homepage looks like this: There's some small black text in the top left of the image that's coming from a matrix field. ...
2
votes
2answers
25 views

How do I prevent a controller from creating unwanted routes?

I have a custom module that is adding sections to the CP, like this: // Register CP routes Event::on( UrlManager::class, UrlManager::EVENT_REGISTER_CP_URL_RULES, function(craft\events\...
1
vote
1answer
74 views

Product Filtering with Tags

I've built a product filtering system using tags and currently have 2 available tag groups under different fields. Size and Type Currently if I select 1 tag from both size and type, it shows all ...