本文整理汇总了PHP中Magento\Framework\DataObject::setState方法的典型用法代码示例。如果您正苦于以下问题:PHP DataObject::setState方法的具体用法?PHP DataObject::setState怎么用?PHP DataObject::setState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\DataObject
的用法示例。
在下文中一共展示了DataObject::setState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* Instantiate state and set it to state object
*
* @param string $paymentAction
* @param \Magento\Framework\DataObject $stateObject
* @return void
*/
public function initialize($paymentAction, $stateObject)
{
switch ($paymentAction) {
case \Magento\Paypal\Model\Config::PAYMENT_ACTION_AUTH:
case \Magento\Paypal\Model\Config::PAYMENT_ACTION_SALE:
$payment = $this->getInfoInstance();
$order = $payment->getOrder();
$order->setCanSendNewEmailFlag(false);
$payment->setAmountAuthorized($order->getTotalDue());
$payment->setBaseAmountAuthorized($order->getBaseTotalDue());
$this->_setPaymentFormUrl($payment);
$stateObject->setState(\Magento\Sales\Model\Order::STATE_PENDING_PAYMENT);
$stateObject->setStatus('pending_payment');
$stateObject->setIsNotified(false);
break;
default:
break;
}
}
示例2: initialize
/**
* Instantiate state and set it to state object
*
* @param string $paymentAction
* @param \Magento\Framework\DataObject $stateObject
* @return void
*/
public function initialize($paymentAction, $stateObject)
{
switch ($paymentAction) {
case \Magento\Paypal\Model\Config::PAYMENT_ACTION_AUTH:
case \Magento\Paypal\Model\Config::PAYMENT_ACTION_SALE:
$payment = $this->getInfoInstance();
$order = $payment->getOrder();
$order->setCanSendNewEmailFlag(false);
$payment->setAmountAuthorized($order->getTotalDue());
$payment->setBaseAmountAuthorized($order->getBaseTotalDue());
$this->_generateSecureSilentPostHash($payment);
$request = $this->_buildTokenRequest($payment);
$response = $this->postRequest($request, $this->getConfig());
$this->_processTokenErrors($response, $payment);
$order = $payment->getOrder();
$order->setCanSendNewEmailFlag(false);
$stateObject->setState(\Magento\Sales\Model\Order::STATE_PENDING_PAYMENT);
$stateObject->setStatus('pending_payment');
$stateObject->setIsNotified(false);
break;
default:
break;
}
}
示例3: getStoreSettings
/**
* Get store settings
* @param int|null $mage_store_id
* @return DataObject
*/
public function getStoreSettings($mage_store_id)
{
/** @var \Magento\Framework\ObjectManagerInterface $om */
$om = \Magento\Framework\App\ObjectManager::getInstance();
/** @var \Magento\Store\Model\StoreManagerInterface $manager */
$manager = $om->get('Magento\\Store\\Model\\StoreManagerInterface');
/**
* @var \Magento\Store\Model\Store;
*/
$store = $manager->getStore($mage_store_id);
$baseUrl = $store->getConfig('web/unsecure/base_url');
$locale = $store->getConfig('general/locale/code');
$timezone = $store->getConfig('general/locale/timezone');
$baseCurrency = $store->getConfig('currency/options/base');
$name = $store->getConfig('general/store_information/name');
$logo_url = $store->getConfig('design/header/logo_src');
$country_id = $store->getConfig('general/store_information/country_id');
$region_id = $store->getConfig('general/store_information/region_id');
$city = $store->getConfig('general/store_information/city');
$address1 = $store->getConfig('general/store_information/street_line1');
$address2 = $store->getConfig('general/store_information/street_line2');
$zip = $store->getConfig('general/store_information/postcode');
$phone = $store->getConfig('general/store_information/phone');
$contact_name = $store->getConfig('trans_email/ident_general/name');
$contact_email = $store->getConfig('trans_email/ident_general/email');
$contact = new StoreSettingsContact();
$contact->email = $contact_email;
$contact->name = $contact_name;
$contact->phone = $phone;
$address = new DataObject();
$address->setCountry($country_id);
$address->setState($region_id);
$address->setCity($city);
$address->setAddress_1($address1);
$address->setAddress_2($address2);
$address->setZip($zip);
$logo = !empty($logo_url) ? $store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . \Magento\Config\Model\Config\Backend\Image\Logo::UPLOAD_DIR . '/' . $logo_url : '';
$configData = array('domain' => $baseUrl, 'store_front_url' => $store->getBaseUrl(), 'name' => $name, 'logo_url' => $logo, 'contact_info' => $contact, 'timezone' => $timezone, 'currency' => $baseCurrency, 'locale' => $locale, 'address' => $address, 'order_statuses' => $this->getStoreOrderStatuses());
$object = new DataObject();
$object->setData($configData);
return $object;
}