Blog

magento tips

Magento Tips: Edit Contact, AOL, email Templates, Free Shipping and more…

Magento tips and tricksAfter having used a couple different open source shopping cart solutions and feeling like they came up a little short, I decided to try Magento for a recent e-commerce enabled website. Overall, I am pretty impressed with the result. Magento has some solid development momentum behind it and they have already put lots of thought and time into their product. That said, “open source” or even commercial carts will have issues, bugs and hurdles to overcome. Here is a random list of issues and solutions I encountered during my tour of duty. Hopefully they can help you out with your own Magento experience.

Click to jump to a topic: How to edit the default Magento “Contact Us” page, Making Magento visible through AOL, Change the default Magento eMail template, Clear your test orders before going live and assign free shipping on a per product basis.

Getting Started With Magento

So you’ve downloaded and installed the latest version of Magento and it’s running fine on your server. Now you want to start changing how it looks. The template system in Magento is a little different than others and is the target of some griping. First off, they have categorized the system into “stores” and then “store views” So you can run multiple stores on the same Magento installation. It’s a powerful feature, though I’m not sure how needed it is. The whole block of cheese is explained here in the designers guide. The second different thing is the files you will want to edit for your template ( Layouts, Templates and Skins files ) are stored deep in two different locations. So, browse to your local copy of Magento. In the root directory there are 2 folders to pay attention to. /app and /skin. The nuts and bolts, things like template files to change functionality and layout, localization files and layout files are stored in the /app folder. Graphical and design items such as css files and images are stored in the /skin directory. This Magento guide page explains it well.

The layout .xml files, ( /layout )  the localization files ( locale ) and the .phtml template files ( /template ) are located for the default theme in

/app/design/frontend/default/default/

The design related files like .css, .js and images are in

/skin/frontend/default/default/

YES, it’s a pain to navigate between these directories, especially via FTP, but after a while you won’t even have to think about it.

I wanted to try out a fresher theme than the default. The “Modern” theme is provided free at Magentocommerce.com. But nooo, you can’t simply download and install the theme. You are forced to use the “easy” download system built into Magento called “Magento Connect”. Found in the administration under system/magento connect/magento connect manager. Log in with your regular admin creds. Paste the extention key you got from the previous page in to the box and click install. Now cross your fingers. What’s supposed to happen is the theme is supposed to install dircetly onto your server, into the proper directories and everything. It’s a neat concept. Id rather have a manual install, as you need the local files later anyway. In any case, it did not work for me. I tried twice and it seemed to stall out, not installing all the needed files. So I finally found this page which actually had a .zip of the modern theme, though at version 1.1. So you could try that, it worked for me, or hunt for a newer copy of the modern theme, as Magento is up to 1.3 as of this posting.

So, using the above folder structure your folder structure would look like this:

/app/design/frontend/default/modern/
and
/skin/frontend/default/modern/

Enable the modern theme through Magento admin: System -> Configuration -> Design and under the Theme section, put “modern” for Templates, Skin, Layout and Default.

How to edit the Magento default “contact Us” page.

The default page is a PHTML page caled form.phtml

/app/design/frontend/default/[your-theme]/template/contacts/form.phtml

I took this line of code:

[cc lang=’php’ line_numbers=’false’]__(‘Contact Information’) ?>[/cc]

And made it into this chunk, which achieved all I needed to do. A quick hack, but it may get you started.

[cc lang=’php’ line_numbers=’false’]__(‘Call us today at 123-123-1234’) ?>

__(‘Email us at emailaddress@email.com‘) ?>

__(‘Or just fill out the form below and click the submit button to send us the message.’) ?>
[/cc]

Magento won’t work with AOL!?!

Yep, AOL America Online strikes again. It happened that my client and all her friends and relatives were on AOL. So, while I had hours into the site and it appeared fine to me in IE and FF, to her it was “broken”. Apparently, on the IE 6 based AOL browser, the index.php page just refreshed when any link was clicked. I did some snooping and finally the good people on the Magento forums shed some light on the subject. (thread). Appearently AOL works through proxy servers which trip the alarms for Magento’s default settings for session validation. In other words, A user from AOL would appear to jump from IP address to IP address as the AOL proxy moved them around and Magento would see this as possible browser hijacking and stop the connection. So the following is a temporary hack at best.

Change the following settings in the admin
system / configuration / general / web / session validation settings

Validate REMOTE_ADDR “NO”

Validate HTTP_VIA “NO”

Validate HTTP_X_FORWARDED_FOR “NO”

Validate HTTP_USER_AGENT “YES”

Some people reported their sites working with only Validate Remote_addr turned off, but not for me, I had to disable the other two. Now, as these functions protect against session hijacking, it’s not really great to turn them off. Don’t display card details on the site. Hopefully there is a better fix in the future. Use at your own risk!

Edit the default Magento eMail Templates

