保存客户之前的数据
我为客户制作了一个带有计算器的页面,他们可以在不登录的情况下使用它,该页面中有一个保存按钮,我想做的是:如果客户单击保存并且未登录,将重定向到注册表,如果用户注册成功,我需要将他在计算器中写入的数据保存到他的帐户中,然后再次重定向到计算器。我他向客户添加了新属性
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('customer', 'weight', array(
'label'=> 'Weight',
'type'=> 'decimal',
'input'=> 'text',
'visible'=> true,
'required'=> false,
));
$setup->addAttribute('customer', 'Height', array(
'label'=> 'Height',
'type'=> 'decimal',
'input'=> 'text',
'visible'=> true,
'required'=> false,
'position'=> 1,
));
如果我运行此代码,它可以工作,因为我可以看到数据库中的值
$session = Mage::getSingleton('customer/session');
$customer = $session->getCustomer();
$customer->setWeight(80);
$customer->save();
但我的问题是如何收集计算器的所有数据
i've made a page with a calculator for customer, they can use it without being logged in, there is a save button in that page, what i'm trying to do is: if a customer click save and it is not logged in, will be redirect to the register form, and if the user successfully register, i need to save the data he wrote in the calculator to his account and redirect to the calculator again. I'he added the new attributes to the customer
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('customer', 'weight', array(
'label'=> 'Weight',
'type'=> 'decimal',
'input'=> 'text',
'visible'=> true,
'required'=> false,
));
$setup->addAttribute('customer', 'Height', array(
'label'=> 'Height',
'type'=> 'decimal',
'input'=> 'text',
'visible'=> true,
'required'=> false,
'position'=> 1,
));
And if i run this code, it work cuz i can see the value in the database
$session = Mage::getSingleton('customer/session');
$customer = $session->getCustomer();
$customer->setWeight(80);
$customer->save();
But my problem is how i collect all the data of the calculator
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过几个小时的编码后,我将回答我自己的问题,如果有人可以纠正我,我将不胜感激......
所以,我做了什么:
现在,在 createPostAction 中我添加了它
,它可以正常工作...无论如何感谢所有阅读我的问题的人
after a few hours coding, i'm gonna answer my own question, if someone can correct me i'll be thankfull...
so, what i did:
now, in the createPostAction i add this
it work ok...thanks anyway to everyone who read my qestion