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.

Thursday 8 September 2011

Using Collections in Magento

A collection is a Model type containing other Models, it is basically used in Magento to handle product lists (ie. from a category or a bundle option), but not only.
TO DO: Explain how Magento Implements a collection - Use this to explain how Magento implements a collection by looking at code in a model, so that people can learn to write their own collections
This is a simple example of loading some product collection from a category and ordering them on their product name using Magento’s API.

http://www.magentocommerce.com/wiki/5_-_modules_and_development/catalog/using_collections_in_magento

Wednesday 31 August 2011

addAttributeToFilter Conditionals In Magento

addAttributeToFilter is a function that can be called on a product collection in Magento. In short, it adds a condition to the WHERE part of the MySQL query used to extract a product collection from the database.

http://fishpig.co.uk/magento-tutorials/addattributetofilter-conditionals-in-magento

Monday 8 August 2011

Creating a Store Locator with PHP, MySQL & Google Maps

This is intended for developers who are familiar with PHP/MySQL, and want to learn how to use Google Maps with a MySQL database to create a store locator-type app. After completing this tutorial, you will have a database of locations and a webpage that lets a user enter their address and see markers on a map for the locations nearest to them, within a chosen distance restriction. more



Monday 1 August 2011

Method Varien_Object::__tostring() cannot take arguments

When I try open the magento fodler to install it, I get the following error:

Fatal error: Method Varien_Object::__tostring() cannot take arguments in C:\xampp\htdocs\magento\lib\Varien\Object.php on line 488


File: /lib/Varien/Object.php (Line 484)

Change from

public function ___toString(array $arrAttributes = array(), $valueSeparator=',')

To this

public function __invoke(array $arrAttributes = array(), $valueSeparator=',')

File /app/code/core/Mage/Core/Controller/Request/Http.php (Line 274)

Change from

$host = split(':', $_SERVER['HTTP_HOST']);

To this

$host = explode(':', $_SERVER['HTTP_HOST']);

Thursday 7 July 2011

Quantity Box in the Category Products Listing Page

Your Magento product ordering might seem a long process to some business owners, so we thought of making it simple, so that users can directly enter the quantity in the products listing area and click on ADD TO CART and checkout.

So, here is how you can do that.

Goto /app/design/frontend/default/your-theme/template/catalog/product/list.phtml

Open the file on a code editor and find this line,

<button type="button" title="<?php echo $this->__('Add to Cart') ?>" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>

Just replace it with,

<form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form_<?php echo $_product->getId()?>"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
 <?php if(!$_product->isGrouped()): ?>
 <label for="qty"><?php echo $this->__('Qty') ?>:</label>
 <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo ($this->getMinimalQty($_product)?$this->getMinimalQty($_product):1) ?>" />
 <?php endif; ?>
 <button type="button" onclick="this.form.submit()"><span><span><span><?php echo $this->__('Add to Cart') ?></span></span></span></button>
 </form>

You are done! If you want to style the quantity box, you can add class css to it.

Wednesday 29 June 2011

Guest chat feature in Google Talk

Yesterday I found a new feature introduced by Google to enable Guests on your website or blog to chat with you.

New! Chatback

Let visitors to your site chat with you



I think its really cool. The guests won't know your Googletalk or your Gmail ID but they can still ping you if you are online.

You can also customize the title and toggle the display of online status message. When they ping you you will get a guest chat window in Gtalk. If you are using Pidgin, you will get a link for a chat window.

Wednesday 25 May 2011

Redirecting www to non-www Using .htaccess

The Apache Web server supports URL rewriting with the mod_rewrite engine. Placing custom rules in an .htaccess file lets you do all sorts of useful things to keep your URLs tidy. One really handy thing you can do for search engines and visitors is redirecting traffic from www to non-www version of your domain (and vice versa).


Some people prefer to use www.somesite.com, but some people prefer the shorter somesite.com. There isn't really a right or wrong way to do it, but whatever you choose you can make sure all of your visitors get sent to the same place. With a few simple rules on the server you can choose from non-www to www, or redirecting from www to non-www.

If you already have a file named .htaccess on your Website you can add to it. If not, create one (yes, include the period at the beginning). Add either of the following rules and save. Replace yourdomain.com with your actual domain name.

Redirect www to non-www:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]
 
Redirect non-www to www:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]
 
