Magento 2 Product EAV Index Failing After Downgrading

Published: January 18, 2018


Recently one of my co-workers reported experiencing the following error when running a product eav reindex.

SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1, query was: INSERT INTO `catalog_product_index_eav_idx` SELECT DISTINCT  `pid`.`entity_id`, `pid`.`attribute_id`, `pid`.`store_id`, IFNULL(pis.value, pid.value) AS `value` FROM (SELECT DISTINCT  `s`.`store_id`, `s`.`website_id`, `dd`.`attribute_id`, COALESCE(ds.value, dd.value) AS `value`, `cpe`.`row_id`, `cpe`.`entity_id` FROM `store` AS `s`
 LEFT JOIN `catalog_product_entity_int` AS `dd` ON dd.store_id = 0
 LEFT JOIN `catalog_product_entity_int` AS `ds` ON ds.store_id = s.store_id AND ds.attribute_id = dd.attribute_id AND ds.row_id = dd.row_id
 LEFT JOIN `catalog_product_entity_int` AS `d2d` ON d2d.store_id = 0 AND d2d.row_id = dd.row_id AND d2d.attribute_id = 292
 LEFT JOIN `catalog_product_entity_int` AS `d2s` ON d2s.store_id = s.store_id AND d2s.attribute_id = d2d.attribute_id AND d2s.row_id = d2d.row_id
 LEFT JOIN `catalog_product_entity` AS `cpe` ON cpe.row_id = dd.row_id AND (cpe.created_in <= '1509969103' AND cpe.updated_in > '1509969103') WHERE (s.store_id != 0) AND ((ds.value IS NOT NULL OR dd.value IS NOT NULL)) AND (COALESCE(d2s.value, d2d.value) = 1)) AS `pid`
 LEFT JOIN `catalog_product_entity_int` AS `pis` ON pis.row_id = pid.row_id AND pis.attribute_id = pid.attribute_id AND pis.store_id = pid.store_id WHERE (pid.attribute_id IN('802')) AND (IFNULL(pis.value, pid.value) IS NOT NULL) AND (NOT(pis.value IS NULL AND pis.value_id IS NOT NULL))

The error indicates that catalog_product_index_eav_idx does not match the column list being INSERT-ed…

IFNULL(pis.value, pid.value) AS `value`

I asked my co-worker to check and indeed, catalog_product_index_eav_idx contained an additional column (source_id).

Digging In To Magento 2 Logging

Published: January 15, 2018


For better or worse, logging has changed a lot in Magento 2.

Previously the Mage god class defined a static log method through which all logging happened.

// app/Mage.php
public static function log($message, $level = null, $file = '', $forceLog = false)

Now, logging uses a light wrapper on top of Monolog.

There’s already some good information outlining how to do logging in Magento 2, so we won’t focus on that here (well, we will look at it, but only very briefly). Instead, here we’ll dig into the core Magento logging code to understand exactly how logging works in Magento 2 internally.

Removing Paginated URLs From jekyll-sitemap

Published: January 14, 2018


While I couldn’t find any official statements from Google on the matter, leaving paginated URLs out of your sitemap generally seems to be agreed upon as best practices.

However, by default, if you’re using jekyll-sitemap to generate a sitemap for your Jekyll based website, paginated URLs will be included.

In this post, let’s explore how you can remove these URLs from your sitemap.

Magento / / SUPEE-10415 Causing Every Page To 404

Published: January 11, 2018


Magento / and SUPEE-10415 contain a potentially serious bug. Under certain conditions, every single page on your site will 404.

What’s worse, in my experience, reproduction of the issue can be dependent on site configuration. In my case, it wasn’t until the patch went to production, that the issue surfaced.

In this post, let’s review the issue.

Magento 2 Elasticsearch Notes

Published: January 9, 2018


This post is a catch all location for my notes on working with Elasticsearch in Magento 2. It will be continually updated as I continue to spend more time with Elasticsearch.

Magento Lesson #579: Don't Use The Config For Flags

Published: January 5, 2018


Orders are not flowing from Magento to our ERP

Sound familiar?

I’ve been engaged in an ongoing investigation of this nature on a particular project and finally got to the bottom of it today.

The lesson learned…don’t use the config for storing flags.

Let’s take a look at what happened