Posts

Showing posts from October, 2012

Update order status programmatically in magento

We can update order status of product in magento by using this below code. setState() function will do this for us, all we need is just pass the required arguments like state to be updated, status of the state, comment for the status change. $order = Mage::getModel('sales/order')->loadByIncrementId($orderId); $state = 'new'; $status = 'label_generated_by_user'; $comment = 'You have generated you shipping label'; $isCustomerNotified = true; $order->setState($state, $status, $comment, $isCustomerNotified); $order->save(); $order->sendOrderUpdateEmail(true, $comment);//Sending email notification to customer. After updating order we can send notification to customer by using sendOrderUpdateEmail() .

Clear form fields after finishing ajax submit using Jquery

Use reset() method to clear form fields after submitting the form via ajax.

Change default search engine FireFox

Image
When we type something in firefox URL bar and hit enter means it will show search result in any of the search engines like google, yahoo, ask etc,. If it’s using ask(for example), you can switch to your preferred search engine.  Here’s how to switch default search engine in firefox. 1. In Firefox type about:config in the address bar and press ENTER. 2. Locate and double-click the entry for keyword.URL 3. Set the value based on which search provider you would like to use for your address bar. Here are a few search strings you can use. Yahoo: http://search.yahoo.com/search?p= Ask: http://www.ask.com/web?q= Bing: http://www.bing.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q= Google: http://www.google.com/search?&q= In this way you can change default search engine in FireFox browser

Styling current page menu link using jQuery

We can easily style the current page url in menubar using jquery. All you have to do is just follow to snippets. [code lang="css"] #menu ul{ list-style-type:none; width:100%; background:#000000} #menu li{padding:5px;display:inline-block} #menu li a{ text-decoration:none; color:#FFFFFF; font-weight:bold} #menu li a:hover{ background:#CCCCCC; color:#000000} #menu li a:active{ background:#CCCCCC; color:#000000} .current-menu{ background:#CCCCCC; padding:6px 5px 5px} .current-menu a{ color:#000000;} [/code] Paste the css it in the header. [code lang="php"] <div id='menu'> <ul> <li><a href="http://localhost/menu/index.php">Home</a></li> <li><a href="http://localhost/menu/products.php">Products</a></li> <li><a href="http://localhost/menu/services.php">Services</a></li> <li><a href="ht

Fix magento admin login failing in chrome browser

Login failure in chrome even though you have given correct username and password? Just follow to code to access admin page in chrome browser.

Disable paste option in textbox

With the help of jQuery event.preventDefault() method we can disable paste in textbox. It can be used in the situation where user enters his confirmation email id in registration form. $('#confirm-email').bind("paste",function(e) { e.preventDefault(); alert('You cannot pase text into this textbox'); }); Some other events: cut,copy,contextmenu(disables right click) $('#confirm-email').bind("cut copy contextmenu paste",function(e) { e.preventDefault(); }); It will prevent all the four actions ie., We cannot perform those 4 actions(cut, copy, contextmenu and paste) in 'confirm-email' field. Reference : How can I disable Ctrl+V (Paste) option using jQuery in one of my input text fields

Magento shopping cart total items quantity

If you want to get cart total items quantity from magento shopping cart, you can use the below snippet. function getCartQty(){ $cartcollection = Mage::getModel('checkout/cart')->getQuote()->getData(); if (isset($cartcollection['items_qty'])) return (int)$cartcollection['items_qty']; else return 0; } With the help of the above function we can get cart total items quantity by putting echo getCartQty();

Remove all products from shopping cart in magento

If you want to remove all products from the shopping cart, use the snippet given below. $cart = Mage::getSingleton('checkout/cart'); foreach( Mage::getSingleton('checkout/session')->getQuote()->getItemsCollection() as $item ){ $cart->removeItem( $item->getId() ); } $cart->save();