Class not found in AbstractFactory

Today I had some trouble with removing a module on Magento2 and its custom product attributes. After removing the code of Mageplaza_Seo I was not able to edit products, categories or even checkout anymore.

The reason was an attribute called mp_meta_robots which was still pointing to the class \Mageplaza\Seo\Model\Source\Robots. I found the attribute by checking the table eav_attribute as follows.

Removing this via backend or MySQL has fixed the problem.

Update Order Status With SQL Queries in Magento2

Today I had to update order numbers which were processed already, but not updated in Magento. Here is how I changed the order status directly in the database based on the increment_id.

The first query will update the state and status on the table sales_order.

The second one will update the status in the grid view in Sales > Orders.

Cannot gather stats! Warning!stat(): stat failed

Today I imported a couple of new products with uRapidFlow in Magento 2.1.2. I ran the import with the option Action on missing image file which was set to WARNING and update image field. It worked fine, but I accidentally forgot to upload the product images.

So basically uRapidFlow added non-existing product images to the database which broke the product edit form in the admin panel.

The temporarily solution was to manipulate ./vendor/magento/module-catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php in vendor around line 142,143.

I basically added is_readable to check if the file exists. Not great, but at least I was able to edit products again and proceed with a permanent fix.

Related issues:
https://github.com/magento/magento2/issues/5497

Captcha Test For Your Contact Form

The following PHP script allows you to test your contact form captcha integration in Magento. If you receive any email after executing this script, you have to review your captcha integration.

You may need to add, remove or rename fields in the $field array. Don’t forget to replace {base_url} with your actual URL.

Delete Quote For Specific Customer In Magento2

Sometimes a quote can be linked with product id’s which doesn’t exists anymore. In some cases it can cause broken MySQL joins. Here is how you can flush the quote for a specific customer in Magento2.

Remove the WHERE clause to flush the quote for all customers.

AWS RDS – You Need (at least one of) The SUPER Privilege(s)

Today I had the opportunity to move a local Magento database to an Amazon RDS. Based on the well-documented article Creating a DB Instance Running the MySQL Database Engine I was optimistic to finish the migration pretty soon. But as you know, there is always something that goes wrong.

After creating the database instance class ( db.m3.large ) I have decided to proceed with some test imports before I change any database credentials in Magento.

Good decision because the first import didn’t run through.

I was able to fix the problem by adding the missing parameter log_bin_trust_function_creators as explained here. Before the next import I had to delete the database and create a new one.

Unfortunately there was another problem with a DEFINER which tried to create a trigger as a different user. On Amazon RDS only a user with SUPER privileges can do that. Therefore, I had to remove the DEFINER from the MySQL schema you see below.

That’s it. Now I was able to import my DB on Amazon RDS without errors.

 

Find Missing Or Not Readable Product Image Files

With the following script you can detect missing or not readable image files, based on your product collection. Good before project launch or after product imports.

Find the Gist here.

We’re sorry, an error has occurred while generating this email

Today, I was dealing with the following error message on one of our Magento2 production environment.

After spending 2 hours trying to find the source of the problem in our custom modules, I was able to fix the issue by disabling the core module Magento_SampleData.

What is this module for? This module gives you different sample data ( CMS, Catalog, Customers ) which is useful during development and testing phase. For your production environment it is not necessary and also not recommended to have it installed, as you can read here.

Table is marked as crashed and should be repaired

Don’t freak out if your Magento is not working and because of the following error message.

The reason of a crashed MySQL table is mostly related to a server issue. For example:

  • Any kind of hard-disk failure
  • Sudden server reboot (power outage in hosting)
  • Hard server reboot (ACPI shutdown)

In most cases you can repair the affected table with a simple repair command, which comes with MySQL.

This command looks pretty easy and safe, but keep in mind that you should always create a backup before you change anything in your database, because probably more MySQL tables are affected.