Adding a custom block to specific product type view pages in Magento 2

- Magento 2

Magento 2 Development

To add a custom block to specific product type view pages, use product type dependent layout updates catalog_product_view_type_{prodyct_type}.xml (catalog_product_view_type_ grouped.xml). For instance:

More tips from Magento 2 Developer’s Cookbook

Continue Reading

How Can I move a search bar in Navigation div in Magento 2 via XML?

- Magento 2

Magento 2 Development

You can put a search box after the navigation block and use css to make display it in one line, since html/topmenu.phtml block doesn’t print its child’s

Alternatively, you can overwrite html/topmenu.phtml to

More tips from Magento 2 Developer’s Cookbook

Continue Reading

How to Generate constructors in Magento 2

- Magento 2

Magento 2 Development

Because of Dependency Injection pattern Magento 2 have huge constructors for every class. World best PHP IDE PHP Storm can help you generate constructors and save lots of time in Magento 2 development.

With constructor generator you will be able to create constructors with arguments, with the value assigned to the field variables. Continue Reading

How to get a base url in Magento 2

- Magento 2

Magento 2 Development

To get a URL from your Magento root directory, use getUrl. Since it inherits from the AbstractBlock class (Magento\Framework\View\Element\AbstractBlock), you are able to use it with any of your blocks. Check the below example:

The first parameter is the path you need, while the second one sets the _secure option if the user is browsing over https. You can add to the path by concatenating a specific filename onto the getUrl call or you could add it to the first parameter as well. Please note that the path is relative to the root directory of your Magento install.

More tips from Magento 2 Developer’s Cookbook

Continue Reading

Magento 2 Redis Configuration

- Magento 2

using redis with magento 2

Below, I shed light on a proper Redis configuration for Magento 2. If you are not familiar with the solution, it is an advanced key-value cache with top notch performance. In addition, Redis is often considered to be a data structure server, which provides the following opportunities:

  • value incrementation in a hash;
  • appending to a string;
  • pushing an element to a list;
  • set intersection, union and difference computing;
  • getting a sorted set of members with the highest ranking. Continue Reading

Docker – The Revolution in Software Containerization

- Fire development

All about Docker containers

By using Docker, you can easily package an app with all its dependencies into a virtual container and run it on any Linux server. Thereby, you achieve flexibility and portability impossible without containerization. As a result, the app can run nearly everywhere: on premises, bare metal, public or private clouds. While similar functionality has been available for years, a revolution in the world of software containers was caused only after the appearance of Docker in 2013. In the following post, I describe the nature of this software solution; shed light on its benefits; compare Docker with other container software; and provide a list of hosting solutions, optimized for containerization. Continue Reading