本文整理汇总了PHP中Cart::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart::delete方法的具体用法?PHP Cart::delete怎么用?PHP Cart::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cart
的用法示例。
在下文中一共展示了Cart::delete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hookheader
public function hookheader($params)
{
//Change context Shop to be default
if ($this->isVersionOneDotFive() && Shop::isFeatureActive()) {
$oldContextShop = $this->getContextShop();
$this->setContextShop();
}
//End of change
// Check if the module is configured
if (!Configuration::get('EBAY_PAYPAL_EMAIL')) {
return false;
}
// Fix hook update product attribute
$this->hookupdateProductAttributeEbay();
// init date to check from
if (Configuration::get('EBAY_INSTALL_DATE') < date('Y-m-d', strtotime('-30 days')) . 'T' . date('H:i:s', strtotime('-30 days'))) {
//If it is more than 30 days that we installed the module
$dateToCheckFrom = Configuration::get('EBAY_ORDER_LAST_UPDATE');
$dateToCheckFromArray = explode('T', $dateToCheckFrom);
$dateToCheckFrom = date("Y-m-d", strtotime($dateToCheckFromArray[0] . " -30 day"));
$dateToCheckFrom .= 'T' . $dateToCheckFromArray[1];
} else {
//If it is less than 30 days that we installed the module
$dateToCheckFrom = Configuration::get('EBAY_INSTALL_DATE');
$dateToCheckFromArray = explode('T', $dateToCheckFrom);
$dateToCheckFrom = date("Y-m-d", strtotime($dateToCheckFromArray[0] . " -1 day"));
$dateToCheckFrom .= 'T' . $dateToCheckFromArray[1];
}
if (Configuration::get('EBAY_ORDER_LAST_UPDATE') < date('Y-m-d', strtotime('-30 minutes')) . 'T' . date('H:i:s', strtotime('-30 minutes')) . '.000Z') {
$dateNew = date('Y-m-d') . 'T' . date('H:i:s') . '.000Z';
$this->setConfiguration('EBAY_ORDER_LAST_UPDATE', $dateNew);
// eBay Request
$ebay = new eBayRequest();
$page = 1;
$orderList = array();
$orderCount = 0;
$orderCountTmp = 100;
while ($orderCountTmp == 100 && $page < 10) {
$orderListTmp = $ebay->getOrders($dateToCheckFrom, $dateNew, $page);
$orderCountTmp = count($orderListTmp);
$orderList = array_merge((array) $orderList, (array) $orderListTmp);
$orderCount += $orderCountTmp;
$page++;
}
// Lock
if ($orderList) {
foreach ($orderList as $korder => $order) {
if ($order['status'] == 'Complete' && $order['amount'] > 0.1 && isset($order['product_list']) && count($order['product_list'])) {
if (!Db::getInstance()->getValue('SELECT `id_ebay_order` FROM `' . _DB_PREFIX_ . 'ebay_order` WHERE `id_order_ref` = \'' . pSQL($order['id_order_ref']) . '\'')) {
// Check for empty name
$order['firstname'] = trim($order['firstname']);
$order['familyname'] = trim($order['familyname']);
if (empty($order['familyname'])) {
$order['familyname'] = $order['firstname'];
}
if (empty($order['firstname'])) {
$order['firstname'] = $order['familyname'];
}
if (empty($order['phone']) || !Validate::isPhoneNumber($order['phone'])) {
$order['phone'] = '0100000000';
}
if (Validate::isEmail($order['email']) && !empty($order['firstname']) && !empty($order['familyname'])) {
// Getting the customer
$id_customer = (int) Db::getInstance()->getValue('SELECT `id_customer` FROM `' . _DB_PREFIX_ . 'customer` WHERE `active` = 1 AND `email` = \'' . pSQL($order['email']) . '\' AND `deleted` = 0' . (substr(_PS_VERSION_, 0, 3) == '1.3' ? '' : ' AND `is_guest` = 0'));
// Add customer if he doesn't exist
if ($id_customer < 1) {
$customer = new Customer();
$customer->id_gender = 0;
$customer->id_default_group = 1;
$customer->secure_key = md5(uniqid(rand(), true));
$customer->email = $order['email'];
$customer->passwd = md5(pSQL(_COOKIE_KEY_ . rand()));
$customer->last_passwd_gen = pSQL(date('Y-m-d H:i:s'));
$customer->newsletter = 0;
$customer->lastname = pSQL($order['familyname']);
$customer->firstname = pSQL($order['firstname']);
$customer->active = 1;
$customer->add();
$id_customer = $customer->id;
}
// Search if address exists
$id_address = (int) Db::getInstance()->getValue('SELECT `id_address` FROM `' . _DB_PREFIX_ . 'address` WHERE `id_customer` = ' . (int) $id_customer . ' AND `alias` = \'eBay\'');
if ($id_address > 0) {
$address = new Address((int) $id_address);
} else {
$address = new Address();
$address->id_customer = (int) $id_customer;
}
$address->id_country = (int) Country::getByIso($order['country_iso_code']);
$address->alias = 'eBay';
$address->lastname = pSQL($order['familyname']);
$address->firstname = pSQL($order['firstname']);
$address->address1 = pSQL($order['address1']);
$address->address2 = pSQL($order['address2']);
$address->postcode = pSQL($order['postalcode']);
$address->city = pSQL($order['city']);
$address->phone = pSQL($order['phone']);
$address->active = 1;
if ($id_address > 0 && Validate::isLoadedObject($address)) {
$address->update();
//.........这里部分代码省略.........
示例2: postProcess
public function postProcess()
{
$order_id = $_POST['ORDERID'];
$res_code = $_POST['RESPCODE'];
$res_desc = $_POST['RESPMSG'];
$checksum_recv = $_POST['CHECKSUMHASH'];
$paramList = $_POST;
//var_dump($paramList);
$secret_key = Configuration::get('PayTM_SECRET_KEY');
$order_amount = $_POST['TXNAMOUNT'];
$bool = "FALSE";
$bool = verifychecksum_e($paramList, $secret_key, $checksum_recv);
/*if(isset($DR)){
$DR = preg_replace("/\s/","+",$DR);
$rc4 = new Crypt_RC4($secret_key);
$QueryString = base64_decode($DR);
$rc4->decrypt($QueryString);
$QueryString = explode('&',$QueryString);
$response = array();
foreach($QueryString as $param){
$param = explode('=',$param);
$response[$param[0]] = urldecode($param[1]);
array(8) { ["RESPCODE"]=> string(3) "141" ["RESPMSG"]=> string(26) "Cancel Request by Customer" ["STATUS"]=> string(11) "TXN_FAILURE" ["MID"]=> string(20) "pebble49164290093828" ["TXNAMOUNT"]=> string(3) "199" ["ORDERID"]=> string(4) "1105" ["TXNID"]=> string(4) "9051" ["CHECKSUMHASH"]=> string(108) "8JTqSis+Uqe2iVMo/vWLgjFQkay2pZQkoN/uUVaBbkZrwkYEZMXIKfKy9NfYd2Fk9JaHiemzwNVpfRJrqiWzyeDWxZSJBhCi5NBEaTdbcZA=" }
}
}*/
$cartID = $order_id;
$extras = array();
$extras['transaction_id'] = $_POST['TXNID'];
$cart = new Cart(intval($cartID));
$amount = $cart->getOrderTotal(true, Cart::BOTH);
$responseMsg = $_POST['RESPMSG'];
if ($bool == "TRUE") {
if ($res_code == "01") {
$status_code = "Ok";
$message = "Transaction Successful";
// $status = "15" ;
$status = Configuration::get('Paytm_ID_ORDER_SUCCESS');
} else {
if ($res_code == "141") {
$responseMsg = "Transaction Cancelled. ";
$message = "Transaction Cancelled";
$status = "6";
} else {
$responseMsg = "Transaction Failed. ";
$message = "Transaction Failed";
$status = Configuration::get('Paytm_ID_ORDER_FAILED');
}
}
} else {
$status_code = "Failed";
$responseMsg = "Security Error ..!";
$status = Configuration::get('Paytm_ID_ORDER_FAILED');
}
$history_message = $responseMsg . '. Paytm Payment ID: ' . $_POST['TXNID'];
$obj = new Paytm();
$obj->validateOrder(intval($cart->id), $status, $order_amount, $obj->displayName, $history_message, $extras, '', false, $cart->secure_key);
$this->context->smarty->assign(array('status' => $status_code, 'responseMsg' => $message, 'this_path' => $this->module->getPathUri(), 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->module->name . '/'));
$cart_qties == 0;
$cart->delete();
$this->setTemplate('payment_response.tpl');
}
示例3: addOrder
public static function addOrder($uid = 0, $username = '', $pay_name = '货到付款', $default_address_id = 0)
{
if ($uid) {
//从购物车里获取到商品列表
$cart_goods_list = Cart::select($uid);
if ($cart_goods_list) {
//计算订单总金额
$order_total_data = self::getOrderTotal($cart_goods_list);
$total = $order_total_data['total'];
//运费
$shipping_fee = self::getOrderShippingFee($total);
//优惠
$bonus = 0;
//使用优惠券...
//收货地址
$address_info = UserAddress::getAddrByAddressId($uid, $default_address_id);
if (!$address_info) {
$address_info = UserAddress::getDefaultAddress($uid);
}
$data['sn'] = self::createOrderSn();
//订单号
$data['uid'] = $uid;
//用户id
$data['username'] = $username;
//用户名
$data['order_status'] = 'yes';
//订单有效
$data['consignee'] = $address_info['consignee'];
//联系人
$data['province'] = $address_info['province'];
//省
$data['city'] = $address_info['city'];
//市
$data['district'] = $address_info['district'];
//区
$data['address'] = $address_info['address'];
//详细地址
$data['mobile'] = $address_info['mobile'];
//手机或电话
$data['shipping_fee'] = $shipping_fee;
//运费
$data['bonus'] = $bonus;
//优惠
$data['order_money'] = $total;
//货物总金额
$data['money_paid'] = $total + $shipping_fee + $bonus;
//应付款金额
$data['pay_name'] = $pay_name;
//付款方式
//非货到付款操作
if ($pay_name !== '货到付款') {
$data['pay_time'] = time();
//支付时间
$data['confirm_status'] = 'yes';
//确认订单状态(非货到付款自动确认)
$data['confirm_time'] = time();
//确认订单时间
}
$rs = OrderInfo::addOrder($data);
if ($rs) {
//下单成功,减少库存
AdminGoodsM::minusStock($cart_goods_list);
//添加到订单商品表
OrderGoodsInfo::addGoods($rs, $cart_goods_list);
//删除购物车里面的商品信息
$where = self::_where($uid);
Cart::delete($where);
}
//下单成功
return $rs;
}
}
//下单失败
return false;
}
示例4: getCarriersByCountry
public static function getCarriersByCountry($id_country, $id_state, $zipcode, $exiting_cart, $id_customer)
{
// Create temporary Address
$addr_temp = new Address();
$addr_temp->id_customer = $id_customer;
$addr_temp->id_country = $id_country;
$addr_temp->id_state = $id_state;
$addr_temp->postcode = $zipcode;
// Populate required attributes
// Note: Some carrier needs the whole address
// the '.' will do the job
$addr_temp->firstname = ".";
$addr_temp->lastname = ".";
$addr_temp->address1 = ".";
$addr_temp->city = ".";
$addr_temp->alias = "TEMPORARY_ADDRESS_TO_DELETE";
$addr_temp->save();
$cart = new Cart();
$cart->id_currency = $exiting_cart->id_currency;
$cart->id_customer = $exiting_cart->id_customer;
$cart->id_lang = $exiting_cart->id_lang;
$cart->id_address_delivery = $addr_temp->id;
$cart->add();
$products = $exiting_cart->getProducts();
foreach ($products as $key => $product) {
$cart->updateQty($product['quantity'], $product['id_product'], $product['id_product_attribute']);
}
$carriers = $cart->simulateCarriersOutput(null, true);
//delete temporary objects
$addr_temp->delete();
$cart->delete();
return $carriers;
}
示例5: delcartone
public function delcartone($cart_id)
{
$uid = LuS::get('uid');
if ($cart_id) {
$where['uid'] = $uid;
$where['cart_id'] = $cart_id;
Cart::delete($where);
$cart_goods_list = Cart::select($uid);
$data = Cart::getOrderTotal($cart_goods_list);
$total = $data['total'];
//总金额
$num = $data['num'];
//总件数
$shipping_fee = Cart::getOrderShippingFee($total);
echo json_encode(array('1', $total, $shipping_fee, $num));
}
throw new Exception('exit');
}
示例6: hookbackOfficeTop
public function hookbackOfficeTop($params)
{
// Check if the module is configured
if (!Configuration::get('EBAY_PAYPAL_EMAIL')) {
return false;
}
// If no update yet
if (!Configuration::get('EBAY_ORDER_LAST_UPDATE')) {
Configuration::updateValue('EBAY_ORDER_LAST_UPDATE', date('Y-m-d') . 'T' . date('H:i:s') . '.000Z');
}
// init Var
$dateNew = date('Y-m-d') . 'T' . date('H:i:s') . '.000Z';
if (Configuration::get('EBAY_ORDER_LAST_UPDATE') < date('Y-m-d', strtotime('-30 minutes')) . 'T' . date('H:i:s', strtotime('-30 minutes')) . '.000Z') {
// Lock
Configuration::updateValue('EBAY_ORDER_LAST_UPDATE', $dateNew);
// eBay Request
$ebay = new eBayRequest();
$page = 1;
$orderList = array();
$orderCount = 0;
$orderCountTmp = 100;
while ($orderCountTmp == 100 && $page < 10) {
$orderListTmp = $ebay->getOrders(date('Y-m-d', strtotime('-30 days')) . 'T' . date('H:i:s', strtotime('-30 days')) . '.000Z', $dateNew, $page);
$orderCountTmp = count($orderListTmp);
$orderList = array_merge((array) $orderList, (array) $orderListTmp);
$orderCount += $orderCountTmp;
$page++;
}
if ($orderList) {
foreach ($orderList as $korder => $order) {
if ($order['status'] == 'Complete' && $order['amount'] > 0.1 && isset($order['product_list']) && count($order['product_list'])) {
if (!Db::getInstance()->getValue('SELECT `id_ebay_order` FROM `' . _DB_PREFIX_ . 'ebay_order` WHERE `id_order_ref` = \'' . pSQL($order['id_order_ref']) . '\'')) {
$id_customer = (int) Db::getInstance()->getValue('SELECT `id_customer` FROM `' . _DB_PREFIX_ . 'customer` WHERE `active` = 1 AND `email` = \'' . pSQL($order['email']) . '\' AND `deleted` = 0' . (substr(_PS_VERSION_, 0, 3) == '1.3' ? '' : ' AND `is_guest` = 0'));
// Check for empty name
$order['firstname'] = trim($order['firstname']);
$order['familyname'] = trim($order['familyname']);
if (empty($order['familyname'])) {
$order['familyname'] = $order['firstname'];
}
if (empty($order['firstname'])) {
$order['firstname'] = $order['familyname'];
}
if (empty($order['phone']) || !Validate::isPhoneNumber($order['phone'])) {
$order['phone'] = '0100000000';
}
if (Validate::isEmail($order['email']) && !empty($order['firstname']) && !empty($order['familyname'])) {
// Add customer if he doesn't exist
if ($id_customer < 1) {
$customer = new Customer();
$customer->id_gender = 9;
$customer->id_default_group = 1;
$customer->secure_key = md5(uniqid(rand(), true));
$customer->email = $order['email'];
$customer->passwd = md5(pSQL(_COOKIE_KEY_ . rand()));
$customer->last_passwd_gen = pSQL(date('Y-m-d H:i:s'));
$customer->newsletter = 0;
$customer->lastname = pSQL($order['familyname']);
$customer->firstname = pSQL($order['firstname']);
$customer->active = 1;
$customer->add();
$id_customer = $customer->id;
}
// Search if address exists
$id_address = (int) Db::getInstance()->getValue('SELECT `id_address` FROM `' . _DB_PREFIX_ . 'address` WHERE `id_customer` = ' . (int) $id_customer . ' AND `alias` = \'eBay\'');
if ($id_address > 0) {
$address = new Address((int) $id_address);
} else {
$address = new Address();
$address->id_customer = (int) $id_customer;
}
$address->id_country = (int) Country::getByIso($order['country_iso_code']);
$address->alias = 'eBay';
$address->lastname = pSQL($order['familyname']);
$address->firstname = pSQL($order['firstname']);
$address->address1 = pSQL($order['address1']);
$address->address2 = pSQL($order['address2']);
$address->postcode = pSQL($order['postalcode']);
$address->city = pSQL($order['city']);
$address->phone = pSQL($order['phone']);
$address->active = 1;
if ($id_address > 0 && Validate::isLoadedObject($address)) {
$address->update();
} else {
$address->add();
}
$id_address = $address->id;
$flag = 1;
foreach ($order['product_list'] as $product) {
if ((int) $product['id_product'] < 1 || !Db::getInstance()->getValue('SELECT `id_product` FROM `' . _DB_PREFIX_ . 'product` WHERE `id_product` = ' . (int) $product['id_product'])) {
$flag = 0;
}
if (isset($product['id_product_attribute']) && $product['id_product_attribute'] > 0 && !Db::getInstance()->getValue('SELECT `id_product_attribute` FROM `' . _DB_PREFIX_ . 'product_attribute` WHERE `id_product` = ' . (int) $product['id_product'] . ' AND `id_product_attribute` = ' . (int) $product['id_product_attribute'])) {
$flag = 0;
}
}
if ($flag == 1) {
$cartNbProducts = 0;
$cartAdd = new Cart();
$cartAdd->id_customer = $id_customer;
$cartAdd->id_address_invoice = $id_address;
//.........这里部分代码省略.........
示例7: Cart
//Display cart content.
require_once 'model/cart.php';
require_once 'view/cart.php';
$cart = new Cart($user->userName, $session);
if (!$_POST) {
if ($cart->getCid()) {
$cartPanel = new cartView($cart);
$cartPanel->addBn();
} else {
return $boxMsg[] = "You have no items in your carts.";
}
}
} else {
return $boxMsg[] = "Please login first.";
}
// Check if there is user input.
if (isset($_POST["submitQty"])) {
$cart->getCid();
$cart->input($_POST["productId"], $_POST["cartQtyBox"]);
if ($cart->getDifferences() === false) {
return $boxMsg[] = "Please change the amount before clicking on the submit button.";
} else {
if ($_POST["cartQtyBox"] === 0) {
return $boxMsg[] = $cart->delete();
// deletes the sku from cart completely.
} else {
return $boxMsg[] = $cart->add();
// while the name is "add", it really indicate changes to amount that don't delete sku from cart.
}
}
}
示例8: function
$app->on('GET /api/cart', function () {
$cart = isset($_SESSION['cart']) ? $_SESSION['cart'] : [];
$this->json($cart);
});
$app->on('POST /api/cart', function () {
$cart = new Cart();
$a = $cart->add($this->body);
$this->json($a);
});
$app->on('PUT /api/cart/:?/:?', function ($productid, $action) {
$cart = new Cart();
$a = $cart->update($productid, $action);
$this->json($a);
});
$app->on('DELETE /api/cart/:?', function ($productid) {
$cart = new Cart();
$a = $cart->delete($productid);
$this->json($a);
});
// CHECKOUT API
// ================
$app->on('GET /api/checkout', function () {
$checkout = new Checkout();
$a = $checkout->summary();
$this->json($a);
});
$app->on('POST /api/checkout', function () {
$checkout = new Checkout();
$a = $checkout->validate($this->body);
$this->json($a);
});