Hot answers tagged

40

E-commerce Master List This is a compilation of all publicly available solutions. Other answers here describe each plugin in greater detail... This is simply a complete list of every known option. Listed in alphabetical order (not by popularity or preference) 1st party plugin Craft Commerce (see more info below)* 3rd party plugins (built exclusively for ...


23

One way to accomplish this is to write some code in the init() function of your root plugin file. So in your example that might look something like: class MyFunkyPlugin extends BasePlugin { function init() { // check we have a cp request as we don't want to this js to run anywhere but the cp // and while we're at it check for a logged in user as ...


17

I've actually done this a couple of times... a very simple "password-only" page. Then there would be a large group of people who share that same password, and can gain access to that protected page. Disclaimer: This example was built using the Business Logic plugin template. There are many ways to manage your password, but it sounds like you'll want ...


17

On top of checking within the admin area, there are some other ways you can do this, both in templates and in your plugins. In a template {# Second argument is if you want enabled only #} {% set plugin = craft.plugins.getPlugin('pluginHandle', false) %} {# Now you have access to these methods... #} {{ plugin.isEnabled() }} {{ plugin.isInstalled() }} For ...


16

For future reference, I had the same error and resolved it with Craft Support. In my case the project.yaml file got out of sync with what was in the database. Running craft project-config/rebuild from the project's root resolved the issue and allowed us to re-enable the plugins


15

I just finished my first Snipcart project and I'm in the process of making a plugin for browsing orders and customers from the Craft control panel. Lindsey D's got the landscape covered with his answer so I can at least share my experience with Snipcart: Snipcart For those who somehow skipped other answers or haven't looked at Snipcart, it's a JavaScript ...


13

If by styles you mean the formatting drop-down, just add them in an array: { buttons: ['bold', 'italic'], formatting: ['p', 'blockquote', 'h2', 'h3', 'h4', 'SomeHtmlTag'] } . If you want to have a button which adds custom CSS-classes, take a look at: Redactor CSS by Nathan Doyle Update (July 2015) Craft 2.3.2615 (Dec 2, 2014) and above use ...


13

The easiest way I have found to password protect page content is as follows: {% if craft.request.getParam('password') == 'password_you_want' %} <h2>This is your content</h2> {% else %} <h2>Not authorized</h2> <form action="{{ craft.request.getUrl() }}" method="POST" accept-charset="utf-8" class="form-inline"> ...


12

I've yet to try it but Snipcart seems to be on of the most viable options right now. Essentially it works though HTML/JavaScript and integrates with fields you define in your Craft setup, see their post explaining here. You can even update your inventory using their webhooks, again they explain how to here. The only others that you haven't mentioned but are ...


12

Josh's answer is great if you are interested in building your own plugin. But if that's a little much for you, you're still in luck... You can use these plugins to quickly & easily add CSS and JavaScript to your control panel: Control Panel CSS plugin Control Panel JS plugin Disclaimer: I wrote both of those plugins, let me know if you run into any ...


12

Check if the plugin folders in craft/plugins are named correctly. Most local environments aren't case-sensitive, but most servers are. Valid: craft/plugins/trunchtml/ craft/plugins/import/ Invalid: craft/plugins/truncHTML/ craft/plugins/Import/


12

Craft ships with Redactor’s Table plugin, but you must add it to your Redactor config yourself (in craft/config/redactor/). { // ... plugins: ['table'] } To determine which config file to place this in, go to your field’s settings in Settings → Fields → [your Rich Text field name], and check your “Redactor Config” setting.


11

Here are some. Store Hours (P&T) match input Mandrill (P&T) Entry Count Minify (9/17/2016) MN Twig Perversion (9/19/2016) Stamp (9/21/2016) Inlin (9/21/2016) Mention more in the comments, and I will add to this list.


11

So this sounded like a fun problem to solve... so I wrote the Template Comments plugin that does what you want: This free plugin adds a HTML comment to demarcate {% block %}s and each Twig template that is included or extended.


10

Everything you need to manage tasks is in the TasksService, so you should be able to just use that in your controller action to kick off any pending tasks, using something along the lines of: if (!craft()->tasks->isTaskRunning()) { $task = craft()->tasks->getNextPendingTask(); if ($task) { craft()->tasks->...


10

You can implement your entire Task with a single step if you want. The only point of breaking it into multiple steps is so the task progress bar has an idea of how far along the task is. In your case, since your task is broken up into multiple unrelated processes, you might want to implement it with subtasks. So the top-level task only has a couple of steps ...


10

Unfortunately, a simple HTML file input on its own isn't enough to upload an image (in Craft or anywhere else) – the input simply exposes the file on your local filesystem to the browser/server. In other words, with your current setup, you're not actually uploading anything. In my opinion, you have two choices: Use Assets and Craft's built-in Assets ...


9

Foxycart indicates they are jumping in https://twitter.com/foxycart/status/478952251239567361


9

You can use dot notation: craft()->request->getPost('fields.notes');


9

It's worth noting that as of Craft 2.5, it's now using Redactor II, so the above code examples don't work if you have upgraded. Here's a working JSON config example you can build on: { "buttons": ["format","bold","lists","link","file","image"], "plugins":["source","fullscreen"], "toolbarFixed": true, "formatting": ["p", "blockquote", "h2", "...


9

It isn't possible to uninstall a disabled plugin; you'll need to first enable the plugin, and then the Uninstall option will be available. The correct way to remove a plugin is actually to first Uninstall it. After uninstalling, you can either run composer remove vendor/plugin-handle from the command line, or select the "Remove" option from the Control ...


8

Currently there isn't a native function to do this. The only plugin that I know of that can do this, is Sprout Email from Barrel Strength Design. EDIT: I just released a plugin called Craft-Mailer which does what you are looking for.


8

Victor answers my questions regarding the formatting tags and the fact that you need to create a Craft plugin to add Redactor plugins. Since there wasn't a solution for adding classes on inline elements with custom classes/styles, Nathan's plugin only supports block elements, I created a plugin that wraps the Styles Redactor plugin. You can get it here: ...


8

Have a look at plugin template variables. You can simply create a method in your plugins variable file that returns anything you want to the template, which would be accessible via {{ craft.myplugin.customVariable }}. <?php namespace Craft; class MypluginVariable { public function customVariable($someProperty = 'defaultValueIfNotDefined') { ...


8

First, you should get all the Merchant Entries with the merchantId of 123 $criteria = craft()->elements->getCriteria(ElementType::Entry); $criteria->section('merchants'); $criteria->merchantId = '123'; $merchants = $criteria->find(); Next, find all Gift Card entries that are related to the found merchants. $criteria = craft()->elements-&...


8

There's no block types with SuperTable, so no need to check that. Other that that it works just the same as Matrix fields. {% for row in superTableField %} {{ row.textFieldInSuperTableField }} {% endfor %}


8

At this point, after much playing around it seems to be working (at least on to the next bit of debugging). To sum up, it was mostly changes to composer.json, followed by composer remove kr37/calendar37 composer require kr37/calendar37 src/Plugin.php became src/Calendar37.php Added "class": "kr37\\calendar37\\Calendar37" to the "extra" part of composer....


7

Natively, there is no direct way to do this. It is possible, however, to easily create this functionality with a plugin... Build an ElementCriteriaModel which will return a list of all users. Organize that data into a batch (or multiple batches) of recipient email addresses. Use the EmailService API to generate an email to your selected recipients. ...


7

It’s not possible for a form to simultaneously invoke two controller actions. You would need to write a plugin that provides its own controller, which in turn could be used to invoke the other controller actions. class MyPluginController { public function actionSaveEntryAndSendNotification() { // Save the entry craft()->...


7

Currently multi-site support isn't planned. If you want simple multi-site-support you could use the localization feature with a custom locale. But with Craft's auto-update's and easy deployment, why would you want to use MSM anyway? . ...we're pretty against adding it to Craft... at least in the way EE did it, where everything is stored on a per-site ...


Only top voted, non community-wiki answers of a minimum length are eligible