當前位置: 首頁>>代碼示例>>PHP>>正文


PHP VmTable::delete方法代碼示例

本文整理匯總了PHP中VmTable::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP VmTable::delete方法的具體用法?PHP VmTable::delete怎麽用?PHP VmTable::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在VmTable的用法示例。


在下文中一共展示了VmTable::delete方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: delete

    /**
     * Overloaded delete() to delete records from order_userinfo and order payment as well,
     * and write a record to the order history (TODO Or should the hist table be cleaned as well?)
     *
     * @var integer Order id
     * @return boolean True on success
     * @author Oscar van Eijk
     * @author Kohl Patrick
     */
    function delete($id = null, $where = 0)
    {
        $this->_db->setQuery('DELETE from `#__virtuemart_order_userinfos` WHERE `virtuemart_order_id` = ' . $id);
        if ($this->_db->query() === false) {
            vmError($this->_db->getError());
            return false;
        }
        /*vm_order_payment NOT EXIST  have to find the table name*/
        $this->_db->setQuery('SELECT `payment_element` FROM `#__virtuemart_paymentmethods` , `#__virtuemart_orders`
			WHERE `#__virtuemart_paymentmethods`.`virtuemart_paymentmethod_id` = `#__virtuemart_orders`.`virtuemart_paymentmethod_id` AND `virtuemart_order_id` = ' . $id);
        $paymentTable = '#__virtuemart_payment_plg_' . $this->_db->loadResult();
        $this->_db->setQuery('DELETE from `' . $paymentTable . '` WHERE `virtuemart_order_id` = ' . $id);
        if ($this->_db->query() === false) {
            vmError($this->_db->getError());
            return false;
        }
        /*vm_order_shipment NOT EXIST  have to find the table name*/
        $this->_db->setQuery('SELECT `shipment_element` FROM `#__virtuemart_shipmentmethods` , `#__virtuemart_orders`
			WHERE `#__virtuemart_shipmentmethods`.`virtuemart_shipmentmethod_id` = `#__virtuemart_orders`.`virtuemart_shipmentmethod_id` AND `virtuemart_order_id` = ' . $id);
        $shipmentName = $this->_db->loadResult();
        if (empty($shipmentName)) {
            vmError('Seems the used shipmentmethod got deleted');
            //Can we securely prevent this just using
            //	'SELECT `shipment_element` FROM `#__virtuemart_shipmentmethods` , `#__virtuemart_orders`
            //	WHERE `#__virtuemart_shipmentmethods`.`virtuemart_shipmentmethod_id` = `#__virtuemart_orders`.`virtuemart_shipmentmethod_id` AND `virtuemart_order_id` = ' . $id );
        } else {
            $shipmentTable = '#__virtuemart_shipment_plg_' . $shipmentName;
            $this->_db->setQuery('DELETE from `' . $shipmentTable . '` WHERE `virtuemart_order_id` = ' . $id);
            if ($this->_db->query() === false) {
                vmError('TableOrders delete Order shipmentTable = ' . $shipmentTable . ' `virtuemart_order_id` = ' . $id . ' dbErrorMsg ' . $this->_db->getError());
                return false;
            }
        }
        $_q = 'INSERT INTO `#__virtuemart_order_histories` (' . ' virtuemart_order_history_id' . ',virtuemart_order_id' . ',order_status_code' . ',created_on' . ',customer_notified' . ',comments' . ') VALUES (' . ' NULL' . ',' . $id . ",'-'" . ',NOW()' . ',0' . ",'Order deleted'" . ')';
        $this->_db->setQuery($_q);
        $this->_db->query();
        // Ignore error here
        return parent::delete($id);
    }
開發者ID:Roma48,項目名稱:abazherka_old,代碼行數:48,代碼來源:orders.php

示例2: delete

    /**
     * Overloaded delete() to delete records from order_userinfo and order payment as well,
     * and write a record to the order history (TODO Or should the hist table be cleaned as well?)
     *
     * @var integer Order id
     * @return boolean True on success
     * @author Oscar van Eijk
     * @author Kohl Patrick
     */
    function delete($id)
    {
        $this->_db->setQuery('DELETE from `#__virtuemart_order_userinfos` WHERE `virtuemart_order_id` = ' . $id);
        if ($this->_db->query() === false) {
            vmError($this->_db->getError());
            return false;
        }
        /*vm_order_payment NOT EXIST  have to find the table name*/
        $this->_db->setQuery('SELECT `payment_element` FROM `#__virtuemart_paymentmethods` , `#__virtuemart_orders`
			WHERE `#__virtuemart_paymentmethods`.`virtuemart_paymentmethod_id` = `#__virtuemart_orders`.`virtuemart_paymentmethod_id` AND `virtuemart_order_id` = ' . $id);
        $paymentTable = '#__virtuemart_payment_plg_' . $this->_db->loadResult();
        $this->_db->setQuery('DELETE from `' . $paymentTable . '` WHERE `virtuemart_order_id` = ' . $id);
        if ($this->_db->query() === false) {
            vmError($this->_db->getError());
            return false;
        }
        /*vm_order_shipment NOT EXIST  have to find the table name*/
        $this->_db->setQuery('SELECT `shipment_element` FROM `#__virtuemart_shipmentmethods` , `#__virtuemart_orders`
			WHERE `#__virtuemart_shipmentmethods`.`virtuemart_shipmentmethod_id` = `#__virtuemart_orders`.`virtuemart_shipmentmethod_id` AND `virtuemart_order_id` = ' . $id);
        $shipmentTable = '#__virtuemart_shipment_plg_' . $this->_db->loadResult();
        $this->_db->setQuery('DELETE from `' . $shipmentTable . '` WHERE `virtuemart_order_id` = ' . $id);
        if ($this->_db->query() === false) {
            vmError($this->_db->getError());
            return false;
        }
        $_q = 'INSERT INTO `#__virtuemart_order_histories` (' . ' virtuemart_order_history_id' . ',virtuemart_order_id' . ',order_status_code' . ',created_on' . ',customer_notified' . ',comments' . ') VALUES (' . ' NULL' . ',' . $id . ",'-'" . ',NOW()' . ',0' . ",'Order deleted'" . ')';
        $this->_db->setQuery($_q);
        $this->_db->query();
        // Ignore error here
        return parent::delete($id);
    }
開發者ID:joselapria,項目名稱:virtuemart,代碼行數:40,代碼來源:orders.php


注:本文中的VmTable::delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。