本文整理匯總了PHP中OrderDetail::setOrderNb方法的典型用法代碼示例。如果您正苦於以下問題:PHP OrderDetail::setOrderNb方法的具體用法?PHP OrderDetail::setOrderNb怎麽用?PHP OrderDetail::setOrderNb使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OrderDetail
的用法示例。
在下文中一共展示了OrderDetail::setOrderNb方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: completeOrder
public function completeOrder($tid)
{
$transaction = Transaction::getTransactionBasedOnTID($tid);
$user = new User($transaction->getUser());
$order = new Order();
$order->setTid($transaction->getTid());
$order->setUser($transaction->getUser());
$order->setCustomerName($user->getName());
$order->setUserEmail($user->getEmail());
$order->setPhone($transaction->getPhone());
$order->setShippingStreet($transaction->getShippingStreet());
$order->setShippingCity($transaction->getShippingCity());
$order->setShippingPostal($transaction->getShippingPostal());
$order->setShippingProvince($transaction->getShippingProvince());
$order->setShippingCountry($transaction->getShippingCountry());
$order->setBillingStreet($transaction->getBillingStreet());
$order->setBillingCity($transaction->getBillingCity());
$order->setBillingPostal($transaction->getBillingPostal());
$order->setBillingProvince($transaction->getBillingProvince());
$order->setBillingCountry($transaction->getBillingCountry());
$order->setCostSubtotal($transaction->getCostSubtotal());
$order->setCostTax($transaction->getCostTax());
$order->setCostShipping($transaction->getCostShipping());
$order->setCostTotal($transaction->getCostTotal());
$order->setIp($transaction->getIp());
$order->setShippingClass($transaction->getShippingClass());
$order->setPaymentClass($transaction->getPaymentClass());
$order->setDeliveryInstructions($transaction->getDeliveryInstructions());
$order->setStatus('Pending');
$order->save();
$cartItems = CartItem::getAll($transaction->getSession());
foreach ($cartItems as $cartItem) {
$product = new Product($cartItem->getProduct());
$orderDetail = new OrderDetail();
$orderDetail->setOrderNb($order->getId());
$orderDetail->setProduct($product->getId());
$orderDetail->setProductName($product->getName());
$orderDetail->setQuantity($cartItem->getQuantity());
$orderDetail->save();
$cartItem->delete();
}
$transaction->delete();
//Send an email to the user
$this->sendEmailOrderComplete($order->getId());
return true;
}