Showing posts with label error. Show all posts
Showing posts with label error. Show all posts

2017/03/24

How to setup an event based sales rule, or - grant a discount if the customer experiences an error!

Increase conversion

Monitoring- and Analytictools like Google Analytics are great things to optimize your E-commerce system to sale more of your products.

But, wouldn't it be great to interact with the user right in the situation, when he is leaving the direct way to the checkout and maybe changing his mind?

To guide the user back on the way to a sale you can for example  apply a exclusive discount or put a free product to is cart - event based and automatically.

How to setup an event based sales rule

First off, you'll need to download the latest Notify module for Magento here: https://grafzahl.io/notify-module/

Now you are able to go through the easy install process, which is explained here: https://documentation.grafzahl.io/notify-module/doc/install-setup.html

At this point, we are very close to our goal.

Create a new notification

General settings

To do that, click on your Notify menu in the main navigation of your Adminpanel.

Now you'll see the common Magento grid where you can add a new Item with the upper right "New"-Button.

This page will load:
Notify General Tab
The Notify Configuration Item in the Magento Adminpanel. "General"-Tab.


Fill your Title and Description. These fields are not used for technical purpose. They are only for you to identify the notifications.

The switch "Active" is self-explaining. The transmission type defines, how your notifications or reports are send to you. The default is Email. More transmission types like Slack, SMS or Logfile are on our Todo-List.

The summary type option will give you the possibility to summarize any of the recorded issues of this notification:
  • Immediately: The issue will be sent immediately as it is recorded. The Report configuration will offer you Text-Templates to define the message which is composed for the specific issue.
  • Daily, Weekly, Monthly: The issues of every defined event-trigger will be summarized and reported in the selected frequence. The Report configuration will offer you different elements which you can configure to compose the collected data in any way you would like to see the issues.
Click Immediately here, to get notified immediately. This also is an indication for you, that your sales rule has been applied.

With the Store Multiselect field you can decide, in which shops this notification item is valid and collects issues.

Trigger selection

The trigger selection looks like this:
The Notify Event-Trigger Selection. The left column contains all Areas. When you click on an Area, the second column will list all available Event-Triggers for that Area.


You can select from some defined Trigge-Events that are available for Notify. The name of them are describing most likely when they are triggered and therefor creating a new issue.

The Trigger are devided into Areas. They are explaining where this Event will trigger, like "Admin Panel".
When you click on one of the Areas, you will get a list of all available Events in the second column.
Clicking on one of them will add it to the right column. This indicates that it is selected for your Notification.

We want to apply a sales rule, when the customer opens a 404-Page. Therefor we select "Error" and "User gets 404 page" to get notified every time a customer opens a URL in our online store which does not exists.

To go on with the Rule Conditions and Report Configuration you'll need to save the Notification by now. This enables the Trigger selection and reveal the fields for the Triggers in the next Tabs.

Rules configuration

This Tab will let you filter the issues on information that is available in the situation of the issue. At the moment there are no filter options for the 404-Error-Trigger. So we can skip that.

Report settings

This is where you define what is reported in case of an issue. You will see a Textarea field with available Placeholders on the right. You can type any text you like and add those placeholders to create a message that is most informative for you.

Define your message for that Issue and fill it with the available Placeholders on the right. Click "Save Template" to submit the Template text. Then click "Save and Continue Edit".

Define the automated Action

This configuration is the most interesting. Here you can define what will happen if the issue was reported.




You will get the form above, if you enable the switch on the right. Select the option "Apply a sales rule" on the left side of the form.

In the loaded options on the right, select the sales rule which should be applied to the customers cart after he got a 404 Page.

Now you are ready.

2017/03/16

How to get an Email Notification for every Exception

Magentos error handling is pretty good. PHP Errors, Warnings or Notices are written into the system.log file and Exceptions are caught by Magento to show the customer a (not very good looking) page and write the error stack into a file as a report for the system administrator.

Ok, but how often are those exceptions coming up? Sure - you tested your ecommerce store very well to prevent those situations for your customers, but you know - its software!

Even the best tested site is not 100% bug-free.
Some customers may contact you and report their error but the most wont. And you really want to fix any Exception that is thrown by your shop.

So here is the solution: We'll integrate an instant notification or a daily report for any exception that is occuring on your Magento webshop.

With the help of our module Notify for Magento, that is very easy.

The module is a notification system that also can create summaries of the collected data and send them as recurring reports.

To be able to configure a notification or report for a thrown exception, we only need to insert a little piece of code into the exception page:


