Tuesday 15 November 2016

Magento : Add Order Status to Last 5 Orders on Magento Admin Dashboard

It’s happened to us all folks, you log onto the admin dashboard you see an new order in the last 5 orders list and automatically think to yourself, “Nice, I have a new order!”. Well hold on a minute, this is not always the case, the order could have be abandoned or pending payment. This has happened to me a few too many times this week so I decided, I NEED to have the order status along with the Customer Name, Items & Grand Total.

If you follow the instructions below, I will show you how to add Status to the Last 5 Orders grid.


Modified Grid

First of all, and this is a must when modifying any core files, create a local copy of the following file:

Copy app/code/core/Mage/Adminhtml/Block/Dashboard/Orders/Grid.php

To app/code/local/Mage/Adminhtml/Block/Dashboard/Orders/Grid.php

Open your local copy of Grid.php and around line 114 add the following:

$this->addColumn('status', array(
'header' => Mage::helper('sales')->__('Status'),
'index' => 'status',
'type'  => 'options',
'width' => '70px',
'sortable'  => false,
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
));


Save and upload the local copy and you should now have a column called Status in your Last 5 Orders.

Done! :)


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.

Wednesday 31 August 2016

Magento : How to fix Email sending problem

Just do a small change in order.php /app/code/core/Mage/Sales/Model/Order.php

If you don't want to change core file so please create directory  /app/code/local/Mage/Sales/Model/ like this and put Order.php inside folder

Find code and replace it

$mailer->setQueue($emailQueue)->send();

To

$mailer->send();

Done! :)

Magento : How to fix Email sending problem in Magento ver. 1.9.2.0


In latest Magento versions, all emails are being sent via CRON job. Every email will be queued and sending will depend on the set interval, in general 5 minutes.


By default, Magento has already set CRON jobs at
System -> Configuration -> Advanced -> System -> Advanced -> Cron


If CRON job is not working properly, please follow below steps to send instant emails.


Copy Template.php file from
app -> code -> core -> Mage -> Core -> Model -> Email


Create folder structure like
app -> code -> local ->  Mage -> Core -> Model -> Email


Paste Template.php file in Email folder


Open Template.php file and go to line number 407 or search for the following code
if ($this->hasQueue() && $this->getQueue() instanceof Mage_Core_Model_Email_Queue) {


Replace above code with following
if (!($this->hasQueue()) && $this->getQueue() instanceof Mage_Core_Model_Email_Queue) {


This trick works perfectly on Magento ver. 1.9.2.0

Tuesday 30 August 2016

Magento : How to remove decimal in price


First create currency class in path /app/code/local/Mage/Directory/Model/Currency.php

copy the content from file in core /app/code/core/Mage/Directory/Model/Currency.php and paste in your new file /app/code/local/Mage/Directory/Model/Currency.php

Go to line no. 222 and find code your file

return $this->formatPrecision($price, 2, $options, $includeContainer, $addBrackets);

and replaced it by this line :

return $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets);

Clear your caches and it’s done. :)