Magento 提交Paypal 表单数据组织函数

本主题由 hgta 创建于 2010-5-21 17:00:18


/**
* Prepare line items request
*
* @param array &$request
* @param int $i
*/
protected function _exportLineItems(array &$request, $i = 0)
{
$items = $this->getLineItems();
if (empty($items)) {
return;
}
// line items
foreach ($items as $item) {
foreach ($this->_lineItemExportItemsFormat as $publicKey => $privateFormat) {
$value = $item->getDataUsingMethod($publicKey);
if (is_float($value)) {
$value = $this->_filterAmount($value);
}
$request[sprintf($privateFormat, $i)] = $value;
}
$i++;
}
// line item totals
$lineItemTotals = $this->getLineItemTotals();
if ($lineItemTotals) {
$request = Varien_Object_Mapper::accumulateByMap($lineItemTotals, $request, $this->_lineItemExportTotals);
foreach ($this->_lineItemExportTotals as $privateKey) {
if (isset($request[$privateKey])) {
$request[$privateKey] = $this->_filterAmount($request[$privateKey]);
} else {
Mage::logException(new Exception(sprintf('Missing index "%s" for line item totals.', $privateKey)));
Mage::throwException(Mage::helper('paypal')->__('Unable to calculate cart line item totals.'));
}
}
}
}

..\app\code\core\Mage\Paypal\Model\Api\Abstract.php

放心注册,威淘网不会虚耗你半点时间,你只会发现更多乐趣。 立即注册