本文整理匯總了PHP中Magento\Sales\Model\Order::getStoreId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Order::getStoreId方法的具體用法?PHP Order::getStoreId怎麽用?PHP Order::getStoreId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Sales\Model\Order
的用法示例。
在下文中一共展示了Order::getStoreId方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _getTrackingUrl
/**
* Retrieve tracking url with params
*
* @param string $key
* @param \Magento\Sales\Model\Order|\Magento\Sales\Model\Order\Shipment|\Magento\Sales\Model\Order\Shipment\Track $model
* @param string $method Optional - method of a model to get id
* @return string
*/
protected function _getTrackingUrl($key, $model, $method = 'getId')
{
$urlPart = "{$key}:{$model->{$method}()}:{$model->getProtectCode()}";
$params = ['_direct' => 'shipping/tracking/popup', '_query' => ['hash' => $this->urlEncoder->encode($urlPart)]];
$storeModel = $this->_storeManager->getStore($model->getStoreId());
return $storeModel->getUrl('', $params);
}
示例2: initFromOrder
/**
* Initialize creation data from existing order
*
* @param \Magento\Sales\Model\Order $order
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function initFromOrder(\Magento\Sales\Model\Order $order)
{
$session = $this->getSession();
$session->setData($order->getReordered() ? 'reordered' : 'order_id', $order->getId());
$session->setCurrencyId($order->getOrderCurrencyCode());
/* Check if we edit guest order */
$session->setCustomerId($order->getCustomerId() ?: false);
$session->setStoreId($order->getStoreId());
/* Initialize catalog rule data with new session values */
$this->initRuleData();
foreach ($order->getItemsCollection($this->_salesConfig->getAvailableProductTypes(), true) as $orderItem) {
/* @var $orderItem \Magento\Sales\Model\Order\Item */
if (!$orderItem->getParentItem()) {
$qty = $orderItem->getQtyOrdered();
if (!$order->getReordered()) {
$qty -= max($orderItem->getQtyShipped(), $orderItem->getQtyInvoiced());
}
if ($qty > 0) {
$item = $this->initFromOrderItem($orderItem, $qty);
if (is_string($item)) {
throw new \Magento\Framework\Exception\LocalizedException(__($item));
}
}
}
}
$shippingAddress = $order->getShippingAddress();
if ($shippingAddress) {
$addressDiff = array_diff_assoc($shippingAddress->getData(), $order->getBillingAddress()->getData());
unset($addressDiff['address_type'], $addressDiff['entity_id']);
$shippingAddress->setSameAsBilling(empty($addressDiff));
}
$this->_initBillingAddressFromOrder($order);
$this->_initShippingAddressFromOrder($order);
$quote = $this->getQuote();
if (!$quote->isVirtual() && $this->getShippingAddress()->getSameAsBilling()) {
$this->setShippingAsBilling(1);
}
$this->setShippingMethod($order->getShippingMethod());
$quote->getShippingAddress()->setShippingDescription($order->getShippingDescription());
$paymentData = $order->getPayment()->getData();
unset($paymentData['cc_type'], $paymentData['cc_last_4']);
unset($paymentData['cc_exp_month'], $paymentData['cc_exp_year']);
$quote->getPayment()->addData($paymentData);
$orderCouponCode = $order->getCouponCode();
if ($orderCouponCode) {
$quote->setCouponCode($orderCouponCode);
}
if ($quote->getCouponCode()) {
$quote->collectTotals();
}
$this->_objectCopyService->copyFieldsetToTarget('sales_copy_order', 'to_edit', $order, $quote);
$this->_eventManager->dispatch('sales_convert_order_to_quote', ['order' => $order, 'quote' => $quote]);
if (!$order->getCustomerId()) {
$quote->setCustomerIsGuest(true);
}
if ($session->getUseOldShippingMethod(true)) {
/*
* if we are making reorder or editing old order
* we need to show old shipping as preselected
* so for this we need to collect shipping rates
*/
$this->collectShippingRates();
} else {
/*
* if we are creating new order then we don't need to collect
* shipping rates before customer hit appropriate button
*/
$this->collectRates();
}
$this->quoteRepository->save($quote);
return $this;
}
示例3: setOrder
/**
* Declare order for invoice
*
* @param \Magento\Sales\Model\Order $order
* @return $this
*/
public function setOrder(\Magento\Sales\Model\Order $order)
{
$this->_order = $order;
$this->setOrderId($order->getId())->setStoreId($order->getStoreId());
return $this;
}
示例4: isSuppliedShippingAmountInclTax
/**
* Returns whether the user specified a shipping amount that already includes tax
*
* @param \Magento\Sales\Model\Order $order
* @return bool
*/
private function isSuppliedShippingAmountInclTax($order)
{
// returns true if we are only displaying shipping including tax, otherwise returns false
return $this->getTaxConfig()->displaySalesShippingInclTax($order->getStoreId());
}
示例5: toQuote
/**
* Converting order object to quote object
*
* @param \Magento\Sales\Model\Order $order
* @param null|\Magento\Sales\Model\Quote $quote
* @return \Magento\Sales\Model\Quote
*/
public function toQuote(\Magento\Sales\Model\Order $order, $quote = null)
{
if (!$quote instanceof \Magento\Sales\Model\Quote) {
$quote = $this->_quoteFactory->create();
}
$quote->setStoreId($order->getStoreId())->setOrderId($order->getId());
$this->_objectCopyService->copyFieldsetToTarget('sales_convert_order', 'to_quote', $order, $quote);
$this->_eventManager->dispatch('sales_convert_order_to_quote', array('order' => $order, 'quote' => $quote));
return $quote;
}
示例6: _setPaymentAuthorized
/**
* @param bool $manualReviewComment
* @param bool $createInvoice
* @throws Exception
*/
protected function _setPaymentAuthorized($manualReviewComment = true, $createInvoice = false)
{
$this->_adyenLogger->addAdyenNotificationCronjob('Set order to authorised');
// if full amount is captured create invoice
$currency = $this->_order->getOrderCurrencyCode();
$amount = $this->_value;
$orderAmount = (int) $this->_adyenHelper->formatAmount($this->_order->getGrandTotal(), $currency);
// create invoice for the capture notification if you are on manual capture
if ($createInvoice == true && $amount == $orderAmount) {
$this->_adyenLogger->addAdyenNotificationCronjob('amount notification:' . $amount . ' amount order:' . $orderAmount);
$this->_createInvoice();
}
// if you have capture on shipment enabled don't set update the status of the payment
$captureOnShipment = $this->_getConfigData('capture_on_shipment', 'adyen_abstract', $this->_order->getStoreId());
if (!$captureOnShipment) {
$status = $this->_getConfigData('payment_authorized', 'adyen_abstract', $this->_order->getStoreId());
}
// virtual order can have different status
if ($this->_order->getIsVirtual()) {
$this->_adyenLogger->addAdyenNotificationCronjob('Product is a virtual product');
$virtualStatus = $this->_getConfigData('payment_authorized_virtual');
if ($virtualStatus != "") {
$status = $virtualStatus;
}
}
// check for boleto if payment is totally paid
if ($this->_paymentMethodCode() == "adyen_boleto") {
// check if paid amount is the same as orginal amount
$orginalAmount = $this->_boletoOriginalAmount;
$paidAmount = $this->_boletoPaidAmount;
if ($orginalAmount != $paidAmount) {
// not the full amount is paid. Check if it is underpaid or overpaid
// strip the BRL of the string
$orginalAmount = str_replace("BRL", "", $orginalAmount);
$orginalAmount = floatval(trim($orginalAmount));
$paidAmount = str_replace("BRL", "", $paidAmount);
$paidAmount = floatval(trim($paidAmount));
if ($paidAmount > $orginalAmount) {
$overpaidStatus = $this->_getConfigData('order_overpaid_status', 'adyen_boleto');
// check if there is selected a status if not fall back to the default
$status = !empty($overpaidStatus) ? $overpaidStatus : $status;
} else {
$underpaidStatus = $this->_getConfigData('order_underpaid_status', 'adyen_boleto');
// check if there is selected a status if not fall back to the default
$status = !empty($underpaidStatus) ? $underpaidStatus : $status;
}
}
}
$comment = "Adyen Payment Successfully completed";
// if manual review is true use the manual review status if this is set
if ($manualReviewComment == true && $this->_fraudManualReview) {
// check if different status is selected
$fraudManualReviewStatus = $this->_getFraudManualReviewStatus();
if ($fraudManualReviewStatus != "") {
$status = $fraudManualReviewStatus;
$comment = "Adyen Payment is in Manual Review check the Adyen platform";
}
}
$status = !empty($status) ? $status : $this->_order->getStatus();
$this->_order->addStatusHistoryComment(__($comment), $status);
$this->_adyenLogger->addAdyenNotificationCronjob('Order status is changed to authorised status, status is ' . $status);
}
示例7: _getTrackingUrl
/**
* Retrieve tracking url with params
*
* @param string $key
* @param \Magento\Sales\Model\Order|\Magento\Sales\Model\Order\Shipment|\Magento\Sales\Model\Order\Shipment\Track $model
* @param string $method Optional - method of a model to get id
* @return string
*/
protected function _getTrackingUrl($key, $model, $method = 'getId')
{
$urlPart = "{$key}:{$model->{$method}()}:{$model->getProtectCode()}";
$param = array('hash' => $this->_coreData->urlEncode($urlPart));
$storeModel = $this->_storeManager->getStore($model->getStoreId());
return $storeModel->getUrl('shipping/tracking/popup', $param);
}
示例8: getStoreId
/**
* Returns order store id
*
* @return int
*/
public function getStoreId()
{
return $this->order->getStoreId();
}