本文整理汇总了PHP中OrderDetail::setProductName方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderDetail::setProductName方法的具体用法?PHP OrderDetail::setProductName怎么用?PHP OrderDetail::setProductName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderDetail
的用法示例。
在下文中一共展示了OrderDetail::setProductName方法的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;
}