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

Shell: Get Number of Processors

The below shell command will give you the number od processors added to the server.

sort -u /proc/cpuinfo | grep -c processor

Magento: Mass update all categories with isAnchor enabled

To update all the categories on the Magento run the below Query

update catalog_category_entity_int set value=1 where attribute_id=51;

Then Refresh your cache.

Follow

Get every new post delivered to your Inbox.

Join 133 other followers

%d bloggers like this: