How to install magento 2 marketplace module by composer approach?

This article will helpful for the Installation of the Magento Marketplace extension with Composer in Magento 2.

To install an extension or download the extension code for review from the Magento marketplace, you must need to use Composer.

To promote the best practice of installing extensions via Composer, direct package download from the My Purchases page has been disabled. (Source: Adobe Marketplace site)

Let’s take an example of installing a module from the Marketplace. Continue reading “How to install magento 2 marketplace module by composer approach?”

How to add debug log in the magento 2 using Zend Log?

You can add Debug log in the Magento while you are working with the development feature for your project.

If you need to temporarily debug some of the code while working with the feature, you can directly add the given code snippet to your files to debug or print the log.

You can assume, want to print array data, $data = [‘test1’, ‘test2’];

$writer = new \Zend_Log_Writer_Stream(BP . '/var/log/custom.log');
$zendLogger = new \Zend_Log();
$zendLogger->addWriter($writer);
$zendLogger->info(" Message Log " . print_r($data, true));

While your file runs the above code, In your system, check the root path starting with the var/log folder and a new custom.log file will be generated with your debug log.

This is the basic way you can add your log to the temporary var/log folder while working with the complex features of your project.

How to use foreach loop with the array and objects in knockout js magento?

knockout Javascript with Foreach loops for the observable array and objects with the data-bind property of the DOM tag.

Let’s start with a simple for each loop with an array that contains the numbers only,

JS file contains the knockout declaration of the observable array, called getNumbers property, Continue reading “How to use foreach loop with the array and objects in knockout js magento?”