The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [craft2]

Questions specific to the Craft 2 version of Craft CMS; avoid using for questions applicable to all or multiple versions.

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

How can I add fields in the Sprout design your form?

I am using Craft CMS 2.7.3 and sprout forms 2.6.0 version. I have created a dropdown field in the craft cms -> fields. How can I fetch this field or render this field in the Sprout form design? Even ...
0
votes
0answers
18 views

Copy Live to a Test site on same domain?

I have copied my Craft 2.6 live site directory, and created a test directory on our webserver in an effort to create a test site. Also duplicated the db and changed the configure files to point to the ...
1
vote
1answer
14 views

Programatically add lines to a Super Table field

I am trying to add new lines into a SuperTable field of an entry from my plugin. Following the Developper sample, I am able to change set lines to this SuperTable field. But it is replacing the ...
1
vote
1answer
18 views

Looping Entries in Super Table, display row details

I have a Super Tables field, containing related entries: I'd like to display the field name (ie 'English Links') in a template, but can't figure out how, the following outputs a string of values and ...
0
votes
0answers
17 views

Undefined property: DOMElement::$tagName HTMLPurifier

I got asked to edit the content on a website but whenever I edit an article and try to save it I get the following error: Undefined property: DOMElement::$tagName (/home/user/craft/app/framework/...
0
votes
0answers
34 views

Homepage is blank

Craft CMS 2.6.3017 I'm very new to Craft, so forgive me if this is a bit basic. I've cloned an existing Craft CMS site for a customer and set the site up so that 'index.php' is omitted from URLS. ...
1
vote
1answer
15 views

Importing fields into A&M Forms plugin

I'm currently using the A&M Forms plugin and was wondering if I can import fields from the native Craft 2 fields? I have already created 20 or so fields that I will use in both the native ...
0
votes
1answer
29 views

Form fields not visible after creating content fields using A&M Forms plugin

I'm new to Craft 2, and I created about 20 new form fields in the Settings>Content>Fields section. I created a new group for them to go in. Then, I went to create a new Form, but I cannot see those ...
1
vote
2answers
37 views

Which twig file is being used and how?

I have a page in Craft (2.x) that displays several links and I was able to find which twig file had those links by searching the code base of twigs. Those links point to some Angular code with links ...
1
vote
1answer
19 views

Local DB SQL 'CDbException' Errors on Craft 2 site

Just tried to get a local site working again but getting all sorts of issues. I have updated the website online and downloaded the database, installed locally. I have also the craft/app folder to my ...
0
votes
0answers
14 views

Craft 2.7.4 - Creating staging, blank screen

We have a live website running with Craft CMS 2.7.4, now I want create a staging environment so I made a copy of the live website files and the DB, I changed all the links from https://www.website.com ...
0
votes
0answers
18 views

EntryModel as model attribute doesn't get populated as model

I've created this custom plugin with a CP interface for a website running latest version of Craft 2. Each record in my custom table relates to an entry using an entryId. I've set up all the records ...
1
vote
1answer
44 views

How to have Craft 3 and 2 on same host?

I have a Craft 2 installation that I'm upgrading to Craft 3. I've got v3 running locally in its own virtual host, but now I need to temporarily put the dev v3 instance in the same hosting account as ...
1
vote
2answers
70 views

Send email with dedicated SMTP settings from a Craft 2 plugin

I have looked a lot for this but cannot find any dedicated solution. Basically I want to do this: How to send email from Craft 3 custom plugin? … but for a Craft 2 plugin. A how-to for the global ...
1
vote
1answer
18 views

bootstrap.php returns a value of 1 in Craft CMS

I have a Craft CMS instance that I created a copy of by tarring up the folder and then dumping the mysql database and then transferring that to a different server. On the target server I restored the ...
1
vote
1answer
27 views

Craft 2 Commerce 1 cart session expiry

Is it possible to change the cookie timeout just for the cart? E.g. I'd like to clear abandoned carts after X hours and keep all the other sessions untouched (e.g. user sessions etc). Please advise ...
1
vote
0answers
66 views

Freeform submission only works if 'devMode' => true

I have a locally running form via Solspace's Freeform plugin (Craft2) which perfectly runs on my local setup, but fails silently without any logs or messages on my live-setup. The form is submitting ...
1
vote
1answer
36 views

Pagination Slug Issue

I've setup a 'posts' section with a collection of posts. I'm trying to add pagination to the individual post entry. I've copied the pagination code from the Craft CMS documentation but I'm having ...
1
vote
1answer
34 views

Cannot access assets - unable to open image

I'm on Craft 2.7.8 and cannot access some of my assets - getting Unable to open image ../html/assets/xxx.jpg error all the time. I've checked the owner, group and permissions dozen of times, ...
1
vote
1answer
168 views

Return JSON array without extra square brackets

I'm having difficulties to remove an additional set of square brackets or avoid including them within array. My JavaScript code currently accesses array's object at 0 index and therefore I'd have to ...
1
vote
1answer
23 views

Missing 'Plugin Store' tab in admin panel

I'm using Craft 2.7.9 and can't access the Plugin Store page. I've searched for fixes here but didn't find anything helpful. I've tried to access it directly via http://localhost:8888/admin/plugin-...
0
votes
0answers
14 views

Entries are being saved even when I try to upload files with the wrong extension

My Image service function throws an exception and sends it to the Craft logger that the extension is invalid. But my entry is being saved even though the field is set to only allow images. I am ...
0
votes
0answers
15 views

Generating pending image transforms get scheduled over and over again // Craft 2.6

I triggered "Generating pending image transforms" and now it keeps popping up, no matter how often it's completed. I tried deleting it from the craft_tasks table but it'll just add a new one. How can ...
0
votes
0answers
23 views

Open Tab on Page Load

The code below works when you click on the tab, but I am trying to get it to open the first tab on page load using Craft CMS. Any suggestions. <div class="available-options-tabs"> <h2&...
1
vote
1answer
34 views

Changing some letters in entry's uri before save it

I need to replace some characters in my entry's URI because we have some letters which do not exist in English like "ş" or "ç". It is a problem for SEO and we have to change each time manually. I ...
0
votes
0answers
37 views

ColdCache(?) error - count(): Parameter must be an array or an object that implements Countable

I'm getting a semi-persistent error that seems to be related to coldcache. Originally on PHP 7.2.6, though also present on PHP 7.3.5. I'm experimenting with different caching approaches and my ...
1
vote
1answer
46 views

Get a specific product with Element API, Commerce and Craft 2

How do I get a specific product via Element API? Here's what i have so far 'api/product' => function() { $productId = craft()->request->getRequiredQuery( 'productId' ); return [ ...
1
vote
1answer
40 views

Craft 2.X Local setup error – Craft not connecting to MySQL (via Sequel Pro)

Novice dev here, really struggling to get my local setup functioning. After a couple of days of wrestling with Apache config settings, I finally have Craft connecting via a VHOST setup. The problem –  ...
0
votes
0answers
14 views

Group entries alphebetically

After copying the "group" docs almost verbatim, I'm trying to sort a list of entries by province and then by city, this what I have: {# See Group docs for info: https://docs.craftcms.com/v2/...
0
votes
0answers
34 views

Is it possible to use craft()->runController with variables in Craft 2

I'm trying to run a plugin 1 controller from plugin 2. I can get it to run and re-direct to plugin 1's controller but as it is not being run with posted variables I need to be able to tell plugin 1's ...
0
votes
1answer
75 views

An unknown error occurred - no log entry

After copying files from a web server to my local devbox I am unable to open any 'Entries'. I keep getting two of the following error: "An unknown error occured." The assets section does open and I ...
2
votes
1answer
32 views

Maintaining order when getting by entries by ID

I'd like to get a certain set of entries in a specific order, but the element query comes back ordered by the default 'postDate desc' {% set ids = ['4213','3200','4204','4212'] %} {% set ...
0
votes
0answers
21 views

Why does $entry['slug'] and $entry->slug return different values?

I'm writing a simple plugin for 'Craft 2' and It seems that a slug of an entry is returned if you reffer it like: $entry['slug'] but calling $entry->slug returns same value as entry title. Is ...
1
vote
0answers
21 views

Exclude entries [duplicate]

I want to use search but exclude some types but when I use paginate craft.entries({ search: query }).type('not faq').limit(4).order('postDate desc') as pageInfo, results %} results are ...
1
vote
1answer
40 views

