本文整理汇总了PHP中Magento\Framework\Event\Observer::getParams方法的典型用法代码示例。如果您正苦于以下问题:PHP Observer::getParams方法的具体用法?PHP Observer::getParams怎么用?PHP Observer::getParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Event\Observer
的用法示例。
在下文中一共展示了Observer::getParams方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Updates configuration values based every time MercadoPago configuration section is saved
* @param \Magento\Framework\Event\Observer $observer
*
* @return $this
*/
public function execute(\Magento\Framework\Event\Observer $observer)
{
$order = $observer->getOrder();
$method = $order->getShippingMethod();
$shippingCost = $order->getBaseShippingAmount();
$paramsME = [];
if ($this->shipmentCarrierHelper->isMercadoEnviosMethod($method)) {
$shippingAddress = $order->getShippingAddress();
$zipCode = $shippingAddress->getPostcode();
$defaultShippingId = substr($method, strpos($method, '_') + 1);
$paramsME = ['mode' => 'me2', 'zip_code' => $zipCode, 'default_shipping_method' => intval($defaultShippingId), 'dimensions' => $this->shipmentCarrierHelper->getDimensions($this->shipmentCarrierHelper->getAllItems($order->getAllItems()))];
if ($shippingCost == 0) {
$paramsME['free_methods'] = [['id' => intval($defaultShippingId)]];
}
}
if (!empty($shippingCost)) {
$paramsME['cost'] = (double) $order->getBaseShippingAmount();
}
$observer->getParams()->setParams($paramsME);
$this->shipmentCarrierHelper->log('REQUEST SHIPMENT ME: ', $paramsME);
return $observer;
}