Saturday, June 8, 2013

Magento : How to check if the store is running on secure url

Hi... guys today i am sharing with you a little useful code for checking is the current store is running on secure url or not .

You can check this by just this simple line of code :
[php]$isSecure = Mage::app()->getStore()->isCurrentlySecure();[/php]

And you can get the secure url using the following code :
[php]Mage::getStoreConfig(Mage_Core_Model_Store::XML_PATH_SECURE_BASE_URL)[/php]

Wednesday, June 5, 2013

Magento : Solution of the 'Cache_dir' must be directory

Today i am sharing with you the solution for most common issue with magento store which is the Exception : cache_dir must be a directory.

To solve this problem follow these steps :

1) Open the php file at the path lib/Zend/Cache/Backend/File.php

2) Go to around line : 91
[php]
protected $_options = array(
'cache_dir' => 'temp/',
'file_locking' => true,
'read_control' => true,
'read_control_type' => 'crc32',
'hashed_directory_level' => 0,
'hashed_directory_umask' => 0700,
'file_name_prefix' => 'zend_cache',
'cache_file_umask' => 0600,
'metadatas_array_max_size' => 100
);
[/php]

3) Replace the above code with this one :

[php]
protected $_options = array(
'cache_dir' => 'path/from/root/var/cache/',
'file_locking' => true,
'read_control' => true,
'read_control_type' => 'crc32',
'hashed_directory_level' => 0,
'hashed_directory_umask' => 0700,
'file_name_prefix' => 'zend_cache',
'cache_file_umask' => 0600,
'metadatas_array_max_size' => 100
);
[/php]

This would definately solve your problem, Hope this will help some one
Happy coding :-)