我需要在语法上用magento success.phtml调用发票号和客户电子邮件。
我需要这个用于预先填充的电子邮件,以便重新销售退出调查代码。
<link rel="stylesheet" href="https://www.resellerratings.com/images
/js/dhtml_survey.css" type="text/css" />
<script type="text/javascript">
seller_id = XXXX;
inv = "B5000";
email_pass = "customer@someplace.com";
document.write('<'+ 'script type="text/javascript" src="https://www.resellerratings.com/images/js/popup_include.js"><\/script>');
</script>
我知道如何调用订单ID和Grandtotal:
$order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
$amount = number_format($order->getGrandTotal(),2);
我在magento论坛的某个地方找到了这个代码,但不知道如何调出发票号码和客户电子邮件以进行转售。请帮帮我。
此致 乔恩
答案 0 :(得分:1)
$customer = Mage::getSingleton('customer/session')->getCustomer();
您需要有关当前客户的大量数据。
回复:开具发票:您是否在下订单时生成发票?
订单可以包含多个发票和多个发票ID。
查看此帖子,了解如何获取发票ID的示例:http://www.magentocommerce.com/boards/viewthread/198222/#t313532
答案 1 :(得分:1)
首先,在模块config.xml /your_module/etc/config.xml中添加一个事件观察者代码,
<global>
<events>
<sales_order_invoice_save_after>
<observers>
<your_module>
<type>singleton</type>
<class>your_module/observer</class>
<method>sales_order_invoice_save_after</method>
</your_module>
</observers>
</sales_order_invoice_save_after>
</events>
</global>
然后,在Observer.php
/your_module/model/Observer.php
Class NameSpace_Module_Model_Observer()
{
public function sales_order_invoice_save_after($observer)
// here should be save_after because invoice id not available until the object has been saved that means an order
{
$invoice = $observer->getEvent()->getInvoice();
// to see what variables available in $invoice, use the following
// echo "<pre>"; print_r($invoice->getData()); exit;
}
}