I have added a price attribute programmatically, it works so far but it is not possible to save a price with decimals.

E.g. if I enter 99.99 in the backend after saving the product the filialpreis is 99.00 If I add the attribute manualy everything works like expected.

Does anyone know what I have to do to make it work also with a programmatically added price attribute?

<?php

/** @var $installer My_DBSetup_Model_Resource_Setup */
$installer = $this;
$installer->startSetup();

//NJ add product attributes
$attributeId = $installer->getAttributeId('catalog_product','my_filialpreis');
if($attributeId){
    $installer->removeAttribute('catalog_product',$attributeId);
}

$installer->addAttribute('catalog_product', 'my_filialpreis', array(
        'input'                     =>  'price',
        'type'                      =>  'int',
        'user_defined'              =>  true,
        'label'                     =>  'Filialpreis',
        'scope'                     =>  Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
        'visible'                   =>  false,
        'is_required'               =>  '0',
        'is_comparable'             =>  '0',
        'is_searchable'             =>  '0',
        'is_unique'                 =>  '0',
        'is_configurable'           =>  '0',
        'unique'                    =>  false,
        'used_in_product_listing'   =>  false,
        'required'                  =>  false,
        'searchable'                =>  false,
        'comparable'                =>  false,
        'visible_on_front'          =>  false,
    )
);
$installer->updateAttribute('catalog_product', 'my_filialpreis', 'apply_to', 'configurable,simple,grouped,bundle,virtual,downloadable');

//NJ add attribute Id to Attribute Set
$installer->addAttributeToSet('catalog_product','Default','Price','my_filialpreis');


//NJ add attribute Id to Attribute Group (the tab in the backen Produktpage)
$installer->addAttributeToGroup('catalog_product','Default','Prices','my_filialpreis');


$installer->endSetup();
有帮助吗?

解决方案

Try 'decimal'?

p.s. lacking reputation for comment, so this became an answer instead >.>

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top