提交数据到paypal时,magento的产品名修改



提交数据到paypal时,magento的产品名修改

如果是多个自定义属性的,比如有size, color, 提交订单到paypal时, zen-cart 会把这些属性接到产品名后面, 这样只看paypal的邮件也知道卖了的是什么属性的产品,但magento不会这么做,非要到magento后台看订单详细才知道, 改起来很简单…但找magento的处理文件类很容易头晕..
在 /app/code/core/Mage/Paypal/Model/Cart.php找到_addRegularItem方法,改一下.
[php] view plaincopy
protected function _addRegularItem(Varien_Object $salesItem)
{
if ($this->_salesEntity instanceof Mage_Sales_Model_Order) {
$qty = $salesItem->getQtyOrdered();
$amount = $salesItem->getBasePrice();
// TODO: nominal item for order
} else {
$qty = $salesItem->getTotalQty();
$amount = $salesItem->isNominal() ? 0 : $salesItem->getBaseCalculationPrice();
}
// workaround in case if item subtotal precision is not compatible with PayPal (.2)
$subAggregatedLabel = ”;
if ((float)$amount – round((float)$amount, 2)) {
$amount = $amount * $qty;
$subAggregatedLabel = ‘ x’ . $qty;
$qty = 1;
}
//注意这里加的
$option_str = “”;
$options = $salesItem->getProductOptions();
foreach ( $options['options'] as $option ) {
$option_str = $option_str . ” “.$option['label'] .” “. $option['value'];
}

return $this->addItem($salesItem->getName() .$option_str. $subAggregatedLabel, $qty, (float)$amount, $salesItem->getSku());
}