Archive for February, 2010
Editing Magento’s Top Links (The Better Way)
Wednesday, February 24th, 2010
You might need to read the post about using a local.xml file before this post makes much sense.
We offer all our clients a completely customized design from scratch, which means changing anything – including those annoying defaulted top links. This post will show you how to edit your top links (without editing core layout files which may change when you update Magento) by utilizing a local.xml file. You can even add your own custom links without touching any template files! [NOTE: This specific example assumes you are using the blank theme. Layout handles may differ from theme to theme.]
ADDITION: Check out the blog post about editing Magento’s footer links
In local.xml:
<?xml version="1.0"?> <layout version="0.1.0"> <default> <reference name="root"> <reference name="top.links"> <!-- Add custom links. Pretty self-explanatory. Dig into app/code/core/Mage/Page/Block/Template/Links.php for more info --> <action method="addLink" translate="label title"> <label>About Us</label> <url>about</url> <!-- can use full url also --> <title>About Us</title> <prepare>true</prepare> <!-- set true if adding base url param --> <urlParams helper="core/url/getHomeUrl"/> <!-- base url - thanks @Russ! --> <position>1</position> <liParams/> <aParams>'class="top-link-about-us"'</aParams> <beforeText></beforeText> <afterText></afterText> </action> <!-- Removes 'My Account' link - Default position: 10 --> <action method="removeLinkByUrl"><url helper="customer/getAccountUrl"/></action> <!-- Removes 'Wishlist' link - Default position: 20 --> <!-- for Magento 1.3.x --> <action method="removeLinkByUrl"><url helper="wishlist/"/></action> <!-- for Magento 1.4.x --> <remove name="wishlist_link"/> <!-- Removes 'My Cart' AND 'Checkout' links Default position: 40 and 50 respectively --> <remove name="checkout_cart_link"/> <!-- To re-add 'My Cart' or 'Checkout' after removing both --> <block type="checkout/links" name="checkout_cart_link_custom"> <action method="addCartLink"></action> <action method="addCheckoutLink"></action> </block> </reference> </reference> </default> <customer_logged_out> <!-- Removes 'Log In' link - Default position: 60 --> <reference name="top.links"> <action method="removeLinkByUrl"><url helper="customer/getLoginUrl"/></action> </reference> </customer_logged_out> <customer_logged_in> <!-- Removes 'Log Out' link - Default position: 60 --> <reference name="top.links"> <action method="removeLinkByUrl"><url helper="customer/getLogoutUrl"/></action> </reference> </customer_logged_in> </layout> |
If you absolutely cannot find a way to customize your top links using these methods, you can edit the /template/page/template/links.phtml
Posted in Development, Magento Development | 32 Comments »
Optimizing Your E-Commerce Conversion Rate: Analyzing and Improving Traffic Quality
Tuesday, February 23rd, 2010
Variable #1: Traffic Quality
If you sell pencil sharpeners, and most of your traffic is redirected from a Youtube video that shows a guy balancing a pencil sharpener on his nose, it’s not very likely that the visitors to your site are interested in purchasing pencil sharpeners. Your bounce rate will likely be sky-high. I recently saw a massive increase in traffic to one of our client’s sites, increasing their monthly traffic volume by around 30%, but they only made one sale from all of the traffic. It was a major design gallery hit that caused the traffic. People were going to the site to look at the design, not buy stuff, so of course, the conversion rate for that traffic source was 0%. In these cases, the traffic quality would greatly decrease the conversion outcome, despite the quality of your Value Presentation and the Ease of Purchase. The Value Presentation and Ease of Purchase variables would have to pick up a lot of slack to absorb the poor traffic quality and generate conversions.
If, on the other hand, your traffic quality is very high, it can absorb weakness in your Value Presentation and Ease of Purchase. Specialty stores are a great example of this. They offer a very narrow product that you can only get from them. Their site can have a really bad design and no marketing continuity or promotional sensitivity, and it can be really difficult to purchase the product, but they still convert visits to purchases because the traffic to their site is looking for what they’re offering. This situation can be broken down via a few Value/Cost-based criteria:
1. Perceive they immediately need/want what you’re offering
Many of the people who arrive on a specialty site will most likely perceive that they need/want what is offered. Otherwise, they wouldn’t have ended up on the site. They either searched for the specific specialty item on a search engine or were referred by a friend or other site that clearly defines the specialty. Hopefully any traffic that arrives and immediately leaves wasn’t traffic that required resource allocation to generate.
If a visitor does not perceive that they need it immediately when they arrive on your site, you must either persuade them that they do need/want “it” immediately if you wish to convert the visit into a sale. That may not be the right goal, though. Oftentimes, the right goal is to build loyalty without asking for the “final” sale by asking for intermediate commitments, like signing up for a newsletter, following you on Twitter, ordering a catalog, or any other intermediate step that generates a larger degree of intimacy with that visitor. How quickly you seek to convert a visitor to a purchase depends largely on the nature of your offer. If you are selling novelty T-shirts, converting the sale on the first visit is likely the right pursuit. If, however, you are selling vintage wine, it is likely not advisable to convert on the first visit. Quality traffic flow analysis can bring clarity to this kind of question though.
Key Point: Do not base your decisions on what seems reasonable or intuitive. Look at the data and react to what is actually happening.
Key Point: “What is my bounce rate?” is not the right question. “What is the bounce rate of my quality traffic?” is the right question. In other words, are the people you want to be on your site staying? That’s all that matters. Who cares about the designers who are just browsing for design inspiration. If they bounce, it doesn’t matter. Do you think we freaked out when the general bounce rate spiked after the major design gallery hit? Of course not. That is to be expected. Asking the right questions is the fundamental key to conversion success (oh, and the key to success with everything else, too).
2. Perceive it to be worth more than they perceive it costs them.
There are two variables here: Perceived Value and Perceived Cost. To help the visitor to pass this Gauntlet milestone, you must affect one or both of these factors. There is no other option.
Perceived Value
Value is a tricky thing. No two people perceive the same thing as equally valuable. In fact, I could wax philosophical here and pose the question, “Does true value even exist?” but I will refrain. Whether or not there is a true value to anything, people perceive it differently. Our team believes in trying to correctly assess the true value of what we offer and represent that value well. That encourages our team to constantly improve the value of what we offer, which we appreciate.
There are two factors of perceived value: Pre-Existing Evaluation and Interaction Effect. The pre-existing evaluation is relevant to the Quality Traffic variable; the interaction effect is relevant to the Value Presentation variable.
1. Pre-Existing Evaluation is how the visitor evaluates the product or service prior to interacting with your marketing media. Except in cases where the individual has never heard of your product or service, everyone will have a Pre-Existing Evaluation. This is not something you can affect. Ideally, you want to attract visitors who have a very high pre-existing evaluation of your product or service. High pre-existing evaluation has a positive effect on Traffic Quality, but it’s not the only sub-variable of Traffic Quality. Most people have a very high evaluation of a Lamborghini, but that doesn’t mean Lamborghini should try to attract “most people” to their show room. We’ll discuss the other sub-variables shortly.
2. Interaction Effect is the effect the interaction with your offering, specifically your e-commerce site in this case, has on your visitors pre-existing evaluation. The only factor in the Interaction Effect that is relevant to Traffic Quality is how Impressionable the traffic is, which makes them more receptive to positively changing their evaluation of your product/service. We will discuss the Interaction Effect in greater detail when we discuss the second variable, Value Presentation.
Perceived Cost
The first mistake people make when considering Cost is to assume that it’s simply the price. It’s not. First, the same price will be perceived differently in how costly it is depending on the perspective. A multi-billionaire perceives a private jet to be a very low cost; a millionaire would perceive it to be extremely costly. When thinking about Perceived Cost, think about it in terms of Perceived Sacrifice, as that is what the person feels. How much a person feels they will experience sacrifice as a result of making a particular decision is a different way of saying Perceived Cost.
Many people perceive less sacrifice in purchasing a $3,000 ring for $100 per month for five years than paying $3,000 cash immediately, even though the first option is twice as costly in terms of cash than the second, and yet it is considered less costly. Clearly, Perceived Cost and price are not interchangeable.
Money isn’t even the only factor that plays a part in Cost Perception. Time, stress, focus, and forms of sacrifice are equally important to consider. Convenience is becoming more important in the purchase of goods and services because a higher value is being placed on time, focus, and stress avoidance. People value time more, so using less of it means they feel less sacrifice. This is especially relevant to the third variable, so I will bite my tongue for the time being.
To conclude this section on Perceived Value and Cost, consider that in order to pass this Conversion Gauntlet obstacle, the visitor must perceive more value than cost in the acquisition of your good and/or service. Consider all the factors that affect Perceived Value and Perceived Cost. Most people just look at price. Don’t be sucked into that ignorance. It’s not about price. It’s about Value and Sacrifice (Cost).
There is tons more to say about the relationship between perceived value and cost. I could literally write an entire book about it. But I will be patient and elaborate on it later.
3. Be able to complete the transaction process without falling below the “Adequate Value Threshold.”
The “Adequate Value Threshold” is that point at which the Perceived Value falls below the Perceived Cost or the Perceived Cost rises above the Perceived Value. I will be writing a blog post on this idea alone as it is an essential piece of theory that every business person and marketer needs to be able to visualize graphically.
Two important questions relevant to Traffic Quality:
1. Do they have the technical skill to complete the process?
Your visitors need to be able to use the internet and complete a transaction online in order to purchase from you. If their technical skills are lacking or if your process is difficult, their attempts at completing the process may produce a great deal of stress or take a lot of time and focus, both of which increases their Perceived (and actual) Cost to complete the transaction. This can push the Perceived Cost above their Value Threshold, which is the point at which a person says “No.” Generally, the later this occurs during the interaction, the more likely it will cause the visitor to exit the interaction with a negative outcome. Visitors don’t typically expect to see adequate value in a product or service early on in the interaction, but once they cross the value rises above the cost or the cost dips below the value, a cross back over typically greatly reduces the likelihood of a positive outcome.
2. Do they perceive significant risk in giving their credit card and other personal information to a business online?
Security is so important to people because it represents the absence of risk. Risk is a sacrifice, and therefore a cost. Reduce risk and you reduce the cost to the visitor. The less your traffic consider it risky to give personal information, the higher quality traffic it is as it relates to conversion rate specifically because fewer visitors will abandon the process due to the perceived cost of insecurity/risk.
4. Have the resources to absorb the cost right now.
I clearly have chosen specific verbiage here to represent a more accurate truth. I could have just said, “They gotta have enough money to pay the price,” but, to belabor the point, it’s not just about money. Do they have the time, money, and emotional and mental strength to absorb the costs of time, money, stress, and focus that is required to complete the purchase?
Convenience has become a major factor more recently because people are tending to value their time more. Consider what your target audience values (make a list!) and be sensitive to those values. If you can’t connect with what your audience values most, how in the world are you going to communicate any value to them?
Conclusion:
Traffic Quality is the nature and condition of people when they arrive on your site. There are a vast array of preset values that will affect how they respond to your Value Presentation. Your Value Presentation is not right for everyone. In fact, it’s probably not right for the grand majority of the market. Make sure you’re attracting the right Traffic for your Value Presentation. Sometimes, though, it’s easier to change your Value Presentation to conform to the Traffic Quality you have. In the next section, I will discuss how Your Value Presentation can affect the two criteria for conversion and what factors you need to consider in optimizing it to better deliver value to your Traffic.
Coming Soon… Article #3 in the Revenue Optimization Series: Value Presentation. I don’t know about you, but I feel like I’m in marketing heaven already.
Appendix A
Wrong Question #1: What is a good conversion rate?
There is no global “good” conversion rate. It really depends on your particular circumstances. Consider this. If you have a product that requires a large amount of consideration and research before a purchase decision is made, you may have visitors that visit your site 20 times before purchasing. Since conversion rate is calculated by purchase orders divided by total number of visits (# of Orders / # of Visits = Conversion Rate), your maximum conversion rate is only 5%. So if half of the unique visitors that are coming to your site end up purchasing, you are achieving a 2.5% conversion rate. This is over-simplification, but you get the picture. Determine your target conversion rate based on your offering and your audience. Don’t listen to gurus who herald their ability to produce xx% conversion rates and that you should be generating that conversion rate as well. If their traffic is exclusively club members and their product is mandatory membership cards, their claims becomes less impressive. In fact, aiming too high on your conversion rate can generate bad decisions. By trying to get your visitors to push the button too quickly, you may miss out on opportunities to cross-sell or up-sell and you very likely will get to a point when you stop serving their best interests (and that’s what you want most, right?). If you need help, find a consultant that wants to know your business before telling you what your target conversion rate should be. That’s a good sign they’ll be helpful.
Next article: Value Presentation (will link to as soon as the article is finished)
Tags: conv, E-Commerce, traffic, traffic quality
Posted in E-Commerce, E-Commerce Optimization, Magento | No Comments »
Optimizing Your E-Commerce Conversion Rate: The Two Conversion Criteria
Tuesday, February 23rd, 2010
E-commerce traffic is worthless if you are not converting any of your traffic into sales. The percentage of visits that result in a purchase is called the conversion rate. So much emphasis is put on generating traffic, but it’s only the first step in building e-commerce revenue and profitability. It is typically very expensive from a holistic resource perspective (money, time, focus, etc.) to generate traffic, so to pay no attention to conversion rate is committing a cardinal e-commerce sin. There are a few critical components that determine how high your conversion rate will be.
Step back for a moment. What would it take to produce a 100% conversion rate? Every single time someone visited your site, they would purchase something. Any time a visitor meets two criteria, they make a purchase. There are many factors that affect each of these criteria, and I will analyze each of them in this article and following articles.
THE TWO CONVERSION CRITERIA
(Here it is. The secret recipe for converting visits to sales.)
To convert a visit into a purchase, the visitor must:
1. Perceive the value of what you offer is higher than the value of the cost to acquire it.
2. Have the resources to absorb the cost at the point of purchase.
I will analyze these Conversion Criteria from the perspective of a different set of variables. While it isn’t a quantitative measurement, you can determine the likelihood that an individual will make a purchase via a cubic equation: Traffic Quality x Value Presentation x Ease of Purchase. If you have a very high value for any of these variables, it doesn’t necessarily mean you will have a high conversion rate. Just as with the broader e-commerce revenue equation I covered in the first post of this series (Traffic x Conversion Rate x Average Order Size = Revenue), attention must be given to each of the variables to optimize the outcome. If any one of them is shirked, it can ruin all of the efforts made to improve the other two. While you cannot attach a numeric value to these variables as easily as you can to the Revenue variables, it’s still important to understand conceptually because the conversion variables relate in the same way as the revenue variables.
In the next article, I will dig into the first variable that affects conversion rate: Traffic Quality.
Tags: conversion rate optimization, E-Commerce, revenue optimization
Posted in E-Commerce, E-Commerce Optimization, Magento | 1 Comment »
The Better Way to Modify Magento Layouts
Tuesday, February 23rd, 2010
In this article, I’m going to be covering what I believe to be a very effective way of modifying the layout of any Magento theme.
For several of the first Magento themes I built, I copied the layout files from the default or blank theme into the custom theme layout folder. I would then modify the layout files directly, editing or commenting out content in files like: catalog.xml, page.xml, checkout.xml, etc… I never liked editing these files directly, as I knew that when it came time to upgrade to a newer version of Magento that had upgraded the layout files, I’d have to merge the changes into the new layout files.
One day, I was digging through the Magento code relating to layout files and discovered a bit of code that made me realize that it was possible to just place a local.xml file in my custom theme’s layout folder and have it loaded automatically by Magento. (this code is on line 283 in /app/code/core/Mage/Core/Model/Layout/Update.php in the fetchFileLayoutUpdates() method).
Due to Magento’s brilliant
Before delving into the code, let’s look at the advantages/disadvantages of this method:
Advantages
- Allows you to upgrade themes without having to merge in changes
- All custom layout changes are centralized, allowing developers to more easily make changes to custom theme elements
Disadvantages
- At first, it’s slower to use this method than hacking up the standard layout files directly
- You will have one more place to look where the site might be pulling code (template phtmls, standard layout files, admin layout updates, AND local.xml)
Here is the slimmed down, commented local.xml from one of our recent projects:
<?xml version="1.0"?> <layout version="0.1.0"> <default> <reference name="head"> <!-- Magento looks in /skin/frontend/<INTERFACE>/<THEME>/js/buyprinting.js for this file --> <action method="addItem"><type>skin_js</type><name>js/buyprinting.js</name></action> <!-- This removes the item that was set in the page.xml file --> <action method="removeItem"><type>skin_js</type><name>js/iehover-fix.js</name></action> <!-- Magento looks in /js/prototype/element.storage.js for this file --> <action method="addJs"><name>prototype/element.storage.js</name></action> <action method="addCss"> <stylesheet>css/buyprinting.css</stylesheet></action> </reference> <reference name="header"> <!-- This adds a CMS block that can be called from the template file associated with the header block. --> <block type="cms/block" name="cms_quick_help"> <action method="setBlockId"><block_id>quick_help</block_id></action> </block> <!-- The remove tag removes the blocks with the specified name from the layout --> <remove name="top.menu"/> <remove name="store_language"/> <remove name="breadcrumbs"/> </reference> <reference name="top.nav"> <remove name="catalog.topnav"/> </reference> <reference name="left"> <remove name="left.newsletter"/> <remove name="left.permanent.callout"/> <remove name="catalogsearch.leftnav"/> <!-- When you use the remove tag, it removes any blocks with the specified name from the entire layout, regardless of the context. So, if I remove right.newsletter in the <default> context and that name is used in say the <catalog_product_view> context, then both blocks will be removed. Because remove operates on the global context, you can only remove an element once. Since <remove name="right.newsletter" /> is being called in catalogsearch.xml, we have to unset it, or else we'll get an error. The line below only unsets the block from the parent's context, not the global layout context --> <action method="unsetChild"><name>right.newsletter</name></action> </reference> <reference name="right"> <!-- Some blocks have to be removed using remove, others via unsetChild. I've not spent the time digging into the code to figure out why --> <remove name="right.permanent.callout"/> <remove name="catalog.compare.sidebar"/> <remove name="left.reports.product.viewed"/> <action method="unsetChild"><name>sale.reorder.sidebar</name></action> <action method="unsetChild"><name>wishlist_sidebar</name></action> <action method="unsetChild"><name>right.reports.product.viewed</name></action> <remove name="cart_sidebar"/> </reference> </default> <!-- CATALOG PAGES --> <catalog_product_view><!-- 2columns-right --> <reference name="root"> <action method="setTemplate"><template>page/2columns-left.phtml</template></action> </reference> <reference name="content"> <reference name="product.info"> <block type="cms/block" name="cms_product_info_tabs"> <action method="setBlockId"><block_id>product_info_tabs</block_id></action> </block> <block type="catalog/product_view" name="product.clone_prices" as="prices" template="catalog/product/view/price_clone.phtml"/> <action method="unsetChild"><name>tierprices</name></action> <action method="unsetChild"><name>addto</name></action> <remove name="addto"/> <reference name="product.info.options.wrapper.bottom"> <action method="unsetChild"><name>product.tierprices</name></action> </reference> </reference> </reference> </catalog_product_view> </layout> |
I hope with article has given you some direction as to how you can improve you Magento theming skills. If you have any additional tips/comments on coding layouts, please suggest them in the comments section.
Posted in Magento Development | 84 Comments »
The Smart Method of Loading Collections
Wednesday, February 10th, 2010
One fairly unknown feature of Magento collections is that you actually don’t have to call ->load() on a collection before being able to access the items in the collection. So you can do this:
$orders = Mage::getResourceModel('sales/order_collection')->addAttributeToSelect('*'); # The load method is not necessary, as iterating through a collection automatically loads it, if it hasn't already been loaded. # $orders->load(); foreach($orders as $order){ echo 'Order Id: ' . $order->getId() . "\n"; } |
The base Varien_Data_Collection class implements the IteratorAggregate (http://php.net/manual/en/class.iteratoraggregate.php) interface which extends the Traversable (http://www.php.net/manual/en/class.traversable.php) interface. When a class extends the Traversable interface, it guarantees that that class can be iterated through using foreach(). When foreach is called on a collection, it calls the getIterator() method in the Varien_Data_Collection class and uses the value returned from that method as the value that the foreach iterates through. This is the getIterator() method:
public function getIterator() { $this->load(); return new ArrayIterator($this->_items); } |
This auto-loading functionality works for both EAV and flat-table collections.
As you can see, a collection ensures that it is loaded before running through a foreach loop. Note: collections can only be loaded once per instantiation. If you want to reload a collection, you have to call the clear() method, and then reset the select and filters before calling the load() method again.
Knowing that collections function in this way allows you to write code without explicit calls to load(). This ultimately should result in more flexible code. You can have a method in a block that loads a collection. That collection can then either be called by a template file and iterated through, or you can have another method that loads the collection from the first method, and then adds additional selects/filters to it. This practice of not explicitly calling the load() results in more flexible and reusable code.
Posted in Magento Development | No Comments »
Saving the Value of a Specific Attribute from a Model
Wednesday, February 10th, 2010
In Magento, it’s very easy to save all the data in a model by running $model->save();. (Note: In this blog post, model refers to an EAV model, not a flat resource model) This saves all the attributes for the model to their respective attribute tables. There are times when saving the value of just one of the model attributes is desirable. A couple cases where you’d want to do this:
- You’ve been passed a model from an event, and you aren’t sure if the data in that model can be safely saved.
- You are saving many models and want to make your save operations as efficient as possible
Here is how you’d save just one attribute of a product model:
$product = Mage::getModel('catalog/product')->load(1); $product->setName('Some Random Name'); $product->getResource()->saveAttribute($product, 'name'); |
Posted in Magento Development | No Comments »
PHP Single vs. Double Quotes
Sunday, February 7th, 2010
For a long time, I’ve been a proponent of using single-quotes as opposed to double-quotes when assigning string literals (strings containing no variables) to a variable (eg: $var = ’string’; VS $var = “string”).
I just did some research to find out how much (if any) impact using single-vs-double quotes had on performance. I took the code from this blog post: http://spindrop.us/2007/03/03/php-double-versus-single-quotes/ modified the MAX constant to 8,000,000 and then ran the test on our Nexcess server. The results were fairly consistent:
Time 1: 5.9485120773315 ($c = “test ” . $i; )
Time 2: 7.0326972007751 ($c = “test $i”; )
Time 3: 5.9164550304413 ($c = ‘test ‘ . $i; )
It’s clear that embedding variables in strings is less efficient, but the difference between normal single-vs-double quotes is negligible (at least on our server configuration with this test).
Despite the lack of clear performance benefits, I still think it best practice to use single-quotes when using string literals, as it denotes that a string doesn’t contain any variables. One benefit of this is that when skimming code, you can more quickly process which variables are string literals vs strings with embedded variables.
The Zend Framework Coding Standard also recommends this practice: http://framework.zend.com/manual/en/coding-standard.coding-style.html
Posted in PHP | 1 Comment »