- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在注册表单中添加了 2 个自定义属性,以收集前端客户的输入。
我的问题是前端注册表单中的数据未存储在数据库中。
我在管理区域中为这些字段输入的任何数据都会被存储,但我需要从客户那里收集信息。这是我的代码:
app/code/local/Symphony/Khaos/sql/khaos_setup/mysql4-upgrade-0.1.12-0.1.13.php(是的,我已经尝试过几次纠正这个问题)次;))
<?php
$installer = $this;
$installer->startSetup();
$installer->addAttribute('customer', 'source', array(
'input' => 'text',
'type' => 'varchar',
'label' => 'Where did you hear about us?',
'visible' => 1,
'required' => 0,
'position' => 1,
'sort_order' => 80,
));
$installer->addAttribute('customer', 'practitioner_referrer', array(
'input' => 'text',
'type' => 'varchar',
'label' => 'Referring practitioner',
'visible' => 1,
'required' => 0,
'position' => 1,
'sort_order' => 80,
));
$installer->endSetup();
$customer = Mage::getModel('customer/attribute')->loadByCode('customer', 'source');
$forms= array('customer_account_edit', 'customer_account_create', 'adminhtml_customer', 'checkout_register');
$customer->setData('used_in_forms', $forms);
$customer->save();
$customer = Mage::getModel('customer/attribute')->loadByCode('customer', 'practitioner_referrer');
$forms= array('customer_account_edit', 'customer_account_create', 'adminhtml_customer', 'checkout_register');
$customer->setData('used_in_forms', $forms);
$customer->save();
app/code/local/Symphony/Khaos/Model/Entity/Setup.php
<?php
class Symphony_Khaos_Model_Entity_Setup extends Mage_Customer_Model_Entity_Setup
{
public function getDefaultEntities(){
return array(
'source'=>array(
'type'=> 'static',
'label'=> 'source',
'visiable' => true,
'required' => false,
'sort_order' => 80,
),
'practitioner_referrer'=>array(
'type'=> 'static',
'label'=> 'practitioner_referrer',
'visiable' => true,
'required' => false,
'sort_order' => 80,
)
);
}
}
app/code/local/Symphony/Khaos/etc/config.xml
<?xml version="1.0"?>
<!--
/**
* @category Symphony
* @package Symphony_Khaos
* @author ModuleCreator
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
-->
<config>
<modules>
<Symphony_Khaos>
<version>0.1.13</version>
</Symphony_Khaos>
</modules>
<frontend>
<routers>
<khaos>
<use>standard</use>
<args>
<module>Symphony_Khaos</module>
<frontName>khaos</frontName>
</args>
</khaos>
</routers>
<layout>
<updates>
<khaos>
<file>khaos.xml</file>
</khaos>
</updates>
</layout>
</frontend>
<admin>
<routers>
<khaos>
<use>admin</use>
<args>
<module>Symphony_Khaos</module>
<frontName>khaos</frontName>
</args>
</khaos>
</routers>
</admin>
<adminhtml>
<menu>
<khaos module="khaos">
<title>Khaos</title>
<sort_order>71</sort_order>
<children>
<items module="khaos">
<title>Manage Items</title>
<sort_order>0</sort_order>
<action>khaos/adminhtml_khaos</action>
</items>
</children>
</khaos>
</menu>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<Symphony_Khaos>
<title>Khaos Module</title>
<sort_order>10</sort_order>
</Symphony_Khaos>
</children>
</admin>
</resources>
</acl>
<layout>
<updates>
<khaos>
<file>khaos.xml</file>
</khaos>
</updates>
</layout>
</adminhtml>
<global>
<models>
<khaos>
<class>Symphony_Khaos_Model</class>
<resourceModel>khaos_mysql4</resourceModel>
</khaos>
<khaos_mysql4>
<class>Symphony_Khaos_Model_Mysql4</class>
<entities>
<khaos>
<table>khaos</table>
</khaos>
</entities>
</khaos_mysql4>
</models>
<resources>
<khaos_setup>
<setup>
<module>Symphony_Khaos</module>
<class>Symphony_Khaos_Model_Entity_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</khaos_setup>
<khaos_write>
<connection>
<use>core_write</use>
</connection>
</khaos_write>
<khaos_read>
<connection>
<use>core_read</use>
</connection>
</khaos_read>
</resources>
<blocks>
<khaos>
<class>Symphony_Khaos_Block</class>
</khaos>
</blocks>
<helpers>
<khaos>
<class>Symphony_Khaos_Helper</class>
</khaos>
</helpers>
<fieldsets>
<customer_account>
<source><create>1</create><update>1</update></source>
<practitioner_referrer><create>1</create><update>1</update></practitioner_referrer>
</customer_account>
</fieldsets>
</global>
</config>
app/design/frontend/metabolics/default/template/persistent/checkout/onepage/billing.phtml
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category design
* @package base_default
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
/** @var Mage_Checkout_Block_Onepage_Billing $this */
?>
<form id="co-billing-form" action="">
<fieldset>
<ul class="form-list">
<?php if ($this->customerHasAddresses()): ?>
<li class="wide">
<label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
<div class="input-box">
<?php echo $this->getAddressesHtmlSelect('billing') ?>
</div>
</li>
<?php endif; ?>
<li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
<fieldset>
<input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
<ul>
<li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
<li class="fields">
<div class="field">
<label for="billing:company"><?php echo $this->__('Company') ?></label>
<div class="input-box">
<input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
</div>
</div>
<?php if(!$this->isCustomerLoggedIn()): ?>
<div class="field">
<label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
<div class="input-box">
<input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
</div>
</div>
<?php endif; ?>
</li>
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
<li class="wide">
<label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
<div class="input-box">
<input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
</div>
</li>
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
<li class="wide">
<div class="input-box">
<input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
</div>
</li>
<?php endfor; ?>
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
<li class="wide">
<label for="billing:vat_id"><?php echo $this->__('VAT Number') ?></label>
<div class="input-box">
<input type="text" id="billing:vat_id" name="billing[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->__('VAT Number') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
</div>
</li>
<?php endif; ?>
<li class="fields">
<div class="field">
<label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
<div class="input-box">
<input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
</div>
</div>
<div class="field">
<label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
<div class="input-box">
<select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
</select>
<script type="text/javascript">
//<![CDATA[
$('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
//]]>
</script>
<input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
</div>
</div>
</li>
<li class="fields">
<div class="field">
<label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
<div class="input-box">
<input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
</div>
</div>
<div class="field">
<label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
<div class="input-box">
<?php echo $this->getCountryHtmlSelect('billing') ?>
</div>
</div>
</li>
<li class="fields">
<div class="field">
<label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
<div class="input-box">
<input type="text" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="billing:telephone" />
</div>
</div>
<div class="field">
<label for="billing:fax"><?php echo $this->__('Fax') ?></label>
<div class="input-box">
<input type="text" name="billing[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="billing:fax" />
</div>
</div>
</li>
<?php if(!$this->isCustomerLoggedIn()): ?>
<?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
<?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
<?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
<li class="fields">
<?php if ($_dob->isEnabled()): ?>
<div class="field">
<?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
</div>
<?php endif; ?>
<?php if ($_gender->isEnabled()): ?>
<div class="field">
<?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
</div>
<?php endif ?>
</li>
<?php endif ?>
<?php if ($this->isTaxvatEnabled()):?>
<li><?php echo $this->getTaxvatHtml() ?></li>
<?php endif; ?>
<div class="fieldset">
<ul class="form-list">
<li class="fields">
<div class="field">
<label for="source" class="required"><em>*</em><?php echo $this->__('Where did you hear about us?') ?></label>
<div class="input-box">
<input type="text" name="source" id="source" title="<?php echo $this->__('source') ?>" class="input-text required-entry" />
</div>
</div>
<div class="field">
<label for="practitioner_referrer"><?php echo $this->__('Were you referrered by a practitioner, if so, who?') ?></label>
<div class="input-box">
<input type="text" name="practitioner_referrer" id="practitioner_referrer" title="<?php echo $this->__('practitioner_referrer') ?>" class="input-text" />
</div>
</div>
</li>
</ul>
</div>
<li class="fields" id="register-customer-password">
<div class="field">
<label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
<div class="input-box">
<input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
</div>
</div>
<div class="field">
<label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
<div class="input-box">
<input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
</div>
</div>
</li>
<?php echo $this->getChildHtml('persistent.remember.me'); ?>
<?php endif; ?>
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
<li class="control">
<input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
</li>
<?php else:?>
<li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
<?php endif; ?>
<?php echo $this->getChildHtml('form.additional.info'); ?>
</ul>
<?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
</fieldset>
</li>
<?php if ($this->canShip()): ?>
<li class="control">
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to this address') ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label></li>
<li class="control">
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to different address') ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
</li>
<?php endif; ?>
</ul>
<?php if (!$this->canShip()): ?>
<input type="hidden" name="billing[use_for_shipping]" value="1" />
<?php endif; ?>
<div class="buttons-set" id="billing-buttons-container">
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
<button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
<span class="please-wait" id="billing-please-wait" style="display:none;">
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
</span>
</div>
</fieldset>
</form>
<script type="text/javascript">
//<![CDATA[
var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
var billingForm = new VarienForm('co-billing-form');
//billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
$('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
if ($('onepage-guest-register-button')) {
Event.observe($('onepage-guest-register-button'), 'click', function(event) {
var billingRememberMe = $('co-billing-form').select('#remember-me-box');
if (billingRememberMe.length > 0) {
if ($('login:guest') && $('login:guest').checked) {
billingRememberMe[0].hide();
} else if ($('login:register') && ($('login:register').checked || $('login:register').type == 'hidden')) {
billingRememberMe[0].show();
}
}
});
}
//]]>
</script>
非常感谢任何帮助。
亲切的问候,
詹姆斯
最佳答案
您的解决方案很好,它接近可行的解决方案,但它缺少一些最后的润色。
请注意,客户可以通过两种方式进行注册 - 通过“注册”链接或在结帐期间进行注册。您仅提供了结帐流程的模板代码,因此我仅讨论它。 “注册”链接的实现更加简单,并且似乎在上面已经提供的文章中进行了很好的描述:http://www.fontis.com.au/blog/magento/know-more-about-your-customers-adding-custom-signup-attributes
好的,关于结帐。当前解决方案的问题是:
billing[<attribute_name>]
。 让我们来解决这些问题。
模板文件的修复很简单 - 只需重命名输入,它们应该是:
...
<input type="text" name="billing[source]" id="source" title="<?php echo
$this->__('source') ?>" class="input-text required-entry" />
...
<input type="text" name="billing[practitioner_referrer]" id="practitioner_referrer"
title="<?php echo $this->__('practitioner_referrer') ?>" class="input-text" />
...
这将使 Magento 在预期的位置找到输入的数据。
正确的 sql 文件(即mysql4-upgrade-0.1.12-0.1.13.php)应如下所示:
$installer->startSetup();
$installer->getConnection()->addColumn(
$installer->getTable('sales/quote'),
'customer_source',
array(
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
'length' => '64K',
'comment' => 'Customer Source'
)
);
$installer->getConnection()->addColumn(
$installer->getTable('sales/quote'),
'customer_practitioner_referrer',
array(
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
'length' => '64K',
'comment' => 'Customer Practitioner Referrer'
)
);
$installer->addAttribute('customer', 'source', array(
'input' => 'text',
'type' => 'varchar',
'label' => 'Where did you hear about us?',
'visible' => 1,
'required' => 0,
'position' => 1,
'sort_order' => 80
));
$installer->addAttribute('customer', 'practitioner_referrer',
array(
'input' => 'text',
'type' => 'varchar',
'label' => 'Referring practitioner',
'visible' => 1,
'required' => 0,
'position' => 1,
'sort_order' => 80
)
);
$installer->endSetup();
$customer = Mage::getModel('customer/attribute')->loadByCode('customer', 'source');
$forms= array('customer_account_edit', 'customer_account_create', 'adminhtml_customer', 'checkout_register');
$customer->setData('used_in_forms', $forms);
$customer->save();
$customer = Mage::getModel('customer/attribute')->loadByCode('customer', 'practitioner_referrer');
$forms= array('customer_account_edit', 'customer_account_create', 'adminhtml_customer', 'checkout_register');
$customer->setData('used_in_forms', $forms);
$customer->save();
在该文件中,我们不仅创建客户属性,还创建报价表中的相应列,在结帐过程中输入的值将存储在其中。
字段集应包含将客户数据转换为报价数据的规则,反之亦然。这就是 config.xml 的样子:
<?xml version="1.0"?>
<!--
/**
* @category Symphony
* @package Symphony_Khaos
* @author ModuleCreator
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
-->
<config>
<modules>
<Symphony_Khaos>
<version>0.1.13</version>
</Symphony_Khaos>
</modules>
<frontend>
<routers>
<khaos>
<use>standard</use>
<args>
<module>Symphony_Khaos</module>
<frontName>khaos</frontName>
</args>
</khaos>
</routers>
<layout>
<updates>
<khaos>
<file>khaos.xml</file>
</khaos>
</updates>
</layout>
</frontend>
<admin>
<routers>
<khaos>
<use>admin</use>
<args>
<module>Symphony_Khaos</module>
<frontName>khaos</frontName>
</args>
</khaos>
</routers>
</admin>
<adminhtml>
<menu>
<khaos module="khaos">
<title>Khaos</title>
<sort_order>71</sort_order>
<children>
<items module="khaos">
<title>Manage Items</title>
<sort_order>0</sort_order>
<action>khaos/adminhtml_khaos</action>
</items>
</children>
</khaos>
</menu>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<Symphony_Khaos>
<title>Khaos Module</title>
<sort_order>10</sort_order>
</Symphony_Khaos>
</children>
</admin>
</resources>
</acl>
<layout>
<updates>
<khaos>
<file>khaos.xml</file>
</khaos>
</updates>
</layout>
</adminhtml>
<global>
<models>
<khaos>
<class>Symphony_Khaos_Model</class>
<resourceModel>khaos_mysql4</resourceModel>
</khaos>
<khaos_mysql4>
<class>Symphony_Khaos_Model_Mysql4</class>
<entities>
<khaos>
<table>khaos</table>
</khaos>
</entities>
</khaos_mysql4>
</models>
<resources>
<khaos_setup>
<setup>
<module>Symphony_Khaos</module>
<class>Mage_Customer_Model_Entity_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</khaos_setup>
<khaos_write>
<connection>
<use>core_write</use>
</connection>
</khaos_write>
<khaos_read>
<connection>
<use>core_read</use>
</connection>
</khaos_read>
</resources>
<blocks>
<khaos>
<class>Symphony_Khaos_Block</class>
</khaos>
</blocks>
<helpers>
<khaos>
<class>Symphony_Khaos_Helper</class>
</khaos>
</helpers>
<fieldsets>
<customer_account>
<source><to_quote>customer_source</to_quote></source>
<practitioner_referrer><to_quote>customer_practitioner_referrer</to_quote></practitioner_referrer>
</customer_account>
<checkout_onepage_quote>
<customer_source><to_customer>source</to_customer></customer_source>
<customer_practitioner_referrer><to_customer>practitioner_referrer</to_customer></customer_practitioner_referrer>
</checkout_onepage_quote>
</fieldsets>
</global>
</config>
注意两件事:
<create>
和<update>
指令已被删除,因为它们是结帐注册不需要。您可以将它们添加回来,如果你需要它们。 Symphony_Khaos_Model_Entity_Setup
已被删除,取而代之的是 Mage_Customer_Model_Entity_Setup
。这客户设置模型足以完成所有任务。该文件与自定义设置模型可能会被完全删除。您可以退回定制的模型,如果您需要它来执行其他任务。瞧 - 就是这样!这些修复将使客户在结帐注册期间看到两个附加字段。提交订单时,数据将保存到他的个人资料中。
但是,该实现并不是最好的,因为它是基于该方法的,该方法有一些缺点。该方法需要将数据存储在 Quote 表中,而这些数据条目与 Quote 模型无关。他们只是将其用作交通工具。另外,将来添加新属性将需要做太多工作 - 必须对 sql 文件、配置和模板进行修改。
正确的方法是构建一个更抽象的实现。该解决方案应将属性数据存储在 EAV 或自定义表中,并根据需要通过观察到的事件将它们添加到客户/报价模型中。模板应显示属性的通用列表,可能为需要特殊设计的属性提供特殊的渲染模型。
但是对于只有 2 个属性,您的方法就很好。
祝您与 Magento 的进一步合作顺利:)
关于magento - 自定义客户属性未保存到数据库(来自前端注册表单),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13479365/
我尝试根据表单元素的更改禁用/启用保存按钮。但是,当通过弹出按钮选择更改隐藏输入字段值时,保存按钮不受影响。 下面是我的代码。我正在尝试序列化旧的表单值并与更改后的表单值进行比较。但我猜隐藏的字段值无
我正在尝试保存模型的实例,但我得到了 Invalid EmbeddedDocumentField item (1) 其中 1 是项目的 ID(我认为)。 模型定义为 class Graph(Docum
我有一个非常奇怪的问题......在我的 iPhone 应用程序中,用户可以打开相机胶卷中的图像,在我的示例中 1920 x 1080 像素 (72 dpi) 的壁纸。 现在,想要将图像的宽度调整为例
目前,我正在使用具有排序/过滤功能的数据表成功地从我的数据库中显示图像元数据。在我的数据表下方,我使用第三方图像覆盖流( http://www.jacksasylum.eu/ContentFlow/
我的脚本有问题。我想按此顺序执行以下步骤: 1. 保存输入字段中的文本。 2. 删除输入字段中的所有文本。 3. 在输入字段中重新加载之前删除的相同文本。 我的脚本的问题是 ug()- 函数在我的文本
任何人都可以帮助我如何保存多对多关系吗?我有任务,用户可以有很多任务,任务可以有很多用户(多对多),我想要实现的是,在更新表单中,管理员可以将多个用户分配给特定任务。这是通过 html 多选输入来完成
我在 Tensorflow 中训练了一个具有批归一化的模型。我想保存模型并恢复它以供进一步使用。批量归一化是通过 完成的 def batch_norm(input, phase): retur
我遇到了 grails 的问题。我有一个看起来像这样的域: class Book { static belongsTo = Author String toString() { tit
所以我正在开发一个应用程序,一旦用户连接(通过 soundcloud),就会出现以下对象: {userid: userid, username: username, genre: genre, fol
我正在开发一个具有多选项卡布局的 Angular 7 应用程序。每个选项卡都包含一个组件,该组件可以引用其他嵌套组件。 当用户选择一个新的/另一个选项卡时,当前选项卡上显示的组件将被销毁(我不仅仅是隐
我尝试使用 JEditorPane 进行一些简单的文本格式化,但随着知识的增长,我发现 JTextPane 更容易实现并且更强大。 我的问题是如何将 JTextPane 中的格式化文本保存到文件?它应
使用 Docker 相当新。 我为 Oracle 11g Full 提取了一个图像。创建了一个数据库并将应用程序安装到容器中。 正确配置后,我提交了生成 15GB 镜像的容器。 测试了该图像的新容器,
我是使用 Xcode 和 swift 的新手,仍在学习中。我在将核心数据从实体传递到文本字段/标签时遇到问题,然后用户可以选择编辑和保存记录。我的目标是,当用户从 friendslistViewCon
我正在用 Java 编写 Android 游戏,我需要一种可靠的方法来快速保存和加载应用程序状态。这个问题似乎适用于大多数 OO 语言。 了解我需要保存的内容:我正在使用策略模式来控制我的游戏实体。我
我想知道使用 fstream 加载/保存某种结构类型的数组是否是个好主意。注意,我说的是加载/保存到二进制文件。我应该加载/保存独立变量,例如 int、float、boolean 而不是结构吗?我这么
我希望能够将 QNetworkReply 保存到 QString/QByteArray。在我看到的示例中,它们总是将流保存到另一个文件。 目前我的代码看起来像这样,我从主机那里得到一个字符串,我想做的
我正在创建一个绘图应用程序。我有一个带有 Canvas 的自定义 View ,它根据用户输入绘制线条: class Line { float startX, startY, stopX, stop
我有 3 个 Activity 第一个 Activity 调用第二个 Activity ,第二个 Activity 调用第三个 Activity 。 第二个 Activity 使用第一个 Activi
我想知道如何在 Xcode 中保存 cookie。我想使用从一个网页获取的 cookie 并使用它访问另一个网页。我使用下面的代码登录该网站,我想保存从该连接获得的 cookie,以便在我建立另一个连
我有一个 SQLite 数据库存储我的所有日历事件,建模如下: TimerEvent *Attributes -date -dateForMark -reminder *Relat
我是一名优秀的程序员,十分优秀!