Sordid Details, of a sort
May 25, 2006 | In RTML | 5 CommentsThe following post from Sheridan Rawlins, Yahoo! Small Business engineer, outlines two often misunderstood RTML operators, SORT, and INDEXED-SORT. The post is intended for Yahoo! Store Developers or merchants with an advanced understanding of RTML. Learn more about RTML.
Some time ago we released the SORT operator in response to the difficulty and tedium of writing a sorting template directly in the RTML language. I would like to shed some light on how it works, describe the differences in the two flavors of sort (SORT & INDEXED-SORT), and describe more advanced sorting, such as sorting on a secondary property when the first property is equivalent.
Both the SORT and INDEXED-SORT operators expect 2 variable names (var1 & var2), a sequence, and a body. The elements of sequence are examined 2 elements at a time by setting the two variables and evaluating the body to determine whether var1 is less than the var2. A copy of the sequence in sorted order is returned.
The body allows full customization of the sort order subject to some conventions which should be followed: return-style consistency, and comparison consistency.
Return-style consistency
We support two styles of body’s return value – one of the following styles should be chosen and stay consistent for a given instance of SORT or INDEXED-SORT:
- strcmp-like: a number, which is
- -1 if var1 < var2
- 0 if var1 = var2
- +1 if var1 > var2
- Binary Predicate: a symbol which is
- T if A < B
- NIL if A >= B
Comparison Consistency
The comparison must obey the following “StrictWeakOrdering” properties:
- Irreflexive: when (var1=A, var2=A), body must return 0 or NIL
- Antisemetric: when (var1=A, var2=B) returns -1 or T, then (var1=B, var2=A) must return +1 or NIL
- Transitive: when (var1=A, var2=B) returns -1 or T, and (var1=B, var2=C) returns -1 or T, then (var1=A, var2=C) must return -1 or T as well.
When to use SORT vs. INDEXED-SORT
SORT is useful when sequence directly describes the elements to be sorted.
INDEXED-SORT is useful when “expensive” lookups must be performed against each element in sequence to determine the index to sort on. The best example of this is when you have a sequence of ids (i.e. @contents) and you wish to sort on the @name property of each element.
INDEXED-SORT’s extra parameter: getindex
INDEXED-SORT first iterates across sequence setting var1 for each element and evaluating getindex. Then, it evaluates body much like sort but sets var1, and var2 to these indices. A copy of the sorted sequence is returned (indices are discarded).
I hope this helps describe the basic principles of the sort and comparison operators. I’ll provide examples and other sorting tidbits in a companion post.
Sheridan Rawlins
Yahoo! Small Business
Edit 01/11/07
In order to reverse the sort order you need to tweak the body of the INDEXED-SORT.
The current implementation of sort-item-by-price has something like the following:
sort-items-by-price (items nilgreater)
INDEXED-SORT var1 var1 var2 var2 getindex WITH-OBJECT var1 ELEMENT position 0 sequence @price sequence items CALL :<=>-nil. var1 var2 nilgreater
To reverse the sort you would would switch the arguments and the boolean in the call to <=>-nil. — Something like:
sort-items-by-price (items nilgreater)
INDEXED-SORT var1 var1 var2 var2 getindex WITH-OBJECT var1 ELEMENT position 0 sequence @price sequence items CALL :<=>-nil. var2 var1 NOT nilgreater
I hope this helps!–SCR
Sound off merchants
May 19, 2006 | In News & Announcements | No CommentsAre you worried about losing sales from customers feeling the pinch of rising gas prices? Has the pace of technology got you scrambling to keep up? Small Businesses, we want to hear from you!
Voice your opinion on ‘What’s keeping you up at night?’ at http://www.insightsforum.com/poll/. The results will be featured in a Small Business-related article on Yahoo!
Building Community to Build Profits
May 19, 2006 | In Best Practices, Getting Started | 1 CommentI read an interesting article about customer loyalty by Hilary Mendelsohn on Practical Ecommerce. The article listed a few ecommerce sites that are encouraging customer loyalty through various programs. While the notion that it is more profitable to keep a customer than to attract a new one may not be new to many Yahoo! merchants, I haven’t seen a large number of stores that use one of the simplest and most effective methods of attracting repeat visitors—building a community.
The auction giant eBay is perhaps one of the best known examples of how developing a loyal community, increases activity and thereby revenue per user. The same is true for Yahoo! in that the most active users tend to be the users that are more likely to purchase premium services. The key to community is not just limited to forums or chat rooms, but in a larger sense about engaging the visitor. What can you do to keep shoppers coming back for more?
With this in mind I went hunting for Yahoo! stores that feature community sections and came across duematernity.com. In addition to having a compelling visual design, Due Maternity encourages moms-to-be to interact with the site by offering wish lists, calendars (be sure to check out the jiggy-o-matic), baby name finders, baby astrology, and more.

