1 首先我们找到自己的 form参数。
在magento\app\code\community\Asiapay\Pdcptb\Model\Pdcptb.php 的 getCheckoutFormFields()中。
$fields = array(
'version' =>'VER000000001',
'charSet' =>'UTF-8',
'transType' =>'PURC',
'orderNum' =>$orderReferenceValue,
'orderAmount' =>'000000000001',
'orderCurrency' =>'CNY',
'merReserve' =>'TEST',
'frontURL' =>Mage::getUrl('pdcptb/pdcptb/success'),
'backURL' =>Mage::getUrl('pdcptb/pdcptb/success'),
'merID' =>'000000000000015',
'acqID' =>'00000000',
'paymentSchema' =>'CP',
'transTime' =>'20130910102933',
'signType' =>'MD5',
'signature'=>$md5
);
运行的时候发现 发现有个 <input name="form_key" type="hidden" value="TXi0vgLAzYEKQUJW" /> 打印出来了,
所以和MD5加密的接受到的加密参数不一样。
那么 我们读源码 发现。
magento\lib\Varien\Data\Form.php 中的 toHtml() 方法
public function toHtml()
{
Varien_Profiler::start('form/toHtml');
$html = '';
if ($useContainer = $this->getUseContainer()) {
$html .= '<form '.$this->serialize($this->getHtmlAttributes()).'>';
$html .= '<div>';
if (strtolower($this->getData('method')) == 'post') {
$html .= '<input name="form_key" type="hidden" value="'.Mage::getSingleton('core/session')->getFormKey().'" />';
}
$html .= '</div>';
}
foreach ($this->getElements() as $element) {
$html.= $element->toHtml();
}
if ($useContainer) {
$html.= '</form>';
}
Varien_Profiler::stop('form/toHtml');
return $html;
}
那么源码找到了。怎么改就看自己啦!!!