有人可以帮忙吗?
我创建了一个带有 2 个自定义字段的新模块,所有似乎都工作正常,接受其中一个字段不会通过单页结帐过程保存到数据库?
我可以通过注册页面(register.phtml)输入数据并通过编辑帐户页面(edit.phtml)编辑数据,这一切都可以保存到数据库。
其中一个字段是从模型/实体获取选项的选择字段,此字段保存正常,两个字段在 config.xml 文件中具有相同的条目。
我在 billing.phtml 中尝试了各种版本的输入
<?php if(!$this->isCustomerLoggedIn()): ?>
<li>
<label for="billing:childname" class="required"><em>*</em>
<?php echo $this->__('Childs Name') ?>
</label>
<div class="input-box">
<input type="text" name="billing[childname]" id="billing:childname"
value="<?php echo $this->htmlEscape($this->getQuote()->getCustomerChildname()) ?>"
title="<?php echo $this->__('Childs Name') ?>"
class="input-text validate-text required-entry" />
</div>
</li>
还有: value="htmlEscape($this->getCustomer()->getChildname()) ?>"
但我尝试的任何方法似乎都不起作用,任何想法都出问题了??
非常感谢
最佳答案
为了将您的“childname”属性保存在数据库中,我们需要首先将此值保存在“sales_flat_quote”表中。
请按照步骤将字段保存到数据库中。
第 1 步:通过运行以下查询在 sales_flat_quote
中添加新列。
ALTER TABLE `sales_flat_quote` ADD `customer_childname` INT NOT NULL
第2步:现在转到您的模块config.xml
文件并将fieldsets
代码粘贴到全局 block 中(如果您没有自己的)模块然后将其粘贴到任何其他模块中。
<global>
//.....................
<fieldsets>
<checkout_onepage_quote>
<customer_childname>
<to_customer>childname</to_customer>
</customer_childname>
</checkout_onepage_quote>
<customer_account>
<childname>
<to_quote>customer_childname</to_quote>
</childname>
</customer_account>
</fieldsets>
//......................
</global>
现在检查一下:)
关于mysql - 自定义属性字段在单页结帐 Magento 1.6 期间未保存到数据库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8666187/