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…
Search the Wiki
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…
Magento – Select all values of an attribute by using SQL
It is useful to be able to export lists of brands, whether you just need a quick list directly from PHPMyAdmin, or you need to pull this information into 3rd party app. To get all the attribute values for an attribute called brands, you can run the following query SELECT EAOV.VALUE FROM eav_attribute EA LEFT 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 todos.net with the Full Article…
Magento – Convert attribute type from TEXT to DROPDOWN
This article will show you how to convert attribute type from TEXT (varchar) to DROPDOWN / SELECT (int) in Magento back end. Magento doesn’t have this in-built so we will have to do it in our own way. We will convert our existing attribute which is in TEXT type, to DROPDOWN (select). Let’s say our 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…