Clear template cache after update sale on Craft Commerce

How can I clear products template cache after update sale ? Because product price don't change ... Thank you.
1
vote
1answer
30 views

Preview PDF doesn't work in Safari but works in other browser

I'm trying to figure out why I am able to preview a PDF in all other browser apart from Safari. The PDF is generated using DOMPDF (printmaker plugin) and output to the browser though PHP using Craft ...
2
votes
1answer
50 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 ...
1
vote
1answer
115 views

CSRF token is null or empty in craft 2

I'm having an issue with Craft 2.6 and the CSRF token. I enabled Csrf Protection in my general.php file by adding this line $config['*'] array so it looks like: $config['*'] = [ ... '...
1
vote
1answer
158 views

Ajax Post to Plugin Controller

I have been stuck on trying to make an ajax call to a custom plugin controller in Craft 2 for a few days after trying everything from following the documentation for Craft 2 as well as looking up ...
2
votes
1answer
44 views

Update a lightswitch field in Craft CMS 2

How can I edit a lightswitch field in an entries field layout via PHP? This is my current approach public function actionSponsoredEntriesPriority() { $this->requireAdmin(); $this->...
1
vote
1answer
57 views

Get entries based on custom field lightswitch in custom plugin in Craft 2

I am trying to get the entries in my custom plugin template ( CP ) Each entry has a lightswitch I want to fetch only those where lightswitch is enabled. In controller file: $criteria = craft()->...
1
vote
1answer
40 views

Open pop on click of custom action and get filled data

I created a new custom action. A new button is added in getAvailableActions() as we can se in below screenshot in red marked rectangle, now when i click on that button (Cusotm Action) i want to ...
1
vote
1answer
302 views

What is CDbException Error: SQLSTATE[42000]: Syntax error or access violation while moving a site to remote?

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #28 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'site....
1
vote
0answers
14 views

Templating not displaying after Craft server migration

A small team and I have inherited a Craft 2 site. We are brand new to craft with no previous experience with it. In wanting to work on offline copies of the sight the team is attempting to migrate the ...
1
vote
1answer
43 views

Craft error on NFS filesystem

I have a Craft 2 install that's been working fine until recently when the admin page is giving an error: file_put_contents(): Exclusive locks are not supported for this stream The front end is fine....
1
vote
1answer
65 views

Multiple and or relatedTo in plugin element criteria

I am trying to return entries that relate to a series of categories. For example, I am trying to return clothing, in this example, I want to return all entries related to (flannel or denim) and (blue ...
1
vote
1answer
37 views

ID of matrix printed instead of value

I have strange issue and cannot find out the solution for that. I have this field (matrix with some text values): https://imgur.com/a/KaFXubJ Also I have this entry: https://imgur.com/a/cPMrGul And ...
1
vote
1answer
31 views

Craft 2 - Returning Value in Variable from Plugin to Template

I am working with a plugin and wish to return a value from it to the template that calls it. In my plugin, there is an XML feed call, and I would like to pass a value(variable) from the plugin to the ...
1
vote
1answer
243 views

Variable “entry” does not exist in template at Structure Section

So, the subject. I am currently working with customer of craftcms v2. I am setting up Structure Section where I want to add Entry Type for index listing of items and add some items in list. So, here ...
1
vote
1answer
49 views

Craft 2, MySQL database, Twig, JavaScript files

I have created in Craft 2 CMS, under the profile of users (ex. parents), new tab for (children), where parents can fill in there children information. The data is saved in a database under the ...