nfourtythree
  • Member for 7 years, 7 months
  • Last seen more than a week ago
Is there a way to detect if a action is triggered from a control panel form?
8 votes

If anyone comes here looking for this answer for Craft 3 the function you are looking for is Craft::$app->getRequest()->getIsCpRequest()

View answer
How to display payment gateway error message only
5 votes

When submitting a payment form to the commerce/payments/pay controller action there are three potential sources of error messages. If you are submitting via a normal form submission (not ajax) you ...

View answer
Use sidebar nav icons in modules and plugins
Accepted answer
4 votes

You were almost there with it. You need to specify a path to an SVG. It can be one of the ones that exists within Craft's icon directory. So your nav item would look like this: Event::on( Cp::...

View answer
Customizing Stripe payment form for Craft Commerce 2
4 votes

The following code allows the customisation of the fields using Stripe Elements. This code will replace the payment form with gateway.getPaymentFormHtml({}). The thing to note here is this is ...

View answer
How to save Entries to an entry? (non-plugin)
Accepted answer
4 votes

All related fields need to be passed as an array even if it is limited to 1. so for example change your eventBooking and userBooking hidden fields to be the following (also you may need to specify ...

View answer
Commerce: Remove tax adjuster from line item in plugin
Accepted answer
3 votes

There is a way to do this, obviously, it is worth noting that the code below is written to be easy to understand and could be improved. Also, it is worth noting that there are plenty of things to ...

View answer
How does one get an order confirmation email to fire immediately in Commerce 3?
Accepted answer
3 votes

There are a couple of options here. Number 1 If you have the config setting runQueueAutomatically set to false you could call the controller action queue/run via ajax from your success page. This ...

View answer
Applying coupon codes via URL
2 votes

The following code can be used in the init method of a custom module. Event::on( View::class, View::EVENT_BEFORE_RENDER_PAGE_TEMPLATE, function($event) { // Check query string for ...

View answer
Change naming of sections in Craft Commerce CMS
1 votes

Commerce 3.0 introduces the ability to rename the Product Title and Variant Title when creating a product type.

View answer
Mandatory order fields in Craft Commerce 2
Accepted answer
1 votes

There is a setting for this specific instance allowEmptyCartOnCheckout. Creating a commerce.php file in the config directory with the following code will prevent customers from checkout out with an ...

View answer
How do I get the data from a relation field?
Accepted answer
1 votes

If you already know the custom field name then it is pretty straight forward: $currentEntry = craft()->entries->getEntryById($id); $relatedEntries = $currentEntry->customFieldName; Then you ...

View answer
Invalidate cache on new order
Accepted answer
0 votes

In your code you are only caching until the dateOrdered of the latest order. That means that viewing the page will always be ahead of the cache time. You could look to do the following: {% set ...

View answer