本文整理汇总了PHP中Magento\Sales\Model\Order\Item::getOrderId方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::getOrderId方法的具体用法?PHP Item::getOrderId怎么用?PHP Item::getOrderId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Sales\Model\Order\Item
的用法示例。
在下文中一共展示了Item::getOrderId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assertOrderItem
/**
* @param \Magento\Sales\Model\Order\Item $orderItem
* @param array $response
* @return void
*/
protected function assertOrderItem(\Magento\Sales\Model\Order\Item $orderItem, array $response)
{
$this->assertEquals($orderItem->getId(), $response['item_id']);
$this->assertEquals($orderItem->getOrderId(), $response['order_id']);
$this->assertEquals($orderItem->getProductId(), $response['product_id']);
$this->assertEquals($orderItem->getProductType(), $response['product_type']);
$this->assertEquals($orderItem->getBasePrice(), $response['base_price']);
$this->assertEquals($orderItem->getRowTotal(), $response['row_total']);
}
示例2: testSetOrder
public function testSetOrder()
{
$orderId = 123;
$order = $this->getMock('Magento\\Sales\\Model\\Order', [], [], '', false);
$order->expects($this->once())->method('getId')->willReturn($orderId);
$this->assertEquals($this->model, $this->model->setOrder($order));
$this->assertEquals($orderId, $this->model->getOrderId());
}
示例3: refundOrder
/**
* @param \Magento\Sales\Model\Order\Item $orderItem
* @return void
*/
protected function refundOrder(\Magento\Sales\Model\Order\Item $orderItem)
{
$creditmemoLoader = $this->creditmemoLoaderFactory->create();
$creditmemoLoader->setOrderId($orderItem->getOrderId());
$creditmemoLoader->setCreditmemo($this->getCreditmemoData($orderItem));
$creditmemo = $creditmemoLoader->load();
if ($creditmemo && $creditmemo->isValidGrandTotal()) {
$creditmemo->setOfflineRequested(true);
$this->creditmemoManagement->refund($creditmemo, true);
}
}
示例4: refundOrder
/**
* @param \Magento\Sales\Model\Order\Item $orderItem
* @return void
*/
protected function refundOrder(\Magento\Sales\Model\Order\Item $orderItem)
{
$creditmemoLoader = $this->creditmemoLoaderFactory->create();
$creditmemoLoader->setOrderId($orderItem->getOrderId());
$creditmemoLoader->setCreditmemo($this->getCreditmemoData($orderItem));
$creditmemo = $creditmemoLoader->load();
if ($creditmemo && $creditmemo->isValidGrandTotal()) {
$creditmemo->setOfflineRequested(true);
$creditmemo->register();
$creditmemoTransaction = $this->transactionFactory->create()->addObject($creditmemo)->addObject($creditmemo->getOrder());
$creditmemoTransaction->save();
}
}