Introducing Ask the Magento Experts: We talk to the pros about Magento extensions and hosting configuration

June 23, 2016 by Leah Na'aman

Introducing Ask the Magento Experts!

 

At Shoppimon we get a lot of questions on a wide range of Magento topics from our customers, partners and the Magento community. And while we’re always happy to share all we know on a given topic, we figure it’s sometimes best to just hear it straight from an expert. So today we’re launching a new monthly series called Ask the Magento Experts! And each month we will share the most up-to-date and detailed answers available to all of your burning Magento questions, straight from the best and brightest in the Magento Community.

This month we asked our experts to answer questions on the ideal hosting configuration for Magento 1 vs. Magento 2 stores, what the process of creating and launching a custom Magento extension looks like, and to give us a few examples of common extension conflicts they’ve experienced or encountered, so we’ll all know how to handle them next time we run into them.

Let’s Meet this Month’s Experts

 

Introducing: Ask the Magento Experts

What does the process of creating and launching a custom extension look like? And do you have any tips or recommendations for someone starting the process?

 

Leonid Tomashevsky: When launching a new extension, it is really important to dedicate sufficient time to mapping out the architecture, because you won’t be able to change it easily in future iterations.

For example, when writing Checkout Fields Manager for Magento 2 (which is also one of our best-selling Magento 1 plugins), I spent about a week studying the Sales and EAV structure. This allowed me to find an elegant solution for expanding the EAV system of the Order that would work for adding new attributes or altering existing ones, and could be implemented at any step of the checkout.

Vitaliy Charnou: One thing to watch out for when creating a new extension is module dependencies. That is, when you initialize a module, the constructor creates a chain of dependencies between classes.

Sometimes, a child class may indicate itself as the parent class somewhere down the line, and this will lead to an infinite loop of dependencies.

Another issue we have frequently encountered in Magento 2 when launching or updating an extension is difficulty introducing new javascript files. For the newly added files to appear in Magento, it is necessary to reset the folders in the pub file. And the bin/magento commands may not always help.

What are some examples of common extension conflicts you see in Magento? And how can you resolve them?

 

Leonid Tomashevsky: When speaking about extension conflicts, I would differentiate between Magento 1 and Magento 2. In Magento 1, conflicts occur primarily because of rewrites. It’s easier for a developer to do a quick rewrite, rather than to look for a holistic solution. However, if several extensions rewrite the same class, you get a conflict.

Take this for example: You see many extensions rewrite this block, Mage_Adminhtml_Block_Sales_Order_Grid to add custom columns to Orders, while you can achieve the same outcome with layout handles without causing any conflicts.

If we talk about Aitoc extensions, they each have an automatic Rewrites Manager that helps resolve typical issues. It checks for rewrite instances (when a class has two or more rewrites), and programmatically makes conflicting classes extend one another.

In Magento 2, things look much brighter. There is a plugin functionality in place, and developers no longer need rewrites. This minimizes the risk of conflicts, because each extension now has its own plugin, and it does not interfere with Magento’s core.

Vitaliy Charnou: Having worked on several back-end extensions for Magento 2, there are some workarounds we use to make sure our modules don’t conflict with other extensions.

Right now, many admin-panel pages in Magento 2 consist of HTML that calls child blocks. Theoretically, you could rewrite the HTML file in the module, but in the case of multiple modules, this will lead to a conflict. We solve this by inserting a block to the file while it is generated, on the fly. Another possible solution would be to add a custom page to the admin panel.

Speaking of UI components, they do allow you to add blocks, which is great! But if you need to remove or alter a block – nope, you can’t do it. So we achieve this by writing a plugin.

Another tough part is working with Web API. In most cases you can’t add a custom block with additional data even if you write a plugin, because many methods are private. To solve this, we create new services.

 

What is the ideal hardware configuration for running a Magento 1 vs. a Magento 2 site?

 

Miguel Balparda: From a hosting perspective there are quite a few differences between Magento 1 and 2. The first one to note is the compatibility of Magento 2 with PHP 7 and the lack of official PHP 7 compatibility for Magento 1. While redis and memcache (still waiting for a memcache module for php7) remains the same, Varnish is 100000 times easier to install and configure in Magento 2, where you don’t have to deal with extensions like Turpentine! ;D

From our experience at Nexcess, Magento 2 also requires a higher php memory_limit and needs composer to work properly. The permission schema has also changed in Magento 2 allowing a wider set of permission combinations for different scenarios by using a magento_umask file.

 

Thank you to this month’s experts

 

We’d like to give a big thank you to Miguel, Vitaliy and Leonid this month’s experts for sharing their wisdom!

Aitoc is a world-leading provider of custom solutions for Magento. It is one of the few companies that have been creating Magento extensions since the very launch of the eCommerce platform. Founded in 2001, Aitoc produced its first collection of Magento modules by 2009. Ever since, it has been engaged in Magento web development.

Nexcess is a Southfield, Michigan-based managed Magento hosting company founded in 2000, with data centers distributed throughout the United States, Europe, and Australia. Nexcess offers a variety of Magento hosting services ranging from entry-level packages to custom clustered/complex hosting configurations, with an emphasis on achieving maximum performance for high-profile stores. For more information, visit http://www.nexcess.net.

 

Join us again next month

 

Join us again next month for a new Ask the Magento Experts. And if you have questions you’d like our experts to answer, feel free to post them in the comments below or email us at info@shoppimon.com or message us on Twitter at @Shoppimon. We look forward to hearing from you!

 

Facebookgoogle_pluslinkedin

Author