magento以编程方式添加price属性不保存小数

eye*_*onu 1 magento magento-1.7

我已经以编程方式添加了price属性,它到目前为止工作但是无法保存带小数的价格.

例如,如果我在保存产品后在后端输入99.99,则filialpreis为99.00如果我手动添加属性,一切都像预期的那样工作.

有没有人知道我必须做什么才能使它与编程添加的价格属性一起工作?

<?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();
Run Code Online (Sandbox Code Playgroud)

use*_*108 8

试试'小数'?

ps缺乏评论的声誉,所以这成了答案>.>