Magento Themes and Magento Extensions

Debug your layout in Magento

Share
Posted on November 18th, 2012 | Posted by admin

Debug your layout in Magento

Your layout files and templates are not showing up on front? You can see what’s going on with your layouts using Mage::log() method in your controller. The code below would log loaded layout handles and compiled layout update string into var/log/layout.log file.

Here is how to enable the debug mode in your index.php file.

Magento : add massDelete action in coupon code

Share
Posted on November 17th, 2012 | Posted by admin

Magento : add massDelete action in coupon code

First override Mage_Adminhtml_Block_Promo_Quote_Grid class and add following code
protected function _prepareMassaction()
{
$this->setMassactionIdField(‘rule_id’);
$this->getMassactionBlock()->setFormFieldName(‘rule’);

$this->getMassactionBlock()->addItem(‘delete’, array(
‘label’    => Mage::helper(‘rule’)->__(‘Delete’),
‘url’      => $this->getUrl(‘*/*/massDelete’),
‘confirm’  => Mage::helper(‘rule’)->__(‘Are you sure?’)
));
return $this;
}

show plain text in a password field and then make it a regular password field on focus

Share
Posted on November 17th, 2012 | Posted by admin

Use html as
<input type=”text” value=”password” id=”password”>

And use script
jQuery( document ).ready( function(){

jQuery( document ).delegate( ”#password”, ”focusin focusout”,
function(e){
var elm = jQuery( ”#password” )[0];
if( e.type == ”focusin” && elm.type == ”text” ) {
jQuery( elm ).replaceWith( jQuery( ”<input>”, {id: ”password”, type:”password”,value:”" } ) );
jQuery( ”#password”)[0].focus();
}
else if( e.type ==”focusout” && elm.type == ”password” && !elm.value ) {
jQuery( elm ).replaceWith( jQuery( ”<input>”, {id: ”password”, type:”text”,value:”password” } ) );
}

}
);
});

Magento – How to run Query from magento root file?

Share
Posted on November 16th, 2012 | Posted by admin

In magento some time you need to truncate some tables or you need to find some details using sql query
If you don’t have the database access credentials only ftp access then create the .php file and write some query into that which you want to execute one sample is as below

here I am truncating the table called ‘catalog_product_flat_1′


<?php
/***********************
* Scan Magento local.xml file for connection information
***********************/

if (file_exists('./app/etc/local.xml')) {

$xml = simplexml_load_file('./app/etc/local.xml');

Magento – Get loaded class into magento

Share
Posted on November 14th, 2012 | Posted by admin

Magento – Get loaded class into magento
if you are working with  .phtml  files and you want to know which class is getting loaded for this

then you can use the below codes in your .phtml file

<?php
print_r(get_class_methods(get_class($this)));
?>
or

<?php
print_r($this->debug());
?>

or

<?php
echo Zend_Debug::dump($this);
?>