Search This Blog

Friday 18 November 2011

Creating New Theme in Magento

Wednesday 16 November 2011

Emails not sending in Magento 1.3.1

 As a temporary measure a fix can be issued in the form of editing core code.

1) Enter the root directory of your Magento store and enter
# mkdir app/code/local/Mage
# mkdir app/code/local/Mage/Core
# mkdir app/code/local/Mage/Core/Model
# mkdir app/code/local/Mage/Core/Model/Email
# cp app/code/core/Mage/Core/Model/Email/Template.php  app/code/local/Mage/Core/Model/Email/
2) Using your favourite editor open up Template.php and make changes at these lines
ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
        ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
        $mail = $this->getMail();
        if (is_array($email)) {
            foreach ($email as $emailOne) {
+               # Fix for mini_sendmail
+                # $mail->addTo($emailOne, $name);
+                $mail->addTo($emailOne);
-                $mail->addTo($emailOne, $name);
            }
        } else {
+           # Fix for mini_sendmail
+           # $mail->addTo($email, '=?utf-8?B?'.base64_encode($name).'?=');
+           $mail->addTo($email);
-           $mail->addTo($email, '=?utf-8?B?'.base64_encode($name).'?=');
        }
        $this->setUseAbsoluteLinks(true);
        $text = $this->getProcessedTemplate($variables, true);
$mail->setSubject('=?utf-8?B?'.base64_encode($this->getProcessedTemplateSubject($variables)).'?=');
+       # Fix for mini_sendmail
+       # $mail->setFrom($this->getSenderEmail(), $this->getSenderName());
+       mail->setFrom($this->getSenderEmail());
-       $mail->setFrom($this->getSenderEmail(), $this->getSenderName());
3) Recompile (if using extension) to update includes
It is not a perfect solution, but should provide a fix until we find an alternative to mini_sendmail.

For more information click here

If the issue is not in 1.3.1 version then the solution can be found here 

Friday 11 November 2011

Preventing Enter Button event from Form Submission

    if (document.layers)
        document.captureEvents(Event.KEYDOWN);
    document.onkeydown = function (evt) {
    var keyCode = evt ? (evt.which ? evt.which : evt.keyCode) : event.keyCode;
    if (keyCode == 13) {
        return false;
        //Your function here.
    }
    else
        return true;
    };

 OR

function preventEnter(evt) {
    var keyCode = evt ? (evt.which ? evt.which : evt.keyCode) : event.keyCode;
    if (keyCode == 13)
        return false;
    else
        return true;
};

Usage:  onkeydown="return preventEnter(event);"

Wednesday 9 November 2011

How to add "date" type custom option for products and make it work?

 Many Magento users, like my company, have similar requirements to let customers choose date through pop-up calendar in the product view page. But Magento merely offer 2 groups of input type, “Text” and “Select”, in Catelog→Manage Products→Custom Options page by default. Is there any possibility for us to add the support for “Date” or “Date Time” input types?

http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/catalog/how_to_add

IE 9 Issues with Magento

The quick fix is to fool IE9 to “think” it’s acting as IE8 by adding a custom meta tag to the page header like so:
<meta http-equiv="X-UA-Compatible" content="IE=8" />
.htaccess approach
Add this to the end of your .htaccess file:

BrowserMatch MSIE best-standards-support
Header set X-UA-Compatible IE=8 env=best-standards-support

Latest update is the Prototype JS file is updated in latest version of Magento hope all the issues with IE9 will be fixed.