本文整理汇总了PHP中Varien_Event::getOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Event::getOrder方法的具体用法?PHP Varien_Event::getOrder怎么用?PHP Varien_Event::getOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Event
的用法示例。
在下文中一共展示了Varien_Event::getOrder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setOrderCurrency
/**
* handles the event checkout_type_onepage_save_order to set the currency of the order
* @param Varien_Event $event
*/
public function setOrderCurrency($event)
{
if (Mage::helper('imagecc')->isActive()) {
$order = $event->getOrder();
if ($order && !Mage::helper('imagecc')->isPaypalOrder($order)) {
if ($this->_useFixedCurrency($order)) {
return;
}
Mage::helper('imagecc')->log("Using display currency " . $order->getIncrementId());
$imagecc_preserved_information = array('order_fields' => array(), 'item_fields' => array());
$_coreHelper = Mage::helper('core');
foreach ($this->_orderFields as $field) {
$field2 = preg_replace('(^base_)', '', $field);
$new_v = $order->getData($field2);
//$v = $order->getData($field);
//$new_v = $_coreHelper->currency($v, false, false);
/**
* preserve information before change it
*/
if ($field !== $field2) {
$imagecc_preserved_information['order_fields'][] = array('field' => $field, 'original_value' => $order->getData($field), 'new_value' => $new_v);
}
$order->setData($field, $new_v);
Mage::helper('imagecc')->log("{$field2} {$field} {$new_v}");
}
foreach ($order->getAllItems() as $item) {
$arr = $this->_itemFields;
$quoteItemId = $item->getData('quote_item_id');
$imagecc_preserved_information['item_fields'][$quoteItemId] = array();
foreach ($arr as $k) {
//$v = $item->getData($k);
//$new_v = $_coreHelper->currency($v, false, false);
$field2 = preg_replace('(^base_)', '', $k);
$new_v = $item->getData($field2);
/**
* preserve information before change it
*/
if ($k !== $field2) {
$imagecc_preserved_information['item_fields'][$quoteItemId][] = array('field' => $k, 'original_value' => $item->getData($k), 'new_value' => $new_v);
}
$item->setData($k, $new_v);
Mage::helper('imagecc')->log("{$field2} {$k} {$new_v}");
}
//$item->save();
}
$store_currency = $order->getData('order_currency_code');
/**
* preserve information before change it
*/
$imagecc_preserved_information['order_fields']['global_currency_code'] = array('original_value' => $order->getData('global_currency_code'), 'field' => 'global_currency_code', 'new_value' => '');
$imagecc_preserved_information['order_fields']['base_currency_code'] = array('original_value' => $order->getData('base_currency_code'), 'field' => 'base_currency_code', 'new_value' => '');
$imagecc_preserved_information['order_fields']['store_currency_code'] = array('original_value' => $order->getData('store_currency_code'), 'field' => 'store_currency_code', 'new_value' => '');
$order->setData('global_currency_code', $store_currency)->setData('base_currency_code', $store_currency)->setData('store_currency_code', $store_currency)->setData('imagecc_preserved_information', json_encode($imagecc_preserved_information));
}
}
}
开发者ID:vinayshuklasourcefuse,项目名称:sareez,代码行数:60,代码来源:Intellimage_CurrencyCheckout_Model_Observer.php