Search the Wiki

Viewing 11 to 20 of 223 items

Magento 2 – Get min price or max price from product collection

Today we learn about how to get min price and max price from product collection. First, you have to get a collection of the product. Then their two predefined functions for getting min price getMinPrice and get max price getMaxPrice Now we implement the code for getting min price and max price. protected $_productCollectionFactory; public  Full Article…


Magento 2 – The resource from pub/ directory was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff)

When you deploy the source code to the live server, you may see the issue The resource from pub/ directory was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff)… You can solve it by the following ways Remove all files from var/ folder by using this command rm -rf var/* Check for .htaccess in  Full Article…


Magento 2 – Write logs to the custom files

In Magento 2, you can use the following code to write logs to the custom files $writer = new \Zend\Log\Writer\Stream(BP . ‘/var/log/templog.log’); $logger = new \Zend\Log\Logger(); $logger->addWriter($writer); $logger->info(“Log info: “. $e->getMessage());


Ubuntu – Install different PHP (5.6, 7.0 and 7.1) versions

PHP (recursive acronym for PHP: Hypertext Preprocessor) is an open source, popular general-purpose scripting language that is widely-used and best suited for developing websites and web-based applications. It is a server-side scripting language that can be embedded in HTML. Currently, there are three supported versions of PHP, i.e PHP 5.6, 7.0 and 7.1. Meaning PHP 5.3, 5.4 and 5.5have all reached end of life; they are  Full Article…


Magento – Get comment history of the order

You can use the below code to get the comment history of the order. $orderId = 100000454 ; $order = Mage::getModel(‘sales/order’)->loadByIncrementId($orderId); $commentsObject = $order->getStatusHistoryCollection(true); foreach ($commentsObject as $commentObj) { echo $commentObj->getComment() .” created at”.$commentObj->getCreatedAt() ; }


Ubuntu – Laptop’s touchpad doesn’t work

In this tip, we will see a solution that will fix a non-working laptop’s touchpad. The problem often occurs after upgrading your Ubuntu distribution to Ubuntu 16. Solution Open the terminal and run these commands: sudo apt update sudo apt install xserver-xorg-input-synaptics or sudo apt install –reinstall xserver-xorg-input-synaptics Then reboot your laptop: sudo reboot Hope  Full Article…


Ubuntu – How to deploy a Meteor.js application on Ubuntu with Nginx

Before You Begin You should have: An existing Meteor app on a separate development computer (you can view the example “Todo List” app here; instructions are provided later in the tutorial) A fresh Ubuntu 14.04 server; existing Meteor installations should work in most cases root access to the server to execute commands Updated package lists. Execute:apt-get update Replace with the  Full Article…


Magento – Get the last order ID

There are many ways to get the last order ID in Magento, here is the detail:  1. From the checkout session.   $lastOrderId = Mage::getSingleton(‘checkout/session’) ->getLastRealOrderId(); $orderId = Mage::getModel(‘sales/order’) ->loadByIncrementId($lastOrderId) ->getEntityId(); This solution will not work in case you want to get the last order ID in the backend. 2. From the model. $orders =  Full Article…