The script mentioned previously is here:
It’ll tell you whether your configurable attributes are set sensibly based on how many values there are. Note it assumes size and color as attributes you care about – you can change that on line 38 if you want.
So I was writing a script to check the integrity of configurable products on a couple of sites – it appeared that the attributes on some products didn’t match the actual set of child products available, so you had weird results like dropdowns with 1 color available.
It worked okay on a site with 250 active configurable products, but ran out of memory quickly on a site with 1000. What was going on?
It turns out that this line:
$attributes = $product->getTypeInstance()->getConfigurableAttributesAsArray($product);
consumed 0.5-2MB of memory for each product – what’s happening is that the Configurable type singleton is storing the configurable attribute data on the $product that we pass into that method, in order to reuse it later. If we’re not planning on doing anything else with that product (eg it’s from a collection we’re looping through), this is just wasted.
To remove all the stuff the above method adds to the product,
The obligatory first post! It’ll be a mix of:
– software, particularly php, magento, and wordpress
– games in all their variety