Bug in Magento 1.4.1.1 core affecting Catalog Price Rules targetting Customer Groups

I came across this issue to begin with using the Wildcardbi_RulePriceAttribute module to be able to specify custom prices for specific customer groups (in this case, wholesale/trade pricing) without having to setup an entire new store view for it.

Continue reading “Bug in Magento 1.4.1.1 core affecting Catalog Price Rules targetting Customer Groups” »

Adding shipping costs to the cart automatically in Magento

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.

Continue reading “Adding shipping costs to the cart automatically in Magento” »

Get the current category in Magento

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.

Magento Buy X Get Lowest Priced Item Free

An extension for Magento on Magento Connect (here) allows users to run a promotion similar to Buy X Get Y Free, but of different products (instead of a number of the same products). The caveat to this extension however is that it breaks a Magento 1.4.x installation completely, due to key changes in the coupon validation routines in the upgrade.

Anyway, I attach to this post the fixed file. Unzip this file, overwrite app/code/local/Sttl/Buygetfree/Model/Validator.php with the one inside the zip, and go create some promotions!

Have fun.

P.S: This ([download id=”1″ format=”7″]) is a full version of all the module’s files if you find it easier to do it that way. Place this file in app/code/local and extract. Then create a file called Sttl_Buygetfree.xml in app/etc/modules and put this inside of it:



    
        
            true
            local
        
    

Compaq CQ60 Display Woes – Part 2

So in my previous post relating to this, I’d sent the machine back twice to HP to be repaired. The first visit gained a new motherboard and CPU. The second visit gained a new LCD assembly. But still the fault persisted. It sort of worked alright-ish for around a week or so, but then gave up the ghost completely. Sometimes the backlight would come on but no picture. Having had enough of it at this point, I phoned HP technical support a third time, claiming to them it would be my last call before phoning their Customer Complaints department.

So last Wednesday (July 14th 2010), it got picked up again, and was delivered back to me yesterday (Monday July 19th 2010). What did the service report say this time? I hear you ask.. “LCD cable replaced”… Are you serious? All this for a f*cking piece of wire? However annoyed I was at what their resolution was this time, so far it’s behaved exactly as it should. Resolved? Dare I say it this time? Yes…

So, third time lucky. In the meantime, I’ve found that the CQ60 isn’t on sale ANYWHERE anymore. It’s been deprecated and replaced with it’s mate, the CQ61. Casandra has one. There’s some key changes to the chassis and port placement on the unit. The power connector is on the opposite side to the CQ60. I assume that the Graphics, CPU and Power circuitry all the same corner of the board causes somewhat of a problem. I dunno. Either way..

n/a