Magento: get root folder path

<?php echo Mage::getBaseDir('base');?>

Magento: Invalid backend model specified: customer/attribute_backend_data_boolean

You will be probably missing the file app/code/core/Mage/Customer/Model/Attribute/Backend/Data/Boolean.php
Add the files and the below content:


<?php
/**
* Magento Enterprise Edition
*
* NOTICE OF LICENSE
*
* This source file is subject to the Magento Enterprise Edition License
* that is bundled with this package in the file LICENSE_EE.txt.
* It is also available through the world-wide-web at this URL:
* http://www.magentocommerce.com/license/enterprise-edition
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
* @package Mage_Customer
* @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
* @license http://www.magentocommerce.com/license/enterprise-edition
*/

/**
* Boolean customer attribute backend model
*
* @category Mage
* @package Mage_Customer
* @author Magento Core Team
*/
class Mage_Customer_Model_Attribute_Backend_Data_Boolean
extends Mage_Eav_Model_Entity_Attribute_Backend_Abstract
{
/**
* Prepare data before attribute save
*
* @param Mage_Customer_Model_Customer $customer
* @return Mage_Customer_Model_Attribute_Backend_Data_Boolean
*/
public function beforeSave($customer)
{
$attributeName = $this->getAttribute()->getName();
$inputValue = $customer->getData($attributeName);
$sanitizedValue = (!empty($inputValue)) ? '1' : '0';
$customer->setData($attributeName, $sanitizedValue);
return $this;
}
}

Magento – Force Display Full Breadcrumb Path

The best practice is to override this function and create a new module. For the time being we can use the easier method :-)

Copy core file to local: app\code\local\Mage\Catalog\Block\Breadcrumbs.php
On protected function _prepareLayout() add below code just before $title = array();

$current_category   = Mage::registry('current_category');
$current_product    = Mage::registry('current_product');
if(!$current_category && $current_product){
    $categories = $current_product->getCategoryCollection()->addAttributeToSelect('name')->setPageSize(1);
    foreach($categories as $category) {
        Mage::unregister('current_category');
        Mage::register('current_category', $category);
    }
}

After this addition of code, you will always get full magento breadcrumb. Full code looks like below:

protected function _prepareLayout()
{
    if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) {
        $breadcrumbsBlock->addCrumb('home', array(
            'label'=>Mage::helper('catalog')->__('Home'),
            'title'=>Mage::helper('catalog')->__('Go to Home Page'),
            'link'=>Mage::getBaseUrl()
            ));

        // Fix for Breadcrumbs start here
        $current_category   = Mage::registry('current_category');
        $current_product    = Mage::registry('current_product');
        if(!$current_category && $current_product){
            $categories = $current_product->getCategoryCollection()->addAttributeToSelect('name')->setPageSize(1);
            foreach($categories as $category) {
                Mage::unregister('current_category');
                Mage::register('current_category', $category);
            }
        }
        // Fix for Breadcrumbs ends here

        $title = array();
        $path  = Mage::helper('catalog')->getBreadcrumbPath();

        foreach ($path as $name => $breadcrumb) {
            $breadcrumbsBlock->addCrumb($name, $breadcrumb);
            $title[] = $breadcrumb['label'];
        }

        if ($headBlock = $this->getLayout()->getBlock('head')) {
            $headBlock->setTitle(join($this->getTitleSeparator(), array_reverse($title)));
        }
    }
    return parent::_prepareLayout();
}

Call to undefined function wp_dashboard_setup()

Open up the file wp-admin/index.php

Change the line below line

require_once(ABSPATH . 'wp-admin/includes/dashboard.php');

to

require_once('includes/dashboard.php');

REF: WordPress › Support » Fatal error: Call to undefined function wp_dashboard_setup()

Pinterest “Pin it” button breaking ‘back’ in Internet Explorer

Change how you insert the pinit.js file. Use the code below and check

<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js" data-pin-do-not-log=true></script>

libcrypto.so.6()(64bit) is needed


# yum whatprovides libcrypto.so.6
Loaded plugins: rhnplugin
openssl098e-0.9.8e-17.el6.i686 : A compatibility version of a general cryptography and TLS library
Repo : rhel-x86_64-server-6
Matched from:
Other : libcrypto.so.6
# yum install openssl098e

PHP: Remove a single parameter from a Query String using regular expression


function remove_querystring_var($url, $key)
{
$url = preg_replace('/(.*)(\?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&');
$url = substr($url, 0, -1);
return $url;
}

Magento: remove the focus on varienform

Set second attribute to false in js function call:

var signupForm = new VarienForm('signupForm', false);

Magento: exception ‘Zend_Cache_Exception’ with message ‘can’t get apc memory size’

For me this occurs when I tried to index when APC is enabled on my site. the fix for this is:

  1. Open the APC configuration file /etc/php.d/apc/ini
  2. Enable the variable apc.enable_cli by setting this to 1. apc.enable_cli=1

Courtesy: Magento: Error using APC

APC: undefined symbol: pcre_exec in Unknown on line 0

Problem: /usr/lib64/php/modules/apc.so: undefined symbol: pcre_exec in Unknown on line 0

Fix for this relatively simple:

1. Copy the /etc/php.d/apc.ini to /tmp
cp /etc/php.d/apc.ini /tmp

2. Remove the installed packeage
yum remove php-pecl-apc

3. Install the apc using pecl itself
pecl install apc

4. Move back file apc.ini
mv /tmp/apc.ini /etc/php.d/apc.ini

Follow

Get every new post delivered to your Inbox.

Join 266 other followers

%d bloggers like this: