本文整理汇总了PHP中Varien_Event_Observer::getInput方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Event_Observer::getInput方法的具体用法?PHP Varien_Event_Observer::getInput怎么用?PHP Varien_Event_Observer::getInput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Event_Observer
的用法示例。
在下文中一共展示了Varien_Event_Observer::getInput方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: overridePaymentMethod
/**
* @method void overridePaymentMethod()
* @description Called on event 'sales_quote_payment_import_data_before'
*
* @return void
*/
public function overridePaymentMethod(Varien_Event_Observer $observer)
{
/**
* Is the "Save this card" box checked? If it is, change the payment
* method to 'ccsave'
*/
if ($observer->getInput()->getData('save_card') == 'on') {
$observer->getInput()->setMethod('ccsave');
}
}
示例2: salesQuotePaymentImportDataBefore
/**
* Handle custom payment data fields
*
* @param Varien_Event_Observer $observer
* @return void
*/
public function salesQuotePaymentImportDataBefore(Varien_Event_Observer $observer)
{
/** @var $input Varien_Object */
$input = $observer->getInput();
/** @var $payment Mage_Sales_Model_Quote_Payment */
$payment = $observer->getPayment();
$paymentMethod = $input->getMethod();
if (isset($paymentMethod)) {
// Clear any possible additional info from previous requests
$customPaymentAddInfoFields = CLS_Paypal_Helper_Data::$customPaymentAddInfoFields;
if (!empty($customPaymentAddInfoFields)) {
foreach ($customPaymentAddInfoFields as $_customField) {
if ($payment->hasAdditionalInformation($_customField)) {
$payment->unsAdditionalInformation($_customField);
}
}
}
/** @var $helper CLS_Paypal_Helper_Data */
$helper = Mage::helper('cls_paypal');
// Handle "Save this card" option for native Magento payment methods
if ($helper->isSupportedPaymentMethod($paymentMethod)) {
if ($input['cc_save_future'] == 'Y') {
// Set 'Save for future use' flag
$payment->setAdditionalInformation('cc_save_future', 'Y');
}
} elseif ($helper->isCustomerstoredPaymentMethod($paymentMethod)) {
if ($input['stored_card_id']) {
// Save stared card ID into the additional information,
// card ID will be validated afterwards
$payment->setAdditionalInformation('stored_card_id', $input['stored_card_id']);
}
}
}
}
示例3: sales_quote_collect_totals_after
/**
* Collects codFee from qoute/addresses to quote
*
* @param Varien_Event_Observer $observer
*
*/
public function sales_quote_collect_totals_after(Varien_Event_Observer $observer)
{
$quote = $observer->getEvent()->getQuote();
$data = $observer->getInput();
$quote->setCodFee(0);
$quote->setBaseCodFee(0);
$quote->setCodTaxAmount(0);
$quote->setBaseCodTaxAmount(0);
foreach ($quote->getAllAddresses() as $address) {
$quote->setCodFee((double) $quote->getCodFee() + $address->getCodFee());
$quote->setBaseCodFee((double) $quote->getBaseCodFee() + $address->getBaseCodFee());
$quote->setCodTaxAmount((double) $quote->getCodTaxAmount() + $address->getCodTaxAmount());
$quote->setBaseCodTaxAmount((double) $quote->getBaseCodTaxAmount() + $address->getBaseCodTaxAmount());
}
}