Magento Attributes: Set default in pull-down menu (hack)

In Magento, if you’re using a pull-down attribute that needs to be set to default instead of the “Choose option…” default automatically provided by Magento, you are theoretically supposed to be able to set it from within the Admin portal by using Catalog > Attributes > Manage Attributes.  Unfortunately, it looks like there is a bug that isn’t allowing you to do that.

To fix this, open up the JavaScript file /js/varien/product.js and change line 356 from var index=1; to  var index=0;

This will force Magento to pay notice to your preferred default in the pull-down rather than displaying “Choose option…” and forcing the user to select something.

Caveat: If you are using more than one custom pull-down/drop-down attribute, you’ll probably screw some stuff up.

HTML Displaying With Price In Magento 1.4.x

After upgrading to Magento 1.4.x, you may notice “<span>…</span>” HTML tag being displayed around price information within the “Additional Information” section on product pages.  This is a known bug introduced in the most recent releases of Magento.  While it will probably be fixed in the next release, who wants to wait around for that?

To fix this bug, fire up your text editor and open /app/code/core/Mage/Catalog/Helper/Output.php, then add the following to the end of the “If” statement on line 106 (Magento 1.4.0) or line 123 in later versions:

 && ($attribute->getFrontendInput() != 'price')

This will ensure that the <span> disappears.  Now back to work.

HOWTO: Fix “Fatal error: Call to a member function toHtml() on a non-object in * on line 529″ on Magento

After upgrading to Magento v1.4.1 I was treated to the following, nasty PHP error:

Fatal error: Call to a member function toHtml()
on a non-object in * on line 529

As with most things, I’m sure others are having this problem, but fortunately the solution is easy.  Just update the file app/design/frontend/base/default/layout/page.xml by adding the tag name=”core_profiler” to the HTML element <block type=”core/profiler” output=”toHtml”/>.

The line should now look like this:
<block type=”core/profiler” output=”toHtml” name=”core_profiler”/>

Hope this helps you out.  Cheers!