Browsed by
Category: Optimize

How to cache Magento collection query results

How to cache Magento collection query results

Introduction Today, I would like to introduce “How to cache the Magento collection result” without customizing the PHP code. When you have worked with the Magento collection, you would like to consider if you can cache the result for the next time if the data aren’t generally updated by admin or 3rd tools. By default, Magento support saves the result of the collection to cache but it is not enabled by default, we have to add some custom to di.xml…

Read More Read More

Magento 2 Critical CSS and Core Web Vital Optimization

Magento 2 Critical CSS and Core Web Vital Optimization

Google requires the Core Web Vitals score for getting better on SEO. Web Vitals is an initiative by Google to provide unified guidance for quality signals that are essential to delivering a great user experience on the web. With Magento 2 Critical CSS and Core Web Vital optimization module we provides some ways to optimize CWV values and implement criticalcss.com service and some Core Web Vital optimization to your Magento 2 project. We built a service that allows generating the…

Read More Read More

Magento 2 – PHP Optimize Tips – Part 2

Magento 2 – PHP Optimize Tips – Part 2

Continue of Part 1. After part 1 you know how to process with large Collection, why we need to use Model Factory instead of Model in __constructor and Customer data sections to load a partition of the web page without disabling FULL page cache. Today I will provide you with consultation and assist you with some tips when you’re working on data. Tip 1: Use in condition instead of for each id and load Data Model You have an array…

Read More Read More

Magento 2 PHP Optimize Tips – Part 1

Magento 2 PHP Optimize Tips – Part 1

Magento 2 PHP Optimize Tips:There are many ways to optimize Magento 2. However, the first thing you should do is optimizing your codes before touching to DB or Cache. Tip 1: Using Factory in the constructor. Why did I say that? Because of the case very simple of Dependence Injection design working in Magento 2 => _constructor, __constructor … will be called, it’s very bad if in the constructor or default functions call for each Collection.=> If your classes are Factory the…

Read More Read More

How to override Magento 2 js using Mixins?

How to override Magento 2 js using Mixins?

How to override Magento 2 js using Mixins? A Magento 2 RequireJS “mixins” allows you to programmatically listen for the initial instantiation of any RequireJS, How do mixins in Magento 2 work? First, create requirejs-config.js Magento_Checkout/js/model/quote js file you want to rewrite.PackageName_ModuleName/js/plugin-quote target file.plugin-quote.js You can’t access the private variable from Magento_Checkout/js/model/quote. What is a private variable If your source file is returned $.mage.[widgetName] ex : Magento_Catalog/js/price-box.js Your destination file must return $.mage.[widgetName]

Config Redis Cache with Magento 2

Config Redis Cache with Magento 2

1. Raise somaxconn above [tcp-backlog] value: sudo nano /etc/rc.local Add this: sysctl -w net.core.somaxconn=65535 When you reboot the next time, the new setting will be to allow 65535 connections instead of 128 as before. 2. Make sure to disable Linux kernel feature transparent huge pages, it will affect greatly both memory usage and latency in a negative way. This is accomplished with the following command: echo never > /sys/kernel/mm/transparent_hugepage/enabled. then add the command to your /etc/rc.local file. if test -f…

Read More Read More