Find and reference standard attribute types in Akeneo code

All standard attribute types available in Akeneo are listed in “\Akeneo\Pim\Structure\Component\AttributeTypes” (File: src/Akeneo/Pim/Structure/Component/AttributeTypes.php). <?php namespace Akeneo\Pim\Structure\Component; /** * Attribute types dictionary * * @author Willy Mesnage <willy.mesnage@akeneo.com> * @copyright 2015 Akeneo SAS (http://www.akeneo.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ final class AttributeTypes { const BOOLEAN = ‘pim_catalog_boolean’; const DATE = ‘pim_catalog_date’; const […]

Get all attribute options

To get all attribute options from a Magento dropdown attribute (select field) you can use the following snippet: <?php $oAttibute = Mage::getModel(‘eav/config’)->getAttribute(Mage_Catalog_Model_Product::ENTITY, ‘sheldon_special’); $aOptions = $oAttibute->getSource()->getAllOptions(); var_dump($aOptions); That gives you an array like that: <?php $aOptions = {array} [6] 0 = {array} [2] label = “” value = “” 1 = {array} [2] label = […]

Load product attributes more performant

Recently I had performance issues when importing several ten tausend products. The problem was, that I always used the “normal” product entity model to load attribute values. The following snippet shows, how to load product attributes directly instead. Therefore I use the product resource singleton. <?php $iProductId = $aChange[‘pid’]; $oItem = new Varien_Object; /** * […]