Thursday, 29 September 2016

Difference between “Flush Magento Cache” and “Flush Cache Storage”

Flush Magento Cache

It removes the cache entries which are known by Magento itself.

Flush Cache Storage

It clears everything, including entries made by other supporting or external Caches systems. Normally the location is "var/cache/".

How to write Magento session messages.

Many time we require to send the messages within your. We can do it through core session.
Below is useful core session message we can send.

1) Send notice message.
Mage::getSingleton('core/session')->addNotice("Need attension");

2) Send success message.

Mage::getSingleton('core/session')->addSuccess("Its done!");

3) Send error message.

Mage::getSingleton('core/session')->addError("Error is there!");

Wednesday, 28 September 2016

How to redirect to controller with parameters in Magento.



How to redirect to controller with Parameters?

Many time we require to redirect to controller with some parameters and need to GET parameters at business module.

Below is the example to do it:

$this->_redirect('yourmodule/controller/action', array('First Parameter'=>'1','Second Parameter'=>'2'));

This will helpful, when you need more than one buttons on same page and want to implement the different logic on different clicks.

Monday, 12 September 2016

Rearrange form fields in the Magento admin panel?

Rearrange form fields in the Magento admin panel?

Some time it require to Rearrange form custom fields in the Magento. This can be achieve while running the custom script as below. Considering we are doing this for customer address field.


$this->addAttribute('customer_address', 'your_custom_field', array(
'type' => 'varchar',
'input' => 'text',
'label' => 'your_custom_field',
'global' => 1,
'visible' => 1,
'required' => 0,
'user_defined' => 0,
'visible_on_front' => 1,
'position' => 60 ));

Note: Recommended, Please keep database back-up while running the scripts.

Please leave your comments, if you find this post is useful.

Thursday, 1 September 2016

Adding Translations in Magento JavaScript.


Some time you require to add translation through Javascript and you don't have any option to add it via your template.  Below is the code for do it.

<script type="text/javascript">
Translator.add('Your translation.','<?php echo Mage::helper('yourmodule')->__('Your translation.')?>');
</script>

Please leave your comments, if you find this post is useful.

Adding Translations in Magento JavaScript.


Some time you require to add translation through Javascript and you don't have any option to add it via your template.  Below is the code for do it.

<script type="text/javascript">
Translator.add('Your translation.','<?php echo Mage::helper('yourmodule')->__('Your translation.')?>');
</script>

Please leave your comments, if you find this post is useful.