Category Archives: PHP

How To Solve Magento 2 Blank Or Empty Page

When I open my home page, its return a blank content and even open any page from my Magento store. its returning nothing. How can I know what issue caused by

Usually you can see error info from your log files

e.g

var/log

or you can add following line to the top of your index.php file

ini_set('display_errors', 1);

Then refresh the page and you will see more info

Can’t Create Directory To var/generation Error From Magento 2

When I open the home page, I have got blank page, when I have set ini_set(‘display_errors’, 1) I have saw the following error Can’t create directory var/generation/Magento/Framework/App/ResourceConnection

Usually its caused by the permission issue of “pub” folder , try give full control to your “pub” folder.

sudo chmod -R 777 var pub

Also try clearing your cache folder

sudo rm -rf var/cache/* var/generation/*

How to Fix WordPress Missing required field entry-title,Update,hCard Error

Recently I saw lots of structured error from my webmaster, when I tested my WordPress pages via Google Structured Data testing tools, I got the Following errors:
Error: Missing required field “entry-title”.
Error: Missing required field “updated”.
Error: Missing required hCard “author”. How to solve those issues

Just add / update the following codes then all issues will be gone.

<h1 class="title single-title entry-title"><?php the_title(); ?></h1>
<span class="post_date date updated"><?php the_time('j F,Y'); ?></span>
<span class="vcard author">
<span class="fn"><?php the_author(); ?></span>
</span>

How Can I Disable Magento Compare Products Functionality

How can I disable or remove the Magento products comparison feature

To disable or remove the Magento products comparison feature, you may need to modify file

app/code/core/Mage/Catalog/Helper/Product/Compare.php

and change the following code:

public function getAddUrl($product){return $this->_getUrl(’catalog/product_compare/add’, $this->_getUrlParams($product));}

To

public function getAddUrl($product){//return $this->_getUrl(’catalog/product_compare/add’, $this->_getUrlParams($product)); return false;}

Edit ./app/design/frontend/base/default/layout/catalog.xml (if you are using a different Magento theme, enter its name instead of default) and change the following code:

<block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>

To

<!-- <block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/> -->

Once its done, Need to flush the Magento cache from Magento backend area > System > Cache Management.

How To Add Custom Column On Custom Taxonomy List Table

I would like to insert a custom column for my WordPress custom taxonomy list page

Here is example to show how to insert a custom column for WordPress custom taxonomy list page.

function add_custom_tax_columns($columns){
    $columns['customtax'] = 'Custom Tax';
    return $columns;
}
add_filter('manage_edit-custom-tax_columns', 'add_custom_tax_columns');

function add_custom_tax_column_content($content,$column_name,$term_id){

    switch ($column_name) {
        case 'customtax':
            $content = 'test';
            break;
        default:
            break;
    }
    return $content;
}
add_filter('manage_custom-tax_custom_column', 'add_custom_tax_column_content',10,3);