browse the blogs

[ 23 Jan 2015 ]

Where Magento Connect **does** Check for Permissions:

Magento Connect, File Permissions, and myself have a rocky, inconsistent relationship. This one’s the opposite of my usual complaints — if Connect’s saying it can’t install itself due to file file permissions errors, here’s where to check which directories it thinks it can’t write to.

[ 26 Dec 2014 ]

Magento Sellers Guide to Sales Tax:

A relatively straight forward article about how to collect sales tax for an ecommerce business. It’s remarkable how much hand waving there is about this from agencies representing themselves as ecommerce experts.

[ 23 Dec 2014 ]

If Magento 2 is your first introduction to PHP namespaces, here’s one small thought technology that might help. Consider the following

namespace Foo\Baz;
class Bar {
}

The above does not define a class named Bar. It defines a class named “Foo\Baz\Bar”. That’s how PHP sees the class internally, and once you start thinking about classes the same way PHP does, they start making more sense, (or, at least, they did for me)

[ 21 Dec 2014 ]

If you’re trying to use the browser setup workflow in the Magento 2 beta released in December of 2014, make sure your web server is using the index.php in the root of the project and not the pub/index.php file.

It’s unclear which index.php is “the right” file to point to — the pub folder seems to be an attempt to adopt a more modern, Symfony like approach that keeps your code and your web serve-able file separate, but the root level index.php seems like an affordance for developers used to Magento’s traditional structure.

[ 21 Dec 2014 ]

If you’re using Vagrant to manage your Magento 2 installations, you’ll want to be careful with file permissions. By default, it appears that Vagrant’s synced folder setup won’t allow the apache/web user to create folders with permissions elevated higher than the default sync share.

Dropping in some custom mount options should fix this up, and while 0666 and 0777 aren’t ideal, that seems to be world we live in nowadays.

[ 21 Dec 2014 ]

Magento 2 Profiler:

There’s still a lot of work to be done before Magento 2 is ready for general release, and a lot of that work will involve performance tuning. The old UI for enabling/disabling the built in profiler is gone, but this Stack Exchange answer from Marko Martinović tells you how to enable it. (a MAGE_PROFILER server environment variable with values of html, csv, etc)

[ 20 Dec 2014 ]

Two Vagrant boxes for the newly released Magento 2 beta.

The first is maintained by Rolando Granadino (beeplogic to Twitter folks), and is a fully featured opinionated box, with puppet provisioning, web grind for xDebug profiling, and git submodules for project dependencies.

The second is a lightweight affair from Alan Kent, Magento 2’s current lead architect.

If you’re never used Vagrant before, it’s a program for managing and creating virtual machines from the command line. If you’ve never used virtual machines before, they’re a way to “run” another computer operating system from your main computer operating system. Two virtual computers on one physical machine. Using virtual linux machines is a popular way to manage different software stacks. …

[ 17 Jul 2014 ]

Configuration Gaslighting Checklist:

A quick Stack Overflow answer from yours truly that covers what to do when you think Magneto’s gaslighting you on configuration values you’re sure you’ve changed.

[ 16 Jul 2014 ]

I needed to grab a few category names when all I had were the category IDs

$categories = Mage::getModel('catalog/category')->getCollection()
->addAttributeToSelect('name')
->addFieldToFilter('category_id', array('in'=>$product['category_ids']));

Can you spot the error? PHP complained with the following error

Fatal error: Call to a member function getBackend() on a non-object in /Users/alanstorm/Sites2014/magento-1-9-0-0.dev/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 816

Can you spot the error now? Unless you happen to be working on a project where you’re deep inside Magento’s EAV implementation, the above error message is worse than useless when it comes to tracking down the actual error.

The problem was I used category_id — and a Magento category object has no such field. I should have used entity_id. Easy brain fart — made easier in that Magento doesn’t stick to the …

[ 13 Jul 2014 ]

In a stock Magento system, there’s several tables where a row will have an ID field of 0.

mysql> select * from core_store\G:
*************************** 1. row ***************************
  store_id: 0
      code: admin
website_id: 0
  group_id: 0
      name: Admin
sort_order: 0
 is_active: 1
*************************** 2. row ***************************
  store_id: 1
      code: default
website_id: 1
  group_id: 1
      name: Default Store View
sort_order: 0
 is_active: 1

In turn, there are times where the Magento application will assume these 0 ID rows exist. For example, a store ID of 0 is always interpreted as the admin store object.

In day to day operations this is no big deal — however MySQL …