Creating products programmatically in Magento

Let’s face it – importing is hard. Especially if it’s from some other unfamiliar product, or something that doesn’t already have a Dataflow/import plugin for Magento already. Dataflow has its limits. I’ve actually found it easier to import manually (creating models for products) as opposed to writing Dataflow routines. However, one of my biggest bug […]

Get website-level configuration in Magento

I stumbled across this one a couple of times now, and it’s caught me out every time. With Magento, you have the method Mage::getStoreConfig() to get a store-level config, but nothing obvious to get a website-level configuration (such as a default URL for the website). So I used this; Mage::app()->getWebsite($websiteId)->getConfig(‘web/unsecure/base_url’) It’s the same syntax as […]

Bug in Magento 1.6.1.0/1.6.2.0 affecting development sites using base_url

I installed a copy of Magento 1.6.1.0 on a dev site I setup to do some testing with Varnish with (more on that later). However, in the requirement to be able to get to Magento using 2 different URL’s, I stumbled across this quite annoying bug. a:5:{i:0;s:67:”Illegal scheme supplied, only alphanumeric characters are permitted”;i:1;s:729:”#0 /home/dan/workspace/magento1610/app/code/core/Mage/Core/Model/Store.php(712): […]

Getting Configurable Product from Simple Product ID in Magento 1.5+

I recently stumbled across a hurdle which stopped some of my code from working. It was code that gets the configurable product associated with a given simple product. Many solutions out there call a “loadParentProductIds()” function within the Mage_Catalog_Model_Product class. However, as of Magento 1.4.2.0, they deprecated this method, simply by setting the data element […]

Adding multiple products to the cart simultaneously in Magento (Part 2)

A while ago I wrote about adding multiple products to the shopping cart simultaneously. It turns out this seems to have stopped working from Magento 1.4 or so. Up until now, I’ve not really had the time to look in detail to figure out why. Finally, this evening, I got some time. So I dug […]