✏️ 正在编辑: Order.php
路径:
/home/bpioifn/www/pigmentse/override/classes/order/Order.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Order extends OrderCore { /* * module: axepta * date: 2022-06-30 16:28:22 * version: 1.0.14 */ public static function generateReference() { $id_cart = (int)Context::getContext()->cart->id; $reference = self::getReferenceByCartId($id_cart); if (empty($reference)) { $reference = Tools::strtoupper(Tools::passwdGen(9)); } return $reference; } /* * module: axepta * date: 2022-06-30 16:28:22 * version: 1.0.14 */ public static function getReferenceByCartId($id_cart) { if (empty($id_cart)) { return false; } $sql = 'SELECT `reference` FROM `'._DB_PREFIX_.'axepta_order_reference` WHERE `id_cart` ='.pSQL((int)$id_cart); return Db::getInstance()->getValue($sql); } /* * module: axepta * date: 2022-06-30 16:28:22 * version: 1.0.14 */ public function getOrderPaymentCollection() { if ($this->module == 'axepta') { $order_payments = new PrestaShopCollection('OrderPayment'); $order_payments->where('order_reference', '=', $this->reference); $order_payments->orderBy('date_add'); $transactions = $this->getTransactionByOrderIdOrderByDate(); $i_payment = 0; $found = false; while (!$found && $i_payment < count($order_payments)) { foreach ($transactions as $transaction) { if ($order_payments[$i_payment]->transaction_id == $transaction['pay_id'] || $transaction['amount'] == $order_payments[$i_payment]->amount) { // pay_id is in order_payment $found = true; if ($transaction['payment_mean_brand'] != 'N/A' && ($transaction['trigram'] == 'CVM' || $transaction['trigram'] == 'VIM')) { $order_payments[$i_payment]->payment_method = $transaction['payment_mean_brand']; } else { $sql = 'SELECT `code` FROM `' . _DB_PREFIX_ . 'axepta_xml_method` WHERE `trigram` = "'.$transaction['trigram'].'"'; $code = Db::getInstance()->getValue($sql); $order_payments[$i_payment]->payment_method = $code; } } } $i_payment++; } return $order_payments; } else { return parent::getOrderPaymentCollection(); } } /* * module: axepta * date: 2022-06-30 16:28:22 * version: 1.0.14 */ public function getTransactionByOrderIdOrderByDate() { if (empty($this->id)) { return false; } return Db::getInstance()->executeS(' SELECT * FROM `' . _DB_PREFIX_ . 'axepta_transaction` WHERE `id_order` = "' . pSQL((int) $this->id) . '" ORDER BY `transaction_date` ASC '); } }
💾 保存文件
← 返回文件管理器