Basic atop Usage

What is atop? Taken from the man page: The program atop is an interactive monitor to view the load on a Linux system. It shows the occupation of the most critical hardware resources (from a performance point of view) on system level, i.e. cpu, memory, disk and network. Raw Data Format The raw data format is a binary log file that atop can be configured to record. This log file can be generated for any length of time and allows you to go back in time to debug system performance issues. Read On →

Magento 2: How to add new tabs to the product page

The tabs on the product page are handled by the Magento_Catalog’s product/view/details.phtml template file. In there the line $block->getGroupChildNames('detailed_info', 'getChildHtml') collects all blocks in the detailed_info group for the tabs. This means the following layout XML will add a new tab: <referenceBlock name=""> <block class="Magento\Framework\View\Element\Template" template="Magento_Theme::path/to/template.phtml" name="INSERT NAME" group="detailed_info"> <arguments> <argument name="title" translate="true" xsi:type="string">TAB TITLE HERE</argument> </arguments> </block> </block> </referenceBlock> The group="detailed_info" part adds it to the tabbed area. The <argument name="title" part of that sets a string value on the block which will be used for the tab’s title. Read On →

Magento Supee-8788 Supee-1533 Conflict Fixed

TL;DR Run the script at the bottom. The Issue If you’ve previously applied the SUPEE-1533 patch to your Magento site, then when you try to apply the SUPEE-8788 patch you’ll see the following error: checking file app/code/core/Mage/Adminhtml/controllers/DashboardController.php Hunk #1 FAILED at 91. 1 out of 1 hunk FAILED This is caused by the fact that the SUPEE-8788 patch seems to have been taken against an un-patched version of Magento. This can be seen from the following: The SUPEE-8788 patch contains: @@ -91,7 +91,7 @@ class Mage_Adminhtml_DashboardController extends Mage_Adminhtml_Controller_Actio if ($gaData && $gaHash) { $newHash = Mage::helper('adminhtml/dashboard_data')->getChartDataHash($gaData); - if ($newHash == $gaHash) { + if (hash_equals($newHash, $gaHash)) { if ($params = unserialize(base64_decode(urldecode($gaData)))) { $response = $httpClient->setUri(Mage_Adminhtml_Block_Dashboard_Graph::API_URL) ->setParameterGet($params) The important line here is: if ($params = unserialize(base64_decode(urldecode($gaData)))) { Which is supposed to match up with: if ($gaData && $gaHash) { $newHash = Mage::helper('adminhtml/dashboard_data')->getChartDataHash($gaData); if ($newHash == $gaHash) { $params = json_decode(base64_decode(urldecode($gaData)), true); if ($params) { $response = $httpClient->setUri(Mage_Adminhtml_Block_Dashboard_Graph::API_URL) ->setParameterGet($params) The important lines here are: $params = json_decode(base64_decode(urldecode($gaData)), true); if ($params) { Now they don’t match because of the change made in SUPEE-1533: if ($gaData && $gaHash) { $newHash = Mage::helper('adminhtml/dashboard_data')->getChartDataHash($gaData); if ($newHash == $gaHash) { - if ($params = unserialize(base64_decode(urldecode($gaData)))) { + $params = json_decode(base64_decode(urldecode($gaData)), true); + if ($params) { $response = $httpClient->setUri(Mage_Adminhtml_Block_Dashboard_Graph::API_URL) ->setParameterGet($params) The Fix In order to apply SUPEE-8788 we need to temporarily revert the changes made to DashboardController.php by SUPEE-1533. Read On →

Highlighting Empty Hrefs in Links Using Css

While developing a site, you often put a pile of placeholder links in with a plain <a href="">Link</a>. These can sometimes sneak through because they’re so easily forgotten about. A simple CSS block will automatically highlight these for you, so you don’t forget: a[href='']:after { content:'!'; background:red; color:#FFFFFF; padding-left:3px; padding-right:3px; opacity:0.3; white-space: nowrap; } a[href='']:hover:after { content:'empty link'; opacity:1.0; } You can adjust the selector if you use href="#" instead of blank ones.

Find All Email Addresses in a Folder (eg Codebase)

Here is a nice little one liner to search recursively in a directory and then pull out all email addresses that it finds grep -shoPR '[a-zA-Z_]+?' * | sort -u This will quickly find all email addresses and hten give you a sorted unique list Handy!

Magento Smtppro Gmail Issue Solution

If you Magento site has stopped sending emails via SMTP Pro then you will want to have a look in your exception log - var/log/exception.log If you see messages in there along the lines of 2016-10-04T14:27:52+00:00 ERR (3): exception 'Zend_Mail_Protocol_Exception' with message '5.7.14 < 5.7.14 Abc123Abc123Abc123Abc123Abc123Abc123Abc123Abc123Abc123Abc123Abc123Abc123 5.7.14 Abc123Abc123Abc123Abc123Abc123Abc123Abc123Abc123Abc123Abc123Abc123Abc123 5.7.14 Abc123Abc123Abc123Abc123Abc123Abc123Abc123Abc123Abc123Abc123Abc123Abc123 5.7.14 Abc123Abc123Abc123> Please log in via your web browser and 5.7.14 then try again. 5.7.14 Learn more at 5.7.14 103sm1699291ioi.29 - gsmtp ' in /var/www/vhosts/ Then the solution is to log into the gmail web interface, but via your server’s IP address. Read On →