应用程序/代码/本地/ ICLP / Orderattribute的/ etc / config.xml中
<?xml version="1.0"?>
<config>
<modules>
<Iclp_Orderattribute>
<version>0.1.0</version>
</Iclp_Orderattribute>
</modules>
<global>
<helpers>
<orderattribute>
<class>Iclp_Orderattribute_Helper</class>
</orderattribute>
</helpers>
<models>
<orderattribute>
<class>Iclp_Orderattribute_Model</class>
<resourceModel>orderattribute_mysql4</resourceModel>
</orderattribute>
</models>
<resources>
<salesattribute1422420996_setup>
<setup>
<module>Iclp_Orderattribute</module>
<class>Mage_Sales_Model_Mysql4_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</salesattribute1422420996_setup>
<salesattribute1422420996_write>
<connection>
<use>core_write</use>
</connection>
</salesattribute1422420996_write>
<salesattribute1422420996_read>
<connection>
<use>core_read</use>
</connection>
</salesattribute1422420996_read>
</resources>
<events>
<checkout_type_onepage_save_order> <!-- identifier of the event we want to catch -->
<observers>
<checkout_type_onepage_save_order_handler> <!-- identifier of the event handler -->
<type>model</type> <!-- class method call type; valid are model, object and singleton -->
<class>orderattribute/observer</class> <!-- observers class alias -->
<method>getorderattribute</method> <!-- observer's method to be called -->
<args></args> <!-- additional arguments passed to observer -->
</checkout_type_onepage_save_order_handler>
</observers>
</checkout_type_onepage_save_order>
</events>
</global>
</config>
应用程序/代码/本地/ ICLP / Orderattribute /型号/ Observer.php
<?php
class Iclp_Orderattribute_Model_Observer
{
public function getorderattribute(Varien_Event_Observer $observer)
{
$event = $observer->getEvent();
$order = $event->getOrder();
$fieldVal = Mage::app()->getFrontController()->getRequest()->getParams();
$order->setOrder_Attribute($fieldVal['order_attribute']);
// echo "success" ;
}
}
应用程序/代码/本地/ ICLP / Orderattribute / SQL / salesattribute1422420996_setup / mysql4安装-0.1.0.php
<?php
$installer = $this;
$installer->startSetup();
$installer->addAttribute("order", "order_attribute", array("type"=>"varchar"));
$installer->endSetup();
模板/持久性/结帐/ onepage / billing.phtml
<form id="co-billing-form" action="">
<input id = "order_attribute" name="order_attribute" value= " order_attribute order_attribute " class="input-text" type=”text”>
答案 0 :(得分:0)
您的自定义属性是否已使用您指定的值保存在数据库中?
如果是,则在观察者中加载订单ID或增量ID的订单,然后尝试获取自定义属性。