예제 #1
0
 public function __construct()
 {
     global $cookie;
     parent::__construct();
     $this->is_seller = $cookie->profile == (int) Configuration::get('AGILE_MS_PROFILE_ID');
     Shop::$id_shop_owner = $this->is_seller ? $cookie->id_employee : 0;
     if (Module::isInstalled('agilemultipleseller') and !isset($_GET['logout']) and $this->is_seller and (Tools::getValue("controller") == "" or Tools::getValue("controller") == "adminhome")) {
         $tid = Tab::getIdFromClassName('AdminProducts');
         $token = Tools::getAdminToken('AdminProducts' . intval($tid) . intval($cookie->id_employee));
         Tools::redirectAdmin("./index.php?controller=AdminProducts&token=" . $token);
     }
     if (Module::isInstalled('agilesellerlistoptions')) {
         require_once _PS_ROOT_DIR_ . '/modules/agilesellerlistoptions/agilesellerlistoptions.php';
         $aslo_module = new AgileSellerListOptions();
         $msg = $aslo_module->hookAgileAdminTop(null);
         if (!empty($msg)) {
             $this->displayWarning($msg);
         }
     }
     $tab = Tab::getInstanceFromClassName('AdminShopGroup');
     if (Module::isInstalled('agilemultipleshop')) {
         $tab->active = 1;
     } else {
         $tab->active = 0;
     }
     $tab->update();
 }
    public function __construct()
    {
        $this->bootstrap = true;
        $this->table = 'neo_whitelist';
        $this->identifier = 'id_neo_whitelist';
        $this->className = 'NeoWhitelist';
        $this->deleted = false;
        $this->explicitSelect = true;
        $this->allow_export = true;
        $this->addRowAction('edit');
        $this->addRowAction('delete');
        $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), 'icon' => 'icon-trash'));
        $this->context = Context::getContext();
        $this->default_form_language = $this->context->language->id;
        $this->_select = '
		a.`id_neo_whitelist`,
		a.`price`,
		p.`price` AS `pprice`,
		pl.`name`';
        $this->_join = '
        LEFT JOIN `' . _DB_PREFIX_ . 'product` p ON (p.`id_product` = a.`id_product`)
        LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (pl.`id_product` = a.`id_product`)
        ';
        $this->_orderBy = 'id_neo_whitelist';
        $this->_orderWay = 'DESC';
        $this->fields_list = array('id_neo_whitelist' => array('title' => $this->l('ID'), 'align' => 'text-center', 'class' => 'fixed-width-xs'), 'name' => array('title' => $this->l('Nombre'), 'havingFilter' => true), 'pprice' => array('title' => $this->l('Precio Real')), 'price' => array('title' => $this->l('Precio Intercambio')));
        parent::__construct();
    }
    public function __construct()
    {
        $this->bootstrap = true;
        $this->table = 'neo_exchanges';
        $this->identifier = 'id_neo_exchange';
        $this->className = 'NeoExchanges';
        $this->lang = false;
        $this->addRowAction('view');
        $this->explicitSelect = true;
        $this->allow_export = true;
        $this->deleted = false;
        $this->context = Context::getContext();
        $this->_select = '
		a.id_neo_exchange,
		a.reference,
		CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
		s.`denominacion` AS `osname`,
		IF((SELECT COUNT(so.id_neo_exchange) FROM `' . _DB_PREFIX_ . 'neo_exchanges` so WHERE so.id_customer = a.id_customer) > 1, 0, 1) as new';
        $this->_join = '
        LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON (c.`id_customer` = a.`id_customer`)
        LEFT JOIN `' . _DB_PREFIX_ . 'neo_status` s ON (s.`id_neo_status` = a.`current_state`)
        ';
        $this->_orderBy = 'id_neo_exchange';
        $this->_orderWay = 'DESC';
        $statuses = NeoStatus::getNeoStatus();
        foreach ($statuses as $status) {
            $this->statuses_array[$status['id_neo_status']] = $status['denominacion'];
        }
        $this->fields_list = array('id_neo_exchange' => array('title' => $this->l('ID'), 'align' => 'text-center', 'class' => 'fixed-width-xs'), 'reference' => array('title' => $this->l('Reference')), 'new' => array('title' => $this->l('New client'), 'align' => 'text-center', 'type' => 'bool', 'tmpTableFilter' => true, 'orderby' => false), 'customer' => array('title' => $this->l('Customer'), 'havingFilter' => true));
        $this->fields_list = array_merge($this->fields_list, array('total_in_favor' => array('title' => $this->l('Total'), 'align' => 'text-right', 'type' => 'price', 'currency' => true, 'callback' => 'setOrderCurrency'), 'total_dif' => array('title' => $this->l('Total') . ' Dif', 'align' => 'text-right', 'type' => 'price', 'currency' => true, 'callback' => 'setOrderCurrency'), 'forma_pago' => array('title' => 'Forma de pago'), 'osname' => array('title' => $this->l('Status'), 'type' => 'select', 'color' => 'color', 'list' => $this->statuses_array, 'filter_key' => 'os!id_neo_status', 'filter_type' => 'int', 'order_key' => 'osname'), 'date_add' => array('title' => $this->l('Date'), 'align' => 'text-right', 'type' => 'datetime', 'filter_key' => 'a!date_add')));
        $this->shopLinkType = 'shop';
        $this->shopShareDatas = Shop::SHARE_ORDER;
        if (Tools::isSubmit('id_neo_exchange')) {
            // Save context (in order to apply cart rule)
            $order = new NeoExchanges((int) Tools::getValue('id_neo_exchange'));
            //$this->context->cart = new Cart($order->id_cart);
            $this->context->customer = new Customer($order->id_customer);
        }
        $this->bulk_actions = array('updateOrderStatus' => array('text' => $this->l('Change Order Status'), 'icon' => 'icon-refresh'));
        parent::__construct();
    }