danneh.org

Archive for September, 2010

Bug in Magento 1.4.1.0/1.4.1.1 affecting the recalling of newsletter templates to send

by Dan on Sep.24, 2010, under Magento, PHP

So I wondered if I could go a whole week without finding another bug/flaw/issue in the latest Magento. I was wrong.

We’re trying to send out a newsletter using the built-in feature. I created a template, then went to queue to send it, and I was like; “So, what’s this ‘message’ field?”. I pondered for a bit, typed a message in, thinking it may have just been for some placeholder in the template somewhere, and hit send. When the newsletter turned up, lo-and-behold, there was just my message, without the rest of the template. WTF? Did it again, thinking I’d screwed something up – same result. Hmm..

Bit of Googling at this point revealed this thread on Magento’s forums. “A bug?”, I thought as I read on. “Couldn’t possibly be!”. </sarcasm>

As the code/class that had the flaw only had one function and extended the Adminhtml_Block_Widget_Form class, I decided to just write a quick extension to replace the class that Magento comes with, with this flaw fixed. I attach to this post my quick extension. Just drop this in the Magento webroot and extract. It’ll put the files in the relevant places, and just start working.

Attached file here: BTS NewsletterFix.tar (md5: df19810f175630fd9206d31e3147c3da)

4 Comments :, , more...

Adding multiple products to the cart simultaneously in Magento

by Dan on Sep.09, 2010, under Magento, PHP

Some people ask me if it’s possible to do what some other sites do, allowing you to check a box next to a product on a listing page, and then add all selected items to the cart in one go. This is possible in Magento, it’s just not built in. There’s a few ways you can do this. You can either make an ajax call using a button against each product, which fires off a GET request to the server to add. This method will most likely return the HTML for the cart, and since we’re not interested in the response, said HTML can be discarded.

Continue reading “Adding multiple products to the cart simultaneously in Magento” »

6 Comments :, , , , , , more...

Magento Discount Rules – Buy X Get Lowest Priced Item

by Dan on Sep.09, 2010, under Magento

I figured out today that the discount/promotion rules in Magento aren’t exactly obvious, nor straight forward to apply. If you don’t have the logical mind of a programmer, setting up rules for products that only meet certain criteria can be a tricky one. Take this example:

Buy 4 for 3 on any product in [this] category.

Sounds simple, no? Actually, no. Continue reading “Magento Discount Rules – Buy X Get Lowest Priced Item” »

9 Comments :, , , , more...

Blogroll

A few highly recommended websites...