I recently had an unexpected part 3 to this tale the other day, when the display went. Again. But this time, different symptoms. This time, the backlight went. Oh sh*t, replacing LCD panels isn’t exactly cheap, and since the backlight diffusers and CCFL’s are fused to the back of the LCD panel itself, there was no way of replacing the individual unit.
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.
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” »
I’ve come across a handful of sites now that either do (or want to) automatically add a default shipping charge to the cart when it’s created or updated. As I had a bit of trouble finding a method for this, I thought I’d post my exact method here for usefulness and future reference.
In order to get this working, you need a module which hooks into the event ‘sales_quote_save_before’. We’ll use the namespace BTS.
I’ve come across several places where I’ve needed to get the current category (or information from it) in one way or another. Some blocks have the ability to do this:
$_category = $this->getCurrentCategory();
However, if you need to get the current category in a block (or model, helper, whichever) where this method isn’t present, then we can simply do this instead:
$_category = Mage::registry('current_category');
They both return exactly the same object (unless overridden, that is Mage_Catalog_Model_Category).
Caveat: If you are in a block that doesn’t have access to ‘getCurrentCategory’ nor is Mage::registry(‘current_category’) defined (for example, the product list being applied to the home/front page) you can load by category ID if known. In this example, the Mage_Catalog_Block_Product_List has been applied to the front page, so you’d need to do this instead:
// Check for $_category's existance/status after initial block load, and grab the category ID from the object's parameters/attributes. // Replace $this->getCategoryId() with a category ID, whether defined statically or retrieved from another method. if (!is_object($_category)) $_category = Mage::getModel('catalog/category')->load($this->getCategoryId());
Of course, this ends up being slightly different depending on where you need to get the category object.