Marimekko – Previous Next Links

http://usstore.marimekko.com/nest/kitchen-and-dining.asp

A fun little project that I did in July of 2011 was adding Previous and Next links to the Marimekko product detail page. Marimekko requested links to the next and previous products once a customer did a search or browsed a category. Several ideas were proposed including the addition of two new database fields on the product to contain these link urls.

There were several problems with this approach:
1) A backend service would have to run to automatically populate the new fields. Once new products were added Marimekko would have to wait for this service or trigger it to run.
2) The fields would be populated based on the category the product was a member of and the sort position of the product in that category. This means the previous and next links would not be representational of the results a customer just viewed on the search results page.

The solution I implemented was simple: serialize all the primary keys of the products drawn out to the page and stuff them on the session. Once on the product detail page, do an array search in the unserialized keys for the current product key and grab the key to the left and right. This gets you the product keys to be used in the query for the product being viewed. Two left joins later and now we have two “fields” on the product record with the necessary data: product names and urls.

Of course The Boss loved this solution because it was fast, gave Marimekko what they wanted, and didn’t require them to do anything different from what they were already doing.

I love managing complexity with simple solutions!

Single Portfolio Item marimekko_prev_next2