本文整理汇总了PHP中Orders::sendOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP Orders::sendOrder方法的具体用法?PHP Orders::sendOrder怎么用?PHP Orders::sendOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orders
的用法示例。
在下文中一共展示了Orders::sendOrder方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public function create($params)
{
$this->authenticate();
$uuid = $params['uuid'];
$customers = Customers::find($uuid);
if (empty($customers)) {
throw new Shineisp_Api_Exceptions(400006, ":: 'uuid' not valid");
exit;
}
$trancheid = intval($params['trancheid']);
$tranche = ProductsTranches::getTranchebyId($trancheid);
if (empty($tranche)) {
throw new Shineisp_Api_Exceptions(400006, ":: 'trancheid' not valid");
exit;
}
#Check Products
if (empty($params['products']) && !is_array($params['products'])) {
throw new Shineisp_Api_Exceptions(400006, ":: not 'products' choose");
exit;
}
foreach ($params['products'] as $product) {
$productid = intval($product['productid']);
$billingid = intval($product['billingid']);
$ttry = ProductsTranches::getTranchesBy_ProductId_BillingId($productid, $billingid);
if (empty($ttry)) {
throw new Shineisp_Api_Exceptions(400006, ":: 'productid' or 'bilingid' not valid");
exit;
}
$ttry = array_shift($ttry);
if ($ttry['tranche_id'] != $trancheid) {
throw new Shineisp_Api_Exceptions(400006, ":: 'bilingid' not valid");
exit;
}
}
$id = $customers['customer_id'];
$isVATFree = Customers::isVATFree($id);
if ($params['status'] == "complete") {
$status = Statuses::id('complete', 'orders');
} else {
$status = Statuses::id('tobepaid', 'orders');
}
$theOrder = Orders::create($customers['customer_id'], $status, $params['note']);
foreach ($params['products'] as $product) {
$productid = intval($product['productid']);
$billingid = intval($product['billingid']);
$quantity = intval($product['quantity']);
$p = Products::getAllInfo($productid);
Orders::addItem($productid, $quantity, $billingid, $trancheid, $p['ProductsData'][0]['name'], array());
}
$orderID = $theOrder['order_id'];
if ($params['sendemail'] == 1) {
Orders::sendOrder($orderID);
}
$banks = Banks::find($params['payment'], "*", true);
if (!empty($banks[0]['classname'])) {
$class = $banks[0]['classname'];
if (class_exists($class)) {
// Get the payment form object
$banks = Banks::findbyClassname($class);
$gateway = new $class($orderID);
$gateway->setFormHidden(true);
$gateway->setRedirect(true);
$gateway->setUrlOk($_SERVER['HTTP_HOST'] . "/orders/response/gateway/" . md5($banks['classname']));
$gateway->setUrlKo($_SERVER['HTTP_HOST'] . "/orders/response/gateway/" . md5($banks['classname']));
$gateway->setUrlCallback($_SERVER['HTTP_HOST'] . "/common/callback/gateway/" . md5($banks['classname']));
return $gateway->CreateForm();
}
}
throw new Shineisp_Api_Exceptions(400006, ":: bad request");
exit;
}
示例2: createOrder
/**
* Create a new Order
*
* @return boolean
*/
public function createOrder()
{
if (!$this->getOrderid()) {
$theOrder = Orders::create($this->getCustomerId(), Statuses::id('tobepaid', 'orders'), null);
// For each item in the cart
foreach ($this->getItems() as $item) {
$item = Orders::addOrderItem($item);
}
$this->setOrderid($theOrder['order_id']);
// Send the email to confirm the order
Orders::sendOrder($theOrder['order_id']);
return Orders::getOrder();
} else {
return Orders::find($this->getOrderid());
}
}
示例3: sendorderAction
/**
* sendorder
* Send the order email
* @return url link
*/
public function sendorderAction()
{
$request = $this->getRequest();
$orderid = $request->getParam('id');
if (is_numeric($orderid)) {
if (Orders::sendOrder($orderid)) {
$this->_helper->redirector('edit', 'orders', 'admin', array('id' => $orderid, 'mex' => $this->translator->translate('The order has been sent successfully.'), 'status' => 'success'));
}
}
$this->_helper->redirector('edit', 'orders', 'admin', array('id' => $orderid, 'mex' => $this->translator->translate('The order has not been found.'), 'status' => 'danger'));
}
示例4: create
public function create($params)
{
$this->authenticate();
$uuid = $params['uuid'];
$customers = Customers::findWithUuid($uuid);
if (empty($customers)) {
throw new Shineisp_Api_Exceptions(400006, ":: 'uuid' not valid");
exit;
}
$trancheid = intval($params['trancheid']);
$tranche = ProductsTranches::getTranchebyId($trancheid);
if (empty($tranche)) {
throw new Shineisp_Api_Exceptions(400006, ":: 'trancheid' not valid");
exit;
}
#Check Products
if (empty($params['products']) && !is_array($params['products'])) {
throw new Shineisp_Api_Exceptions(400006, ":: not 'products' choose");
exit;
}
foreach ($params['products'] as $product) {
$productid = intval($product['productid']);
$billingid = intval($product['billingid']);
$ttry = ProductsTranches::getTranchesBy_ProductId_BillingId($productid, $billingid);
if (empty($ttry)) {
throw new Shineisp_Api_Exceptions(400006, ":: 'productid' or 'bilingid' not valid");
exit;
}
$ttry = array_shift($ttry);
if ($ttry['tranche_id'] != $trancheid) {
throw new Shineisp_Api_Exceptions(400006, ":: 'bilingid' not valid");
exit;
}
}
$id = $customers['customer_id'];
if ($params['status'] == "complete") {
$status = Statuses::id('complete', 'orders');
} else {
$status = Statuses::id('tobepaid', 'orders');
}
$theOrder = Orders::create($customers['customer_id'], $status, $params['note']);
foreach ($params['products'] as $product) {
$productid = intval($product['productid']);
$billingid = intval($product['billingid']);
$quantity = intval($product['quantity']);
$p = Products::getAllInfo($productid);
$options = array('uuid' => $product['uuid']);
$upgrade = false;
if (array_key_exists('upgrade', $product) && $product['upgrade'] != false) {
$orderItemsUpgrade = OrdersItems::findByUUID($product['upgrade']);
$fromUpgrade = $orderItemsUpgrade->toArray();
$upgrade = $fromUpgrade['detail_id'];
}
$ts_start = false;
if (array_key_exists('ts_start', $product) && $product['ts_start'] != false) {
$ts_start = $product['ts_start'];
}
Orders::addItem($productid, $quantity, $billingid, $trancheid, $p['ProductsData'][0]['name'], $options, $upgrade, $ts_start);
}
$orderID = $theOrder['order_id'];
if ($params['sendemail'] == 1) {
Orders::sendOrder($orderID);
}
}