Blog

Magento 2 Enterprise Special Price Confusion

Published: January 24, 2018

Tags:

One of the coolest features in Magento 2 Enterprise (a.k.a Magento Commerce) is Content Staging. Content staging allows store administrators to schedule updates for product attributes, and preview the changes prior to go live including providing a share-able link.

With the introduction of this feature, Magento was faced with a decision…what should be done with pre-existing facilities that already allowed (primitive) scheduling? For example, Special Pricing could already be scheduled via the “Special Price From Date” and “Special Price To Date” attributes.

Ultimately, Magento seems to have decided to attempt to prevent store administrators from using these features at all in favor of scheduled updates. This can be demonstrated both through the source code and documentation.

While this sounds good in theory, in practice it hasn’t worked out so well from what I’ve seen. In this post I’ll discuss my experience and thoughts.

Magento 2 Product EAV Index Failing After Downgrading

Published: January 18, 2018

Tags:

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…

`pid`.`entity_id`,
`pid`.`attribute_id`,
`pid`.`store_id`,
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

Tags:

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

Tags:

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 1.9.3.7 / 1.14.3.7 / SUPEE-10415 Causing Every Page To 404

Published: January 11, 2018

Tags:

Magento 1.9.3.7 / 1.14.3.7 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 Cheatsheet

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.