Tuesday 17 May 2011

Magento :How to enable mod_rewrite

Log into the admin 
and navigate to system->cache management.  Click the “refresh” button next to “catalog rewrites”.  



Magento Developers Tips: To regenerate urls in magento

Magento Developers Tips: To regenerate urls in magento

Tuesday 10 May 2011

Show Date of Birth in Registration form in Magento

By default there is any option to Show Date of Birth in Registration form

Go to:

System --> Configuration --> Customer Configuration (Left Tab) --> Select Name‌ and‌ Address‌ Options --> Enable Show Date of Birth field.

Thursday 5 May 2011

To regenerate urls in magento

Sometimes when you make changes to your products, or enable a certain extension, Magento might start to rewrite all your URLs to include a suffix "-1" or some other number. Within the URL Rewrites, Magento differentiates between System URLs and Custom URLs. If the System URLs are broken like this, you should not fix this by adding new Custom URLs.

Instead, open up phpMyAdmin, create a backup of your Magento database,
and flush the Magento table core_url_rewrite (so that it becomes totally empty).

Immediately afterwards,

Refresh the Catalog Url Rewrites under Index Management.
This will regenerate all System URLs

To delete any specific order in magento

SQL query:

set @increment_id='200000111';
select @order_id:=entity_id from prefix_sales_order_entity where increment_id=@increment_id;
delete from prefix_sales_order_entity where entity_id=@order_id or parent_id=@order_id;
delete from prefix_sales_order where increment_id=@increment_id

Disable Messages Notification popup

While logging into your Magento Admin Panel, you get a rigid Messages Notification popup, 

Just goto:
 
System > Configuration > Advanced > Advanced > and   disable Mage_Admin Notification

Tuesday 26 April 2011

How to troubleshoot problems while installing Magento1.5 in localhost



Invalid Base url ( Please enter a valid URL. Protocol is required (http://, https:// or ftp://):



To accept your localhost as url by modifying the validation.js file which is present in the magento installation directory at js\prototype\validation.js

Go to line No:500 

['validate-url', 'Please enter a valid URL. Protocol is required (http://, https:// or ftp://)', function (v) {

return Validation.get('IsEmpty').test(v) || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v)
}],

I remove all the regular expressions present and simply return true.

Replace this below code:

['validate-url', 'Please enter a valid URL. http:// is required', function (v) {
return true;
}],

How to duplicating money order payment method module in Magneto1.5



 Duplicate it as follows (checkmo to checkmonew):


Step 1 : mage/payment/block/forms + info : duplicate checkmo.php to checkmonew.php (rename inside checkmo to checkmonew)


Step 2 : mage/payment/etc/config.xml + system.xml : duplicate the checkmo parts (and rename it to checkmonew)


Step 3 : mage/payment/model/method : duplicate checkmo.php to checkmonew.php (rename inside checkmo to checkmonew)


Step 4 : design/adminhtml/default/default/template/payment/form + info : duplicate checkmo.php to checkmonew.php (rename inside checkmo to checkmonew)


Step 5 : design/frontend/base/default/template/payment/form + info : duplicate checkmo.php to checkmonew.php (rename inside checkmo to checkmonew)

Please follow this above step surely you can find in my cart page and my order page(invoice)


How to Limit the Number of Crosssell Items in Cart (Magneto)


Hi friends,

The limit is hardcoded in app/code/core/Mage/Checkout/Block/Cart/Crossell.php



class Mage_Checkout_Block_Cart_Crosssell extends Mage_Catalog_Block_Product_Abstract
{
    
protected $_maxItemCount 4;

    public function 
getItems()
    
{
...

How to connect database and fetch values to print in phtml page

To connect database and fetch values from tables in magento.

<?php
 $write = Mage::getSingleton('core/resource')->getConnection('core_write');
 $readresult= $write->query("SELECT fieldname FROM tablename" );
 while ($row = $readresult->fetch() )
 {
 $temp[] = $row['feildname'];
 }
?>

<?php
print_r($temp);
?>