Posts

Zend PHP 7 Certification – Data Formats and Types – XML Basics

This post covers the XML Basics section of the Data Formats and Types chapter when studying for the Zend PHP 7 Certification.
XML stands for Extensible Markup Language, and it is used to store or transport data.
An example of how an XML document might look can be seen below.
<?xml version="1.0"?>
<productListing title="Product Listing">

Redirect Magento URLs to HTTPS and www using htaccess

Google promotes websites that have an SSL certificate installed by placing them higher in the search results. This requires configuration changes within Magento.
Configuration within the Magento admin
Assuming you have a valid SSL, you can enable secure links in the frontend and admin by changing the Use Secure URLs on Storefront and Use ...

Definer Clauses in Magento Database Exports

In Magento Commerce Edition version 1.13 and above and in Magento 2, there exists definer clauses in Magento database exports when you export the database from the server it resides on.
These definer clauses are used in MySQL triggers and contain the username and host of the server the exist on. They do not pose ...

Call to a member function setSaveParametersInSession() on boolean

Error
You may encounter a Call to a member function setSaveParametersInSession() on boolean error in Magento when adding an adminhtml grid within a custom module.
Solution
This error occurs within the _prepareLayout() method of the Mage_Adminhtml_Block_Widget_Grid_Container class.
protected function _prepareLayout()
{
$this->setChild( 'grid',
...

Cannot retrieve entity config: modulename/tablename

Error
You may encounter a Cannot retrieve entity config: modulename/tablename error in Magento when adding a setup script.
Solution
There are two main causes of this error. The first is to ensure that when you define your lt;resourceModel> within your module’s config.xml file, for example:
<models>
<modulename>
...

Add a Form in Magento 2 (Step-by-Step Guide)

This post will provide a simple, easy to follow step-by-step guide on how to add a form in Magento 2, using the UI component functionality. This will also follow on from the Step by Step Guide to Adding a Grid.
Presumptions

The Magento application is in developer mode.
If you pause to view changes, ...

Add a Conditions Tab to a Magento Form

The Magento Shopping Cart Price Rules section in the admin contains a tab where you can configure conditions for a rule to apply. You can add a conditions tab to a Magento form as part of custom functionality by following the below steps.
If you’ve followed the posts involving creating an admin grid and form ...

Debugging Magento Controller 404 Errors

This article will describe the steps to take when debugging Magento controller 404 errors, specifically those that occur when attempting to override an existing Magento controller within a custom module.
If you are looking to override a frontend controller, let’s say AccountController.php of the Mage_Customer module, the configuration within your custom module’s config.xml might look ...

Different Ways of Using JavaScript in Magento 2

This post will demonstrate the different ways of using JavaScript in Magento 2, specifically adding them through various methods that Magento provides. There is also the ability to extend of override existing JavaScript. Here will show you how.
To include local and external JavaScript in layout XML similar to Magento 1, you can edit your ...

Common Parent Classes to Extend in Magento 2

Below shows a list of common parent classes to extend in Magento 2 when creating your own functionality that extends the Magento core application.
Blocks
If you need to add a frontend block class, the class should extend Magento\Framework\View\Element\Template.
<?php
namespace [Vendor]\[Module]\Block;

class YourBlock extends \Magento\Framework\View\Element\Template
{
}
Adminhtml blocks can extend from Magento\Backend\Block\Template, ...