Both of these rules send a full search engine friendly 301 HTTP  redirect. They also preserve the entire URL (so yoursite.com/about  redirects to www.yoursite.com/about).

Search engines can usually figure out which format is preferred, but since you're showing the same page for www and non-www URLs it can't hurt to be consistent about it.

Create your .htaccess rewrite code:
Use our www Redirect Generator tool to automatically generate the required redirect code.

Wednesday 18 May 2011

Jquery image zooming plug-in really this is an extraordinary and compatible with all browsers.

JQZoom is a javascript image magnifier built at the top of the popular jQuery javascript framework. jQzoom is a great and a really easy to use script to magnify what you want.
Works on all modern browsers:

http://www.mind-projects.it/projects/jqzoom/demos.php



Tuesday 10 May 2011

Send test emails with WampServer

I have been tried set up email sending option from WampServer for windows finally found following And seems to be very useful. However i modified this according to my needs.

What you will need:

Go ahead and install WampServer. I just installed mine to the root of the c: drive so it makes for easy access (For example, “c:\wamp”).
Next download Fake Sendmail. Fake Sendmail, aka sendmail.exe, is a simple windows console application that emulates sendmail’s “-t” option to deliver emails. Extract the sendmail.zip file and move the folder here: “c:\wamp\sendmail”.
We need the Gmail email account because sendmail.exe requires an smtp server to perform the actual delivery of the messages. Now let’s configure some settings in the sendmail.ini file located here: “c:\wamp\sendmail”.
  • line 14 | smtp_server=smtpout.secureserver.net
  • line 18 | smtp_port=80
  • line 38 | auth_username=youremail@goeshere.com
  • line 39 | auth_password=yourpasswordgoeshere

For Gmail Account:
  • line 14 | smtp_server=smtp.gmail.com
  • line 18 | smtp_port=465
  • line 38 | auth_username=youremail@gmail.com
  • line 39 | auth_password=yourpasswordgoeshere
There are a few lines that need to be commented out/uncommented accordingly. Then save and close the sendmail.ini file.
Only one step left and that’s to make a change in the php.ini. Access the php.ini using this method below.


Search for sendmail_path and set it to “c:\wamp\sendmail\sendmail.exe –t”.

Save and close the php.ini file.
You must restart WampServer for the changes to the php.ini to take effect.
Having the ability to send test emails is great especially if you frequently work on scripts that require email generation. At least I think so (I’m smiling).


Tuesday 3 May 2011

3 Major Magento Milestones – All Great Things Come in Three

Magento is 3 Years Old Today

March 30, 2011 marks a major milestone for Magento – the three year anniversary of launching Magento 1.0. We are both thrilled and humbled by the enormous positive response we’ve received to Magento over the last three years. Our success comes directly from you, our customers, partners, community and the entire Magento ecosystem.

Community Edition Downloaded 3 Million Times

Developers from 100+ countries around the globe have collectively downloaded Magento Community Edition 3 million times. More than 5,000 people download Magento every single day!

3,800 Magento Extensions on Magento Connect

The Magento Community has leveraged the openness, flexibility and extensibility of Magento to create more than 3,800 custom extensions. 50 new extensions are added every week. Magento Extensions connect Magento to ERP systems and payment gateways and convert Magento into digital malls and group purchasing platforms.

Wednesday 20 April 2011

10 Things We Love About Magento

With over half a million downloads in less than a year since its official release, the new Magento ecommerce platform is certainly taking the open source world by storm. I thought now might be a good time to go into the features we love most about Magento…so here they are – 10 things we love about Magento!

Multi-Site Functionality

 

A surprising number of our clients have more than one website. Often they are similar products targeted at different groups of customers, or related niche products that would sell better from a more specialised online store. The ability to run multiple sites from the same back-end, and to be able to manage orders and customers from the same place really makes life easier. Magento also allows you to generate reports based on individual sites, or the business as a whole, which I’m sure you’ll agree is very useful indeed!

Layered Navigation

 

Now that we have a few Magento projects under our belt I am starting to wonder what on earth we did before we had this very cool feature. It really streamlines navigation and improves the user experience. The ability to drill down through a product range using a series of useful attributes really makes browsing a site, especially one with a large product range, far more intuitive. Once you have a feature like this on your ecommerce website, you too will find yourself wondering how you ever lived without it!

Re-Ordering Based on a Previous Order

 