How to edit the default Magento Email templates. The are stored in:
\app\locale\en_US\template\email\

Be aware that not all files in the folders need editing, and some templates have info in different spots, so be attentive.

Edit the following info:

replace alt=”Magento” with alt=”your store name”

replace Magento Demo Store with your store name

replace mailto:magento@varien.com with mailto:email@yourstore.com

replace dummyemail@magentocommerce.com with email@yourstore.com

replace (800) DEMO-STORE with (0800) YOUR STORE NUMBER

replace Monday – Friday, 8am – 5pm PST with your own store opening times and timezone

To replace the logo image, make a new image, (The default magento image is 169×49 for reference) name it logo_email.gif and put it here:
/skin/frontend/default/modern/images/logo_email.gif

You may also change aspects of the templates in the magento administration under
system –> transactional emails.

Clearing Your Magento Test Orders before going live

So, you are all set, everything works but you have a bunch of test orders you placed through the cart while trying everything out. As of this posting, Magento does not offer a way to fully delete orders. So the work around is to run an SQL query on the database, deleting the proper data, and reseting the store to “zero”.

Instead of running through all this I’m just going to link you to the site that helped me out, eliasenteractive.com

Be aware that you must replace the instances of YOUR_DB_NAME in the script with your actual database name.

Assigning Free Shipping on a Per Product Basis

This one threw me for a curve at first. Lets assume you have a cart with a pre existing shipping method, like UPS and a bunch of regular products. But then you have a few products, say for example, gift certificates, (my problem) that weigh next to nothing, yet the minimum UPS charge is still around $6. Customers would hate that right? So we need free shipping for those products ONLY, then simply mail the Gift Certificates out via regular USPS mail and eat the cost of the stamp. (Of course this is just an example, which happened to be my problem. You may want to have products with free shipping for all kinds of reasons.)

So, the method is two-fold. First you must ALLOW free shipping to even exist in the first place in the system -> configuration. Second, you will create a custom “shopping cart price rule” to assign the free shipping to only the desired products.

Step 1

In your magento admin, first browse to system, then configuration.

Under sales, select the shipping methods category.

Open the Free Shipping tab. You only change two things.
For Enabled: YES
For Minimum Order Amount, enter some crazy huge number. I entered 999999999. This is half of the trick. It enables free shipping as a “possibility” within the cart, yet no regular order would ever reach that level. If you already have this enabled (free shipping for orders over $50 etc..), then skip to step 2.

I’m not sure if it’s required, but I did the same thing under my standard shipping method as well. (for me it was UPS)

Free Shipping for Minimum Order Amount: Enable

Minimum Order Amount for Free Shipping: 999999999 (same crazy huge number as before)

Click the orange “Save Config” button to save your new settings.

Step 2

From the main Magento Admin menu at the top, go to Promotions, then select Shopping Cart Price Rules.

Click the Orange Add New Rule


Rule Information Tab:

 

Rule Name: Whatever You want
Description: Whatever You want
Status: Active
Customer Groups: As a default, Select all. (Hold the CTRL key and click)
Coupon Code. NOTHING (don’t enter anything here.)
Uses per coupon:
1000000000 (some huge number)
Uses per customer: 1000000000 (some huge number)
From Date / To Date: Leave blank to start now / end never.
Priority: 0 ?
Public in RSS Feed: no


Conditions Tab:

No changes needed, at least in my case.


Actions Tab:

 

Apply: Fixed amount discount for Whole Cart

Amount Discount: 0
Max. Quantity Discount Applied to: 0
Discount Qty Step: 0
Free Shipping: For Matching Items Only
Stop Further Rules Processing: NO

Apply the rule only to cart items matching the following conditions

This is key.
Click the green + button to add a new rule.
Select SKU.
Click “is” and change it to “contains“.
Click the ““, enter the unique segment of the SKU on you free products. For example the SKUs for my gift certificates were gift25,gift50,gift75 etc.., so here, I entered “gift“. You may simply want to append your free product SKUs with the word “free” for clarity, then enter “free” back here. You can do this however you want, but be sure to not use anything that may be contained in a regular products SKU.
So for me that line read:
SKU contains gift

Click the Orange Save Rule Button.

That’s it! Try it out.
There’s another method I came across which is the same, except instead of anchoring the Shopping Cart Price Rule (promotion) to a products SKU, a custom attribute is created for that product and then the promotion is tied to that attribute instead of an SKU. See it here.

I hope these tips helped some of you out. Feel free to sign up and leave more tips, questions or set me right on a mistake I may have made in the comments.

About the Author

Tobias CarrierTobias Carrier is lead designer and owner here at Rogue EasyWeb. He has been a freelance web designer / developer for over 8 years now. If Tobias isn't behind the computer you can find him out on a mountain bike, snowboard or just hiking around.View all posts by Tobias Carrier →