Showing posts with label class. Show all posts
Showing posts with label class. Show all posts

Monday, September 19, 2011

How to overwrite / rewrite a store cookie in Magento Mage_Core_Model_App class?

We can not rewrite Mage_Core_Model_App class. The reason is explained here.
Copy your "Mage/Core/Model/App.php" to "app/code/local/Mage/Core/Model/App.php".
Find the function "_checkGetStore($type)"
Replace the below line
if (empty($_GET)) {
    return $this;
}
 */
/**
 * @todo check XML_PATH_STORE_IN_URL
 */
/*if (!isset($_GET['___store'])) {
    return $this;
}

$store = $_GET['___store'];
with
if(!isset($_REQUEST['mystore'])) {
 return $this;
}

$store = $_REQUEST['mystore'];
pass your store code to the url like www.mysite.com?mystore=your_store_code
Thats it you are done.

Thursday, September 8, 2011

How to Add Confirmation email field in magento registration form using class validate-cemail?

The following method allows you to add confirmation email address field in your customer registration or newsletter page.
Create a javascript file called validation.js under "js/email/validation.js"
Validation.addAllThese([

    ['validate-cemail', 'Please make sure your emails match.', function(v) {
                var conf = $('confirmation') ? $('confirmation') : $$('.validate-cemail')[0];
                var pass = false;
  var confirm;
                if ($('email')) {
                    pass = $('email');
                }
  confirm =conf.value;
  if(!confirm && $('email2'))
  {
  confirm = $('email2').value;
  }
                return (pass.value == confirm);
            }],
]); 
Add the new js file into your customer.xml file

    
 
On the register form add a new field to contain the email confirmation field "template/customer/form/register.phtml".

Thats all. You are done.