It may not be a huge feature, but I always feel it’s the little things that make life better. Call me sad, but being able to login to your account, find a previous order, and re-order it at the click of a button really gets me going! A huge part of ecommerce – and one that is often overlooked – is making life easier for repeat customers to keep them coming back time and time again. And this is one area where Magento flourishes!

One Page Checkout

 

I am always sceptical when I see “one page checkout” in the feature list of an ecommerce platform. Usually it means they’ve simply taken their 5 page checkout, and built it into one page with some fancy AJAX effects. Well you know, it’s still a 5-stage checkout process even if it is all in one page. I had a similar attitude to Magento, until I played with it some more. When ordering as a repeat customer I noticed vast improvements in the flow of the checkout process. I also love how each stage is added to the side bar as you progress, so you always have a clear summary of the information you have already entered.

Order Management

 

When it comes to ecommerce platforms, order management tends to be what separates the men from the boys. You can have the coolest front-end features but if the back-end can’t stand up to the day-to-day operations of a busy ecommerce website, administrative tasks can become something of a headache. Magento’s order management capabilities are by no means perfect, but it is certainly on the right tracks. All orders can be edited, part-shipped, credit memo’s can be applied, items can be backordered, notes can be added to orders; and so on and so forth. Also, batch management of orders is a real time-saver. You can print invoices, packing slips and credit memos (or all of the above), cancel and hold orders in bulk with the click of a button. Oh, and did we mention the great support for telephone orders, which can be easily added to the Magento system. But by far my favourite feature in terms of order management has got to be the new orders RSS feed. No more clogging up your mailbox with all those “new order” emails. Just subscribe via RSS. Genius!

Google Integration

 

Google has become a way of life for most of us. And for ecommerce website owners, Google Adwords and Analytics are essential tools for effective marketing and monitoring of their sites performance. Magento integrates seamlessly with Analytics and Adwords (for conversion tracking), and also has the facility to generate Google Sitemaps to help search engines index your website more effectively. There’s also complete integration with Google Checkout, because we all know Pay Pal sucks (it supports that too, if your so inclined!).

Reports Gallore

 

Magento’s reporting is thorough to say the least. Sales reports include breakdowns of shipping, tax, refunds and coupons. There’s also shopping cart statistics (abandoned carts, etc), product stats, customer stats, and reports detailing product reviews and search terms. All reports can be customised by date, and as previously mentioned can be refined to include only one Magento website or all of them (assuming you are running multiple sites). You can also export your reports to a CSV file, for use in Microsoft Excel.

Live Currency Update

 

Most of the lower-end ecommerce platforms that feature multiple currencies require you to manually update the exchange rate. Especially in today’s economic climate, with exchange rates varying daily, this is quite an annoying thing to have to do. Not with Magento. It links directly into WebServiceX and updates exchange rates automatically. As I said before, it’s the little things…

Promotions and Special Offers

 

I was a little overwhelmed by this at first, and, to be honest, I still am! Magento offers a wide range of rules that allow you to create special offers and discounts specific to either products or cart totals. Want to offer a 10% discount, but only on a certain brand? No problem! Want to make it so that the user can only get the discount if they spend over £20? Not a problem at all! Want to only allow a certain customer group to use the discount code? It’s all here baby! Although the rules setup takes a little getting your head around, it’s incredibly powerful and offers an endless selection of promotional options to offer to your customers.

It’s Open Source

 

Last but by no means least, the fact that Magento is available freely as an open source product is breathtaking. OSCommerce has for years dominated the open source ecommerce market, spawning tens of thousands of identical online stores, each one as ugly as the last. I love the fact that Magento is a high quality open source product that wipes the floor with OSCommerce. But what I also like is the fact it’s not aimed at beginners. It’s enterprise level, and while I’m sure we will still get a stream of very similar Magento websites, all based on the default theme, hopefully their mark on the web won’t be anywhere near as ghastly as that of other open source ecommerce solutions. But for established ecommerce businesses looking to take their site to the next level, Magento is by far the best open source product on the market and definitely worthy of your attention!

Beautiful Quotations

When destiny binds u to be a joker, Be the best joker in the world

Fear is the root cause for all negative attitudes, Do the things you are afraid to do again and again till one day fear is afraid of you.

Happiness is not the product of success but the process of success, You can't achieve success unless you are happy in what you are doing.

Don't ever leave the one you love for the one you like, because the one you like will leave you for the one they love.