Recent Musings
Personal blog of Tristan Blease
Auto Apply Coupons in Magento
Came across a situation where I needed to automatically apply a coupon code based on the landing page a visitor arrived at. Didn’t see anything on the Magento forums, so I whipped up some quick Javascript and thought I’d share the resulting snippet:
<script type=“text/javascript”>
//Specify your own coupon code below
var bdCoupon = ‘testcouponcode0000’;
//Make the request
var bdRequest = new Ajax.Request(“/checkout/cart/couponPost/“, {
method: 'post',
parameters: 'coupon_code=' + bdCoupon,
onSuccess: function(r) {
//Coupon applied successfully
},
onFailure: function(r) {
//Couldn't make the request/coupon failed
}
});
</script>
You can just drop this in at the bottom of the user-editable portion of a CMS page with the coupon code filled out and prototype will do the rest after the page loads. This was tested and working on 1.2.1, but I’d assume it’ll work with 1.3, too.
Is Less More?
A conversation earlier today got me thinking about the saying “less is more.“ It’s a great idea that can help make communication more effective, but sometimes less just isn’t enough. When you only have one chance to pitch your idea, sometimes you need to say more to get your idea across correctly.
Just how much more? That depends on the audience you’re talking to and the complexity of the idea you’re trying to communicate.
In most circumstances, less is more, but instead of focusing on saying less, maybe we should focus on saying just enough.
Of Pigs and Influenza
Pigs. Pathogens. Pandemics. The world’s a scary place right now if you pay close attention to the media and social networks like Twitter. With the CDC activating its emergency operations center and the WHO raising the pandemic alert levels, it’s clear the swine flu is making waves both at home and abroad.
It’s been fun to watch people’s responses to the situation. On Twitter, a handful of people have been tweeting about the impending apocalypse. A coworker of mine stocked up on Tamiflu and hand sanitizer. Some of my closest friends and family are excited for the price of pork chops to plummet. They’re looking to invest those savings in a new grill
It all seems a little crazy to me. Sure, I bought some hand sanitizer and will try to be more mindful of hand hygiene, but I’m not treating this any differently than I would a seasonal flu. It’s not that I’m trying to avoid the killer swine flu, I’m just trying to avoid the downtime that would come with any flu.