Due Maternity Community home page
I asked Albert DiPadova of Due Maternity about the benefits and challenges of offering community features.
Why is the community site important to your business?
DM: Because we have so much repeat business our customers really wanted to have their info stored on our site so they didn’t have to keep retyping it. This lead to the development of the community site which provides fun and useful tools to build our customer base.
What end-user tools do you provide on the community site?
DM: The primary reason we built the community pages was to allow our customers to register for their baby showers. Then we added fun and entertaining things to keep them coming back including Baby Astrology, Baby Name Finder and Maternity Clothes Wish List, and Due Date Calculators.
What other community features might you add in the future? Forums? Mailing list?
DM: Our community features reflect our customers request, we will be adding Web2.0 functionality like a forums and blogs. We’ve recently added pod casts that link back to products and we’re looking at emailing abandoned shopping carts with coupon codes.
(Both blogging and forums are offered as part of Yahoo! Web Hosting which is included with every Merchant Solutions account. Yahoo! offers two of the leading professional blogging platforms, Movable Type and WordPress, and also phpBB, an open source bulletin board. Both are easy to set up and manage.)
What Yahoo products did you use to build those tools?
DM: We took advantage of Yahoo! Web Hosting services (already included as part of Merchant Solutions) to build the community site. This allowed us to leverage the power of PHP and MySQL side-by-side with the venerable Yahoo! Store RTML engine.
For example, we utilized PHP and MySQL to store Wish List information, but still rely on RTML for product layout, store publishing and the checkout manager.
Any obstacles you had to specifically overcome? How did you overcome it?
DM: Integration between the Yahoo! Store Editor (RTML) side of things and the PHP/MySQL hosting portion of the sites can be a bit of a challenge. However, the results of doing this effectively are well worth the effort. Having a team that understands both sides of the equation is key.
(Due Maternity worked with Joel and Steve of Practical Data.)
So if you only thought of Yahoo! Web Hosting as one way to build your site, think again about the type of features you can add to bring visitors back to your site. For any customer you can make return on their own, is one less click you need to fight for in search engine results, or one less click you need to pay for with sponsored search.
Paul Boisvert
Yahoo! Small Business
Making the move to Checkout Manager
May 12, 2006 | In Best Practices | 17 CommentsA merchant left a comment on a recent post saying that while the Checkout Manager functionality looked great, they felt the process of moving to Checkout Manager was slightly intimidating. The purpose of this post is to de-mystify the process and show the steps involved in moving to Checkout Manager.
The minimum steps for any merchant involve first setting the test cookie, and testing your new checkout flow by placing a test order. Then when ready, enable Checkout Manager, and publishing the Store Editor and your order settings. This would give your store a functioning checkout flow using Checkout Manager with all of the default settings. Of course, if you modified your current checkout pages in Order Forms, or you wish to take advantage of the ability to customize the design of your checkout pages to match your site, then there are a few more steps.
- Select flow settings: involves choosing single or multi-page checkout, combining shipping and billing pages, and showing or hiding the Order Review page. Version 1 checkout flow (also called the old checkout) shows the shopping cart section and shipping information. Version 2 checkout flow (also called the new checkout) shows a cart page, separate shipping and billing pages, and the Order Review page.Either one of these flows can be recreated in Checkout Manager. However, you also have the capability of customizing your checkout flow in ways that were not possible with the previous checkout flows. You can build the same checkout flow you have now, or choose a new flow that may work better for your store. Learn more about flow settings.
- Select visual design settings: involves setting colors for section header, borders, fonts, and buttons. You can use the Customizable Styles option to set the most common design elements of your checkout pages. If you built your site using the Store Editor, and you wish to use the same colors found in your site, then go to the Variables page in the Store Editor and copy the values for use in Checkout Manager. Learn more about customizing the visual design.Tip: The Store Editor displays color values in RGB format (for example 51 153 153), while Checkout Manager uses hexadecimal format (though the color picker does have fields for RGB color values). You can switch the Store Editor to display hexadecimal color values in the Advanced mode of the Store Editor by clicking the red arrow in the Editor toolbar, selecting the Controls button, and selecting “Hex” from the Color Code Input menu. This will allow you to copy color values from Store Editor and paste directly into Checkout Manager.You will also likely wish to upload a company logo to your checkout pages, but you can choose to include full HTML to display header, side bar, and footer regions to wrap your checkout pages.
- Add special messaging from your current checkout pages (if applicable): If your current checkout pages display any custom content to buyers such as your shipping or refund policies, you will need to copy that messaging from Order Form fields to Checkout Manager. Most of this content will likely be inserted into the Page Message field in Checkout Manager. You do have the ability to create new custom fields though so your custom messaging can be placed closer to the sections where the information is needed.
Before enabling Checkout Manager, merchants should set the test cookie and place test orders using the new checkout pages. This allows you to test the entire checkout process along with any customizations you have made so you can be certain your pages are exactly how you want them before making them available to buyers. Just be sure to cancel any test orders as these will be included when calculating your transaction fees.
If you want some inspiration of the kinds of customizations that are possible with Checkout Manager, check out http://www.sophiebags.com and place an item in the cart. If you have custom checkout pages that you want to show off, post the link to your site in the comments of this post.
Paul Boisvert
Yahoo! Small Business
Powered by WordPress on Yahoo! Web Hosting.
Copyright © 2006 Yahoo! Inc. All rights reserved. Privacy Policy - Terms of Service
RSS 2.0 Feed