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


PHP VirtueMartModelOrders::genStdOrderPass方法代码示例

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


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

示例1: portOrders

    function portOrders()
    {
        if (microtime(true) - $this->starttime >= $this->maxScriptTime) {
            return;
        }
        if (!class_exists('VirtueMartModelOrderstatus')) {
            require VMPATH_ADMIN . DS . 'models' . DS . 'orderstatus.php';
        }
        if (!class_exists('ShopFunctions')) {
            require VMPATH_ADMIN . DS . 'helpers' . DS . 'shopfunctions.php';
        }
        $this->_db->setQuery('select `order_status_code` FROM `#__virtuemart_orderstates` ');
        $vm2Fields = $this->_db->loadColumn();
        $this->_db->setQuery('select * FROM `#__vm_order_status`');
        $oldfields = $this->_db->loadObjectList();
        $migratedfields = '';
        foreach ($oldfields as $field) {
            if (!in_array($field->order_status_code, $vm2Fields)) {
                $q = 'INSERT INTO `#__virtuemart_orderstates` ( `virtuemart_vendor_id`, `order_status_code`, `order_status_name`, `order_status_description`, `order_stock_handle`, `ordering`, `published`)
					VALUES ( "' . $field->vendor_id . '","' . $field->order_status_code . '","' . $field->order_status_name . '","' . $field->order_status_description . '","A","' . $field->list_order . '", 1 )';
                $this->_db->setQuery($q);
                $this->_db->execute();
                if ($this->_db->getErrorNum()) {
                    vmError($this->_db->getErrorMsg());
                }
                $migratedfields .= '[' . $field->order_status_code . '-' . $field->order_status_name . '] ';
            }
        }
        if ($migratedfields) {
            vminfo('order states declaration ' . $migratedfields . ' Migrated');
        }
        $oldtonewOrders = array();
        //Looks like there is a problem, when the data gets tooo big,
        //solved now with query directly ignoring already ported orders.
        $alreadyKnownIds = $this->getMigrationProgress('orders');
        $newproductIds = $this->getMigrationProgress('products');
        $orderCodeToId = $this->createOrderStatusAssoc();
        //approximatly 100 products take a 1 MB
        $maxItems = $this->_getMaxItems('Orders');
        $startLimit = $this->_getStartLimit('orders_start');
        vmdebug('portOrders $startLimit ' . $startLimit);
        $i = 0;
        if (count($alreadyKnownIds) == $startLimit + $maxItems) {
            $continue = false;
        } else {
            $continue = true;
        }
        $reWriteOrderNumber = vRequest::getInt('reWriteOrderNumber', 0);
        $userOrderId = vRequest::getInt('userOrderId', 0);
        if (!class_exists('VirtueMartModelOrders')) {
            VmModel::getModel('orders');
        }
        while ($continue) {
            $q = 'SELECT `o`.*, `op`.*, `o`.`order_number` as `vm1_order_number`, `o2`.`order_number` as `nr2`,`o`.order_id FROM `#__vm_orders` as `o`
				LEFT OUTER JOIN `#__vm_order_payment` as `op` ON `op`.`order_id` = `o`.`order_id`
				LEFT JOIN `#__virtuemart_orders` as `o2` ON `o2`.`order_number` = `o`.`order_number`
				WHERE (o2.order_number) IS NULL ORDER BY o.order_id LIMIT ' . $startLimit . ',' . $maxItems;
            $doneStart = $startLimit;
            $res = self::loadCountListContinue($q, $startLimit, $maxItems, 'port Orders');
            $oldOrders = $res[0];
            $startLimit = $res[1];
            $continue = $res[2];
            foreach ($oldOrders as $order) {
                if (!array_key_exists($order['order_id'], $alreadyKnownIds)) {
                    $orderData = new stdClass();
                    $orderData->virtuemart_order_id = null;
                    $orderData->virtuemart_user_id = $order['user_id'];
                    $orderData->virtuemart_vendor_id = $order['vendor_id'];
                    if ($reWriteOrderNumber == 0) {
                        if ($userOrderId == 1) {
                            $orderData->order_number = $order['order_id'];
                        } else {
                            $orderData->order_number = $order['vm1_order_number'];
                        }
                    }
                    $orderData->order_pass = VirtueMartModelOrders::genStdOrderPass();
                    //Note as long we do not have an extra table only storing addresses, the virtuemart_userinfo_id is not needed.
                    //The virtuemart_userinfo_id is just the id of a stored address and is only necessary in the user maintance view or for choosing addresses.
                    //the saved order should be an snapshot with plain data written in it.
                    //		$orderData->virtuemart_userinfo_id = 'TODO'; // $_cart['BT']['virtuemart_userinfo_id']; // TODO; Add it in the cart... but where is this used? Obsolete?
                    $orderData->order_total = $order['order_total'];
                    $orderData->order_subtotal = $order['order_subtotal'];
                    $orderData->order_tax = empty($order['order_tax']) ? 0 : $order['order_tax'];
                    $orderData->order_shipment = empty($order['order_shipping']) ? 0 : $order['order_shipping'];
                    $orderData->order_shipment_tax = empty($order['order_shipping_tax']) ? 0 : $order['order_shipping_tax'];
                    if (!empty($order['coupon_code'])) {
                        $orderData->coupon_code = $order['coupon_code'];
                        $orderData->coupon_discount = $order['coupon_discount'];
                    }
                    $orderData->order_discount = $order['order_discount'];
                    $orderData->order_status = $order['order_status'];
                    if (isset($order['order_currency'])) {
                        $orderData->user_currency_id = $this->getCurrencyIdByCode($order['order_currency']);
                        //$orderData->user_currency_rate = $order['order_status'];
                    }
                    $orderData->virtuemart_paymentmethod_id = $order['payment_method_id'];
                    $orderData->virtuemart_shipmentmethod_id = $order['ship_method_id'];
                    //$orderData->order_status_id = $oldToNewOrderstates[$order['order_status']]
                    $_filter = JFilterInput::getInstance(array('br', 'i', 'em', 'b', 'strong'), array(), 0, 0, 1);
                    $orderData->customer_note = $_filter->clean($order['customer_note']);
//.........这里部分代码省略.........
开发者ID:thumbs-up-sign,项目名称:TuVanDuAn,代码行数:101,代码来源:migrator.php

示例2: check

 function check()
 {
     if (empty($this->order_number)) {
         if (!class_exists('VirtueMartModelOrders')) {
             VmModel::getModel('orders');
         }
         $this->order_number = VirtueMartModelOrders::genStdOrderNumber($this->virtuemart_vendor_id);
     }
     if (empty($this->order_pass)) {
         if (!class_exists('VirtueMartModelOrders')) {
             VmModel::getModel('orders');
         }
         $this->order_pass = VirtueMartModelOrders::genStdOrderPass();
     }
     if ($adminID = vmAccess::getBgManagerId()) {
         $this->created_by = $adminID;
     }
     return parent::check();
 }
开发者ID:sam-akopyan,项目名称:hamradio,代码行数:19,代码来源:orders.php


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