✏️ 正在编辑: AdminPiOrders.php
路径:
/home/bpioifn/www/pigmentse/modules/pisponsors/controllers/admin/AdminPiOrders.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php # /modules/pisponsors/controllers/admin/AdminPiSponsorsAdmin.php /** * pi sponsors - A Prestashop Module * * pi sponsors * * @author pi sponsors <pi.sponsors@yopmail.com> * @version 0.0.1 */ if (!defined('_PS_VERSION_')) exit; if(!class_exists('PiSponsorsModel')); require_once _PS_MODULE_DIR_.'pisponsors/models/PiSponsors.php'; // You can now access this controller from /your_admin_directory/index.php?controller=AdminPiSponsorsAdmin class AdminPiOrdersController extends AdminOrdersControllerCore { public function __construct() { parent::__construct(); $this->bootstrap = true; $this->table = 'order'; $this->className = 'Order'; $this->lang = false; $this->explicitSelect = false; $this->allow_export = false; $this->deleted = false; //print_r($this->actions);die; $this->actions = []; $this->viewAccess(false); $this->_select = ' sp.name sponsor, a.id_currency, a.id_order AS id_pdf, CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`, osl.`name` AS `osname`, os.`color`, IF((SELECT so.id_order FROM `' . _DB_PREFIX_ . 'orders` so WHERE so.id_customer = a.id_customer AND so.id_order < a.id_order LIMIT 1) > 0, 0, 1) as new, country_lang.name as cname, IF(a.valid, 1, 0) badge_success'; $this->_join = ' LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON (c.`id_customer` = a.`id_customer`) INNER JOIN `' . _DB_PREFIX_ . 'pi_sponsors` sp ON (sp.`id_pi_sponsors` = c.`id_pi_sponsor`) INNER JOIN `' . _DB_PREFIX_ . 'address` address ON address.id_address = a.id_address_delivery INNER JOIN `' . _DB_PREFIX_ . 'country` country ON address.id_country = country.id_country INNER JOIN `' . _DB_PREFIX_ . 'country_lang` country_lang ON (country.`id_country` = country_lang.`id_country` AND country_lang.`id_lang` = ' . (int) $this->context->language->id . ') LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON (os.`id_order_state` = a.`current_state`) LEFT JOIN `' . _DB_PREFIX_ . 'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = ' . (int) $this->context->language->id . ')'; $this->_orderBy = 'id_order'; $this->_orderWay = 'DESC'; $this->_use_found_rows = true; $statuses = OrderState::getOrderStates((int) $this->context->language->id); foreach ($statuses as $status) { $this->statuses_array[$status['id_order_state']] = $status['name']; } $sponsors = PiSponsorsModel::getSponsors(); $sponsors_list = array(); foreach ($sponsors as $sponsor) { $sponsors_list[$sponsor['id_pi_sponsors']] = $sponsor['name']; } $this->fields_list = array( 'id_order' => array( 'title' => $this->trans('ID', array(), 'Admin.Global'), 'align' => 'text-center', 'class' => 'fixed-width-xs', ), 'reference' => array( 'title' => $this->trans('Reference', array(), 'Admin.Global'), ), 'new' => array( 'title' => $this->trans('New client', array(), 'Admin.Orderscustomers.Feature'), 'align' => 'text-center', 'type' => 'bool', 'tmpTableFilter' => true, 'orderby' => false, ), 'customer' => array( 'title' => $this->trans('Customer', array(), 'Admin.Global'), 'havingFilter' => true, ), ); if (Configuration::get('PS_B2B_ENABLE')) { $this->fields_list = array_merge($this->fields_list, array( 'company' => array( 'title' => $this->trans('Company', array(), 'Admin.Global'), 'filter_key' => 'c!company', ), )); } $this->fields_list = array_merge($this->fields_list, array( 'total_products' => array( 'title' => $this->trans('Total', array(), 'Admin.Global'), 'align' => 'text-right', 'type' => 'price', 'currency' => true, 'callback' => 'setOrderCurrency', 'badge_success' => true, ), 'payment' => array( 'title' => $this->trans('Payment', array(), 'Admin.Global'), ), 'osname' => array( 'title' => $this->trans('Status', array(), 'Admin.Global'), 'type' => 'select', 'color' => 'color', 'list' => $this->statuses_array, 'filter_key' => 'os!id_order_state', 'filter_type' => 'int', 'order_key' => 'osname', ), 'sponsor' => array( 'title' => $this->trans('Sponsor', array(), 'Admin.Global'), 'type' => 'select', 'list' => $sponsors_list, 'filter_key' => 'sp!id_pi_sponsors', 'filter_type' => 'int', 'order_key' => 'sponsor', ), 'date_add' => array( 'title' => $this->trans('Date', array(), 'Admin.Global'), 'align' => 'text-right', 'type' => 'datetime', 'filter_key' => 'a!date_add', ), )); } public static function setOrderCurrency($echo, $tr) { if (!empty($tr['id_currency'])) { $idCurrency = (int) $tr['id_currency']; } else { $order = new Order($tr['id_order']); $idCurrency = (int) $order->id_currency; } return Tools::displayPrice($echo, $idCurrency); } }
💾 保存文件
← 返回文件管理器