OSd*_*ave 4 attributes magento quote
我正在开发自定义忠诚度积分模块.在结账时,客户可以选择兑换积分.
在模块设置中,我创建了一个redeem_points eav_attribute(它出现在eav_attribute表中),我已经将这个属性添加到了引用中,好吧,有点......
我是这样做的:
在Namespace_Module_Model_Resource_Eav_Mysql4_Setup(扩展Mage_Eav_Model_Entity_Setup)中,只有一个方法公共函数getDefaultEntities()只返回一个包含(除其他外)的数组:
'quote' => array(
'entity_model' => 'sales/quote',
'table' => 'sales/quote',
'attributes' => array(
'redeemed_points' => array('type' => 'static')
),
),
Run Code Online (Sandbox Code Playgroud)再次在mysql4-install-0.1.0.php中我在sales_flat_quote表中创建了这个列,就像这样
//add redeemed_points to quote table
$installer->getConnection()->addColumn($installer->getTable('sales/quote'), 'redeemed_points', 'bigint(20)');
$installer->addAttribute('quote', 'redeemed_points', array('type'=>'static'));
Run Code Online (Sandbox Code Playgroud)在结帐时,当我兑换积分时,我的类中扩展Mage_Checkout_Model_Type_Onepage的方法savePoints($ data)被调用:
public function savePoints($data)
{
//save data
if ($data == 1) {
$redeemedPoints = Mage::helper('points')->getRedeemablePoints();
$this->getQuote()->setRedeemedPoints($redeemedPoints['points']);
} else {
$this->getQuote()->setRedeemedPoints(0);
}
$this->getQuote()->collectTotals()->save();
$this->getCheckout()
->setStepData('points', 'complete', true);
if ($this->getQuote()->isVirtual()) {
$this->getCheckout()->setStepData('payment', 'allow', true);
} else {
$this->getCheckout()->setStepData('shipping_method', 'allow', true);
}
Mage::helper('firephp')->debug($this->getQuote()->debug());
return array();
}
Run Code Online (Sandbox Code Playgroud)
您会注意到我在firephp中调试了quote对象:此时(在checkout的这一步中,只需将其保存到引号中)我可以看到redeemed_points属性,其值正确.
我的问题是,在下一步中,这个属性从引用对象中消失了:(
所以我理解我还没有设法在引用对象中包含我的redeemed_points属性,但我真的不知道我缺少什么. ..
任何人都可以吗?
尝试手动删除var/cache/*.数据库模式缓存在那里,有时Magento不会拿起你的新表列,即使它们在那里.此外,通过在后端使用清除缓存功能似乎无法清除,但只能手动删除目录中的所有内容.
| 归档时间: |
|
| 查看次数: |
11478 次 |
| 最近记录: |