当前位置: 首页>>代码示例>>PHP>>正文


PHP osC_Product::restock方法代码示例

本文整理汇总了PHP中osC_Product::restock方法的典型用法代码示例。如果您正苦于以下问题:PHP osC_Product::restock方法的具体用法?PHP osC_Product::restock怎么用?PHP osC_Product::restock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在osC_Product的用法示例。


在下文中一共展示了osC_Product::restock方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _updateStatus

 function _updateStatus($id, $data)
 {
     global $osC_Database, $osC_Language, $orders_status_array;
     $error = false;
     $osC_Database->startTransaction();
     $orders_status = osC_OrdersStatus_Admin::getData($data['status_id']);
     if ($orders_status['downloads_flag'] == 1) {
         osC_Order::activeDownloadables($id);
     }
     if ($orders_status['gift_certificates_flag'] == 1) {
         osC_Order::activeGiftCertificates($id);
     }
     if ($data['status_id'] == ORDERS_STATUS_CANCELLED && $data['restock_products'] == true) {
         $Qproducts = $osC_Database->query('select orders_products_id, products_id, products_type, products_quantity from :table_orders_products where orders_id = :orders_id');
         $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
         $Qproducts->bindInt(':orders_id', $id);
         $Qproducts->execute();
         while ($Qproducts->next()) {
             $result = osC_Product::restock($id, $Qproducts->valueInt('orders_products_id'), $Qproducts->valueInt('products_id'), $Qproducts->valueInt('products_quantity'));
             if ($result == false) {
                 $error = true;
                 break;
             }
         }
     }
     $Qupdate = $osC_Database->query('update :table_orders set orders_status = :orders_status, last_modified = now() where orders_id = :orders_id');
     $Qupdate->bindTable(':table_orders', TABLE_ORDERS);
     $Qupdate->bindInt(':orders_status', $data['status_id']);
     $Qupdate->bindInt(':orders_id', $id);
     $Qupdate->setLogging($_SESSION['module'], $id);
     $Qupdate->execute();
     if (!$osC_Database->isError()) {
         $Qupdate = $osC_Database->query('insert into :table_orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values (:orders_id, :orders_status_id, now(), :customer_notified, :comments)');
         $Qupdate->bindTable(':table_orders_status_history', TABLE_ORDERS_STATUS_HISTORY);
         $Qupdate->bindInt(':orders_id', $id);
         $Qupdate->bindInt(':orders_status_id', $data['status_id']);
         $Qupdate->bindInt(':customer_notified', $data['notify_customer'] === true ? '1' : '0');
         $Qupdate->bindValue(':comments', $data['comment']);
         $Qupdate->setLogging($_SESSION['module'], $id);
         $Qupdate->execute();
         if ($osC_Database->isError()) {
             $error = true;
         }
         if ($data['notify_customer'] === true) {
             $Qorder = $osC_Database->query('select o.customers_name, o.customers_email_address, s.orders_status_name, o.date_purchased from :table_orders o, :table_orders_status s where o.orders_status = s.orders_status_id and s.language_id = :language_id and o.orders_id = :orders_id');
             $Qorder->bindTable(':table_orders', TABLE_ORDERS);
             $Qorder->bindTable(':table_orders_status', TABLE_ORDERS_STATUS);
             $Qorder->bindInt(':language_id', $osC_Language->getID());
             $Qorder->bindInt(':orders_id', $id);
             $Qorder->execute();
             require_once '../includes/classes/email_template.php';
             $email_template = toC_Email_Template::getEmailTemplate('admin_order_status_updated');
             $email_template->setData($id, osc_href_link(FILENAME_ACCOUNT, 'orders=' . $id, 'SSL', false, true, true), osC_DateTime::getLong($Qorder->value('date_purchased')), $data['append_comment'], $data['comment'], $Qorder->value('orders_status_name'), $Qorder->value('customers_name'), $Qorder->value('customers_email_address'));
             $email_template->buildMessage();
             $email_template->sendEmail();
         }
     } else {
         $error = true;
     }
     if ($error === false) {
         $osC_Database->commitTransaction();
         return true;
     }
     $osC_Database->rollbackTransaction();
     return false;
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:66,代码来源:orders.php

示例2: deleteProduct

 function deleteProduct($orders_products_id)
 {
     global $osC_Database;
     $error = false;
     $osC_Database->startTransaction();
     //find products_id_string
     $products_id_string = '';
     foreach ($this->_contents as $tmp_products_id_string => $tmp_product) {
         if ($orders_products_id == $this->_contents[$tmp_products_id_string]['orders_products_id']) {
             $products_id_string = $tmp_products_id_string;
         }
     }
     $products_id = osc_get_product_id($products_id_string);
     $osC_Product = new osC_Product($products_id, $this->getCustomer('customers_id'));
     $restock = osC_Product::restock($this->_order_id, $orders_products_id, osc_get_product_id($products_id_string), $this->_contents[$products_id_string]['quantity']);
     if ($restock === true) {
         $QdeleteVariants = $osC_Database->query('delete from :table_orders_products_variants where orders_products_id = :orders_products_id ');
         $QdeleteVariants->bindTable(':table_orders_products_variants', TABLE_ORDERS_PRODUCTS_VARIANTS);
         $QdeleteVariants->bindInt(':orders_products_id', $orders_products_id);
         $QdeleteVariants->setLogging($_SESSION['module'], $this->_order_id);
         $QdeleteVariants->execute();
         if ($osC_Database->isError()) {
             $error = true;
         } else {
             $Qdelete = $osC_Database->query('delete from :table_orders_products where orders_products_id = :orders_products_id ');
             $Qdelete->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
             $Qdelete->bindInt(':orders_products_id', $orders_products_id);
             $Qdelete->setLogging($_SESSION['module'], $this->_order_id);
             $Qdelete->execute();
             if ($osC_Product->getProductType() == PRODUCT_TYPE_DOWNLOADABLE) {
                 $Qopd = $osC_Database->query('delete from :table_orders_products_download where orders_products_id = :orders_products_id');
                 $Qopd->bindTable(':table_orders_products_download', TABLE_ORDERS_PRODUCTS_DOWNLOAD);
                 $Qopd->bindInt(':orders_products_id', $orders_products_id);
                 $Qopd->setLogging($_SESSION['module'], $this->_order_id);
                 $Qopd->execute();
             }
             if ($osC_Product->getProductType() == PRODUCT_TYPE_GIFT_CERTIFICATE) {
                 $Qgc = $osC_Database->query('delete from :table_gift_certificates where orders_products_id = :orders_products_id');
                 $Qgc->bindTable(':table_gift_certificates', TABLE_GIFT_CERTIFICATES);
                 $Qgc->bindInt(':orders_products_id', $orders_products_id);
                 $Qgc->setLogging($_SESSION['module'], $this->_order_id);
                 $Qgc->execute();
             }
             if ($osC_Database->isError()) {
                 $error = true;
             } else {
                 unset($this->_contents[$products_id_string]);
             }
         }
     }
     if ($error === false) {
         $osC_Database->commitTransaction();
         $this->_calculate(true);
         $this->updateOrderTotal();
         return true;
     }
     $osC_Database->rollbackTransaction();
     return false;
 }
开发者ID:sajad1441,项目名称:TomatoShop-v1,代码行数:59,代码来源:shopping_cart_adapter.php

示例3: delete

 function delete($id, $restock = false)
 {
     global $osC_Database;
     $error = false;
     $osC_Database->startTransaction();
     if ($restock === true) {
         $Qproducts = $osC_Database->query('select orders_products_id, products_id, products_type, products_quantity from :table_orders_products where orders_id = :orders_id');
         $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
         $Qproducts->bindInt(':orders_id', $id);
         $Qproducts->execute();
         while ($Qproducts->next()) {
             $result = osC_Product::restock($id, $Qproducts->valueInt('orders_products_id'), $Qproducts->valueInt('products_id'), $Qproducts->valueInt('products_quantity'));
             if ($result == false) {
                 $error = true;
                 break;
             }
         }
     }
     if ($error === false) {
         $Qproducts = $osC_Database->query('delete from :table_orders_refunds_products where orders_refunds_id = (select orders_refunds_id from :table_orders_refunds where orders_id = :orders_id) ');
         $Qproducts->bindTable(':table_orders_refunds_products', TABLE_ORDERS_REFUNDS_PRODUCTS);
         $Qproducts->bindTable(':table_orders_refunds', TABLE_ORDERS_REFUNDS);
         $Qproducts->bindInt(':orders_id', $id);
         $Qproducts->setLogging($_SESSION['module'], $id);
         $Qproducts->execute();
         if ($osC_Database->isError() === true) {
             $error = true;
         }
     }
     if ($error === false) {
         $Qrefunds = $osC_Database->query('delete from :table_orders_refunds where orders_id = :orders_id');
         $Qrefunds->bindTable(':table_orders_refunds', TABLE_ORDERS_REFUNDS);
         $Qrefunds->bindInt(':orders_id', $id);
         $Qrefunds->setLogging($_SESSION['module'], $id);
         $Qrefunds->execute();
         if ($osC_Database->isError() === true) {
             $error = true;
         }
     }
     if ($error === false) {
         $Qproducts = $osC_Database->query('delete from :table_orders_returns_products where orders_returns_id = (select orders_returns_id from :table_orders_returns where orders_id = :orders_id) ');
         $Qproducts->bindTable(':table_orders_returns_products', TABLE_ORDERS_RETURNS_PRODUCTS);
         $Qproducts->bindTable(':table_orders_returns', TABLE_ORDERS_RETURNS);
         $Qproducts->bindInt(':orders_id', $id);
         $Qproducts->setLogging($_SESSION['module'], $id);
         $Qproducts->execute();
         if ($osC_Database->isError() === true) {
             $error = true;
         }
     }
     if ($error === false) {
         $Qreturns = $osC_Database->query('delete from :table_orders_returns where orders_id = :orders_id');
         $Qreturns->bindTable(':table_orders_returns', TABLE_ORDERS_RETURNS);
         $Qreturns->bindInt(':orders_id', $id);
         $Qreturns->setLogging($_SESSION['module'], $id);
         $Qreturns->execute();
         if ($osC_Database->isError() === true) {
             $error = true;
         }
     }
     if ($error === false) {
         $Qopd = $osC_Database->query('delete from :table_orders_products_download where orders_id = :orders_id');
         $Qopd->bindTable(':table_orders_products_download', TABLE_ORDERS_PRODUCTS_DOWNLOAD);
         $Qopd->bindInt(':orders_id', $id);
         $Qopd->setLogging($_SESSION['module'], $id);
         $Qopd->execute();
         if ($osC_Database->isError() === true) {
             $error = true;
         }
     }
     if ($error === false) {
         $Qgc = $osC_Database->query('delete from :table_gift_certificates where orders_id = :orders_id');
         $Qgc->bindTable(':table_gift_certificates', TABLE_GIFT_CERTIFICATES);
         $Qgc->bindInt(':orders_id', $id);
         $Qgc->setLogging($_SESSION['module'], $id);
         $Qgc->execute();
         if ($osC_Database->isError() === true) {
             $error = true;
         }
     }
     if ($error === false) {
         $Qopa = $osC_Database->query('delete from :table_orders_products_variants where orders_id = :orders_id');
         $Qopa->bindTable(':table_orders_products_variants', TABLE_ORDERS_PRODUCTS_VARIANTS);
         $Qopa->bindInt(':orders_id', $id);
         $Qopa->setLogging($_SESSION['module'], $id);
         $Qopa->execute();
         if ($osC_Database->isError() === true) {
             $error = true;
         }
     }
     if ($error === false) {
         $Qop = $osC_Database->query('delete from :table_orders_products where orders_id = :orders_id');
         $Qop->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
         $Qop->bindInt(':orders_id', $id);
         $Qop->setLogging($_SESSION['module'], $id);
         $Qop->execute();
         if ($osC_Database->isError() === true) {
             $error = true;
         }
     }
//.........这里部分代码省略.........
开发者ID:Doluci,项目名称:tomatocart,代码行数:101,代码来源:order.php

示例4: createStoreCredit

 function createStoreCredit($data)
 {
     global $osC_Database, $osC_Language;
     $error = false;
     $osC_Database->startTransaction();
     //order refund
     $Qinsert = $osC_Database->query('insert into :table_orders_refunds (orders_refunds_type, orders_id, credit_slips_id, sub_total, shipping, handling, refund_total, comments, date_added) values (:orders_refunds_type, :orders_id, :credit_slips_id, :sub_total, :shipping, :handling, :refund_total, :comments, now())');
     $Qinsert->bindTable(':table_orders_refunds', TABLE_ORDERS_REFUNDS);
     $Qinsert->bindInt(':orders_refunds_type', ORDERS_RETURNS_TYPE_STORE_CREDIT);
     $Qinsert->bindInt(':orders_id', $data['orders_id']);
     $Qinsert->bindRaw(':credit_slips_id', 'null');
     $Qinsert->bindValue(':sub_total', $data['sub_total']);
     $Qinsert->bindValue(':shipping', $data['shipping_fee']);
     $Qinsert->bindValue(':handling', $data['handling']);
     $Qinsert->bindValue(':refund_total', $data['sub_total'] + $data['shipping_fee'] + $data['handling']);
     $Qinsert->bindValue(':comments', $data['comments']);
     $Qinsert->setLogging($_SESSION['module'], null);
     $Qinsert->execute();
     if ($osC_Database->isError()) {
         $error = true;
     } else {
         $orders_refunds_id = $osC_Database->nextID();
         //orders refunds products
         $return_products = explode(';', $data['return_quantity']);
         foreach ($return_products as $product) {
             list($orders_products_id, $quantity) = explode(':', $product);
             $Qproduct = $osC_Database->query('insert into :table_orders_refunds_products (orders_refunds_id, orders_products_id, products_quantity) values (:orders_refunds_id, :orders_products_id, :products_quantity)');
             $Qproduct->bindTable(':table_orders_refunds_products', TABLE_ORDERS_REFUNDS_PRODUCTS);
             $Qproduct->bindInt(':orders_refunds_id', $orders_refunds_id);
             $Qproduct->bindInt(':orders_products_id', $orders_products_id);
             $Qproduct->bindInt(':products_quantity', $quantity);
             $Qproduct->setLogging($_SESSION['module'], $orders_refunds_id);
             $Qproduct->execute();
             if ($osC_Database->isError()) {
                 $error = true;
                 break;
             }
             if ($error === false) {
                 $Qupdate = $osC_Database->query('update :table_orders_products set products_return_quantity = products_return_quantity + :products_return_quantity where orders_products_id = :orders_products_id');
                 $Qupdate->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
                 $Qupdate->bindInt(':products_return_quantity', $quantity);
                 $Qupdate->bindInt(':orders_products_id', $orders_products_id);
                 $Qupdate->setLogging($_SESSION['module'], $orders_refunds_id);
                 $Qupdate->execute();
                 if ($osC_Database->isError()) {
                     $error = true;
                     break;
                 }
             }
             if ($error === false && $data['restock_quantity'] === true) {
                 $Qcheck = $osC_Database->query('select products_id from :table_orders_products where orders_products_id = :orders_products_id and orders_id = :orders_id');
                 $Qcheck->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
                 $Qcheck->bindInt(':orders_products_id', $orders_products_id);
                 $Qcheck->bindInt(':orders_id', $data['orders_id']);
                 $Qcheck->setLogging($_SESSION['module'], $orders_refunds_id);
                 $Qcheck->execute();
                 $products_id = $Qcheck->valueInt('products_id');
                 if (!osC_Product::restock($data['orders_id'], $orders_products_id, $products_id, $quantity)) {
                     $error = true;
                     break;
                 }
             }
         }
     }
     if ($error === false) {
         $Qreturn = $osC_Database->query('update :table_orders_returns set orders_returns_status_id = :orders_returns_status_id, admin_comments = :admin_comments, date_updated = now() where orders_returns_id = :id');
         $Qreturn->bindTable(':table_orders_returns', TABLE_ORDERS_RETURNS);
         $Qreturn->bindInt(':orders_returns_status_id', ORDERS_RETURNS_STATUS_REFUNDED_STORE_CREDIT);
         $Qreturn->bindValue(':admin_comments', $data['comment']);
         $Qreturn->bindInt(':id', $data['orders_returns_id']);
         $Qreturn->setLogging($_SESSION['module'], $data['orders_returns_id']);
         $Qreturn->execute();
         if ($osC_Database->isError()) {
             $error = true;
         }
     }
     if ($error === false) {
         $Qcustomer = $osC_Database->query('select customers_id from :table_orders where orders_id = :orders_id');
         $Qcustomer->bindTable(':table_orders', TABLE_ORDERS);
         $Qcustomer->bindInt(':orders_id', $data['orders_id']);
         $Qcustomer->execute();
         $customers_id = $Qcustomer->valueInt('customers_id');
         $Qhistory = $osC_Database->query('insert into :table_customers_credits_history (customers_id, action_type, date_added, amount, comments) values (:customers_id, :action_type, now(), :amount, :comments)');
         $Qhistory->bindTable(':table_customers_credits_history', TABLE_CUSTOMERS_CREDITS_HISTORY);
         $Qhistory->bindInt(':customers_id', $customers_id);
         $Qhistory->bindInt(':action_type', STORE_CREDIT_ACTION_TYPE_ORDER_REFUNDED);
         $Qhistory->bindValue(':amount', $data['sub_total'] + $data['shipping_fee'] + $data['handling']);
         $Qhistory->bindValue(':comments', sprintf($osC_Language->get('infomation_store_credit_from_order'), $data['orders_id']));
         $Qhistory->execute();
         if ($osC_Database->isError()) {
             $error = true;
         }
         if ($error === false) {
             $Qupdate = $osC_Database->query('update :table_customers set customers_credits = (customers_credits + :customers_credits) where customers_id = :customers_id');
             $Qupdate->bindTable(':table_customers', TABLE_CUSTOMERS);
             $Qupdate->bindRaw(':customers_credits', $data['sub_total'] + $data['shipping_fee'] + $data['handling']);
             $Qupdate->bindInt(':customers_id', $customers_id);
             $Qupdate->setLogging($_SESSION['module'], $data['$orders_refunds_id']);
             $Qupdate->execute();
             if ($osC_Database->isError()) {
//.........这里部分代码省略.........
开发者ID:sajad1441,项目名称:TomatoShop-v1,代码行数:101,代码来源:orders_returns.php


注:本文中的osC_Product::restock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。