Magento Themes and Magento Extensions

Moving a Magento-shop to a new server

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

The other day I had to move a live Magento-shop to a new server. Since I have (at the moment) a very limited experience with Magento, I started Googling a bit.

I found a post on the Magento Wiki about moving servers, however when following it I stumbled upon some quite annoying errors.

To start from the beginning, the first thing I did was to download the entire shop from the original FTP-server. Afterwards I exported all tables in the Magento SQL-database.

Before I uploaded the physical files to the new server, I had to change the database name, username and password. These informations were easy to change, since they’re stored in the file

Get website-level configuration in Magento

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

I stumbled across this one a couple of times now, and it’s caught me out every time.

With Magento, you have the method Mage::getStoreConfig() to get a store-level config, but nothing obvious to get a website-level configuration (such as a default URL for the website).

So I used this;

Mage::app()->getWebsite($websiteId)->getConfig('web/unsecure/base_url')

It’s the same syntax as what’s used in Mage::getStoreConfig(), but uses getWebsite() instead of getStore(). Hopefully this won’t catch me out anymore!

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” } ) );
}

}
);
});

Page 3 of 6«12345»...Last »