Monday 26 September 2016

Magento : Enable Address Fields on Customer Registration Forms


In order to enable address fields in Magento customer registration forms you only need to enable the attribute setShowAddressField.

To do so either add the following in your template or in the base local.xml (/app/design/frontend/base/default/layout/local.xml):

<customer_account_create> 
  <reference name="customer_form_register"> 
    <action method="setShowAddressFields">
      <param>true</param>
    </action> 
  </reference>
</customer_account_create>

As always, make sure to reload your cache afterwards. This setting will enable to execution of

<?php if($this->getShowAddressFields()): ?>

in register.phtml (/app/design/frontend/base/default/template/customer/form/register.phtml).

Done! :)

Monday 19 September 2016

Magento : How to remove index.php from URLs

To remove index.php from urls follow the below steps :
1) Log-in Magento Admin
2) Go to System -> Configuration -> Web.
3) from ‘Search Engine Optimisation’ tab “Use Web Server Rewrites” select ‘YES’.
4) Make sure your “Secure” and “Unsecure” base urls should end with “/”.
5) now edit your .htaccess ( will be in magento root folder ) and pate the below code and save:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

now your index.php issue will be solved.

Done! :)

Tuesday 6 September 2016

Magento : An Error Occurred While Saving The URL Rewrite

I found out that issue is because the system could not insert a duplicated record. So something was wrong with “core_url_rewrite” table.

I fixed the issue by logging into phpMyadmin, find that table and truncate all records (do not worry about this because all URL rewrites will be generated again when you reindexed).

After that, I logged in the backend, refresh Magento cache and reindex again. Everything is ok now.