你也许可以做到这一点使用事件/观察者,但我会做到这一点的方法是使用自定义的付款方式,基本上重复定单
见/应用/代码/核心/法师/支付/型号/法/Purchaseorder.php
class Mage_Payment_Model_Method_Purchaseorder extends Mage_Payment_Model_Method_Abstract
{
.....
/**
* Validate payment method information object
*
* @return Mage_Payment_Model_Abstract
*/
public function validate()
{
$paymentInfo = $this->getInfoInstance();
validate customer password there
if($paymentInfo->getOrder()->getCustomerId()){
//see login() in /app/code/core/Mage/Customer/Model/Session.php
$customer = Mage::getModel('customer/customer')
->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
//May need to change to the order store id and not Mage::app()->getStore()->getWebsiteId()
//get password enter on PO screen
$password = $paymentInfo->getPassword()
if ($customer->authenticate($paymentInfo->getOrder()->getCustomerEmail(), $password)) {
return true;
}
return false;
}
else{
//customer not login
return false;
}
/**
* to validate payment method is allowed for billing country or not
*/
if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
$billingCountry = $paymentInfo->getOrder()->getBillingAddress()->getCountryId();
} else {
$billingCountry = $paymentInfo->getQuote()->getBillingAddress()->getCountryId();
}
if (!$this->canUseForCountry($billingCountry)) {
Mage::throwException(Mage::helper('payment')->__('Selected payment type is not allowed for billing country.'));
}
return $this;
}
/**
* Assign data to info model instance
*
* @param mixed $data
* @return Mage_Payment_Model_Method_Purchaseorder
*/
public function assignData($data)
{
if (!($data instanceof Varien_Object)) {
$data = new Varien_Object($data);
}
$this->getInfoInstance()->setPoNumber($data->getPoNumber());
$this->getInfoInstance()->setPassword($data->getPassword());
return $this;
}
}
看看@How to create a payment method
不在话下这里...但是你尝试过什么? – 2013-02-26 15:11:24
嗨,我很新 - 只是寻找解决方案,以确定最好的 - 寻找可能做过类似的人的指导? – Marc 2013-02-26 15:13:43