// prepare data object
$data = Mage::getSingleton('notify/issue_data');
$data->setTrigger('customer_experienced_exception')
    ->setArea('error')
    ->setBacktrace(htmlspecialchars($this->reportData[1]))
    ->setError($this->reportData[0])
    ->setReportId($this->reportId);
// trigger customer_experienced_exception
Mage::helper('notify/notification')->recordIssue($data);

Put this on the end of the file /errors/default/report.phtml.

We have to setup this new trigger for Notify to be able to configure a notification or report in the admin panel.

Open your notify.xml of your custom module that extends Notify or of Grafzahl_Notify module (not recommended).

Add the configuration for our new trigger (config/notify/trigger - node):


<error label="Error">
    <customer_experienced_exception label="User gets an Exception">
        <enable>1</enable>
        <passed_data>
            <error type="string">Error Message</error>
            <report_id type="string">Report Id</report_id>
            <backtrace type="string">Backtrace</backtrace>
        </passed_data>
        <renderer>notify/renderer_error_customerExperiencedException</renderer>
    </customer_experienced_exception>
</error>


Create the renderer class and you are done! The renderer class is only a simple class with extends the renderer abstract like the following:


/**
 * Grafzahl_Notify
 *
 * @category    Grafzahl
 * @package     Grafzahl_Notify
 * @copyright   Copyright (c) 2017 Grafzahl (https://grafzahl.io)
 * @license     https://grafzahl.io/license
 */
class Grafzahl_Notify_Block_Renderer_Error_CustomerExperiencedException
    extends Grafzahl_Notify_Block_Renderer_Abstract
{

}

It is recommended to create those files in your custom module that is extending the default Notify module.

Configure the notification

Now you can configure the report or notification in the admin panel. Read about that in our documenation.

To get this powerful notification module for your Magento store, visit https://grafzahl.io/notify-module

2016/11/20

Fatal Error in Magento: Class Mage_YourModule_Helper_Data not found in app/Mage.php on line 547

This is an error, which I faced some times after late nights in code.

It is a very bad error message, because it does not explain what´s really going wrong. This is also problem, because you do not know where to search for the error. Especially if you done some more changes in your code and you need to go through every single change with your GIT diff.

The reason of this error is, that you or another module of your Magento installations accesses a configuration from the XML files which is not valid. In most cases it is a typing error in a recent added or changed config section.

The solution


To solve this error: go carefully through your XML configuration in config.xml, adminhtml.xml, system.xml or any layout XML file and find the mistyping node.
It could be a close-Tag which is typed different from the open-Tag or vise versa. Or it could be a missing close-Tag.

Sometimes some of this mistakes could also lead to strange behaviour like your custom module is not activated anymore and as a result controllers actions are not working which will cause 404 on routes that were working before this mistakes.

I hope this little hint will save somebody ours of debugging!

2012/01/04

Fehler beim updaten der rails gems: coffee-rails

Wenn man versucht ein update der gems durchzuführen und dabei folgender Fehler auftritt:
Updating coffee-rails
ERROR:  While executing gem ... (NoMethodError)
    undefined method `call' for nil:NilClass
kann man ihn mit einem Update von den RubyGems wieder beheben. Auf der Umgebung lief Rails 3.1 und RubyGems 1.3.7. Nach dem Update auf RubyGems 1.8.13 lief das Update sauber durch.
# gem install rubygems-update
Falls danach beim Update Fehler - ähnlich wie diese - auftauchen sollten:
Invalid gemspec in [/usr/local/ruby/lib/ruby/gems/1.9.1/specifications/therubyracer-0.9.8.gemspec]: invalid date format in specification: "2011-10-07 00:00:00.000000000Z" Invalid gemspec in [/usr/local/ruby/lib/ruby/gems/1.9.1/specifications/json-1.6.1.gemspec]: invalid date format in specification: "2011-09-18 00:00:00.000000000Z" Invalid gemspec in [/usr/local/ruby/lib/ruby/gems/1.9.1/specifications/rack-cache-1.0.3.gemspec]: invalid date format in specification: "2011-08-27 00:00:00.000000000Z"
kann man diese folgendermaßen beheben.
  1. Die entsprechende Datei in der Fehlerausgabe in einem Editor öffnen.
  2. Die Zeile mit s.date = suchen
  3. Den Zeitwert 00:00:00.000000000Z löschen, sodass die Zeile so wie diese aussieht:  s.date = %q{2011-10-07}