Magento Questions 获取客户详细信息,onepage/checkout/success 不发送电子邮件
如何获取客户数据,以便我可以将其传递给网关支付。
这是我的模型:
public function getStandardCheckoutFormFields() {
$orderIncrementId = $this->getCheckout()->getLastRealOrderId();
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
//$order = $this->get_sale_order($orderIncrementId);
echo Mage::getModel('customer/customer')->load($orderIncrementId);
$productArray = array();
foreach ($order->getAllItems() as $item) {
$productArray[] = array(
"product_name" => $item->getName(),
"product_qty" => $item->getQtyOrdered(),
"product_price" => $item->getPrice(),
);
}
return $productArray;
}
这是我的控制器:
public function redirectAction(){
$session = Mage::getSingleton('checkout/session');
$session->setAsurepayCustompayQuoteId($session->getQuoteId());
$this->getResponse()->setBody($this->getLayout()->createBlock('custompay/redirect')->toHtml());
$session->unsQuoteId();
$session->unsRedirectUrl();
}
这正在完美运行,问题是我无法获取客户详细信息,例如客户名称、地址等。
我已经尝试过此代码
Mage::getSingleton(customer/customer)->getData();
有结果但不打印。
在结账页面成功(onepage)。当客户重定向至此处时,不会向客户发送电子邮件,并且订单不会更新为已完成。
How to get customers data so i can pass it to a gateway payment.
Here is my model:
public function getStandardCheckoutFormFields() {
$orderIncrementId = $this->getCheckout()->getLastRealOrderId();
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
//$order = $this->get_sale_order($orderIncrementId);
echo Mage::getModel('customer/customer')->load($orderIncrementId);
$productArray = array();
foreach ($order->getAllItems() as $item) {
$productArray[] = array(
"product_name" => $item->getName(),
"product_qty" => $item->getQtyOrdered(),
"product_price" => $item->getPrice(),
);
}
return $productArray;
}
here is my controller:
public function redirectAction(){
$session = Mage::getSingleton('checkout/session');
$session->setAsurepayCustompayQuoteId($session->getQuoteId());
$this->getResponse()->setBody($this->getLayout()->createBlock('custompay/redirect')->toHtml());
$session->unsQuoteId();
$session->unsRedirectUrl();
}
This are running perfectly running, the problem is i can't get customer details such as customer name, address and etc.
I already tried this code
Mage::getSingleton(customer/customer)->getData();
There was a result but not printing.
In the checkout page success (onepage). When customer redirected here, There is no email will be send to the customer and the order was not update as completed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在尝试加载具有属于该订单的 ID 的客户。这显然行不通!您需要从订单中提取
customer_id
并基于此加载客户模型。您还使用了
Mage::getSingleton
这是错误的调用。您需要一个针对特定客户定制的新实例,而不是该类的单个允许实例。You're trying to load a customer with an id that belongs to the order. This obviously doesn't work! You need to extract the
customer_id
from the order and load the customer model based on that.You're also using
Mage::getSingleton
which is the wrong call. You want a new instance tailored to a specific customer, not the single permissible instance of the class.