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


PHP hikashop_getEscaped函数代码示例

本文整理汇总了PHP中hikashop_getEscaped函数的典型用法代码示例。如果您正苦于以下问题:PHP hikashop_getEscaped函数的具体用法?PHP hikashop_getEscaped怎么用?PHP hikashop_getEscaped使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: listing

 function listing()
 {
     $app = JFactory::getApplication();
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string');
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'a.waitlist_id', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
     $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int');
     $database = JFactory::getDBO();
     $filters = array();
     $searchMap = array('a.waitlist_id', 'a.email', 'a.name', 'a.product_id', 'b.product_name', 'b.product_code');
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . hikashop_getEscaped(JString::strtolower(trim($pageInfo->search)), true) . '%\'';
         $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}";
     }
     $order = '';
     if (!empty($pageInfo->filter->order->value)) {
         $order = ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
     }
     if (!empty($filters)) {
         $filters = ' WHERE (' . implode(') AND (', $filters) . ')';
     } else {
         $filters = '';
     }
     $query = ' FROM ' . hikashop_table('waitlist') . ' AS a LEFT JOIN ' . hikashop_table('product') . ' AS b ON a.product_id=b.product_id ' . $filters . $order;
     $database->setQuery('SELECT *' . $query, (int) $pageInfo->limit->start, (int) $pageInfo->limit->value);
     $rows = $database->loadObjectList();
     $class = hikashop_get('class.product');
     foreach ($rows as $i => $element) {
         if ($element->product_type == 'variant') {
             $database->setQuery('SELECT * FROM ' . hikashop_table('variant') . ' AS a LEFT JOIN ' . hikashop_table('characteristic') . ' AS b ON a.variant_characteristic_id=b.characteristic_id WHERE a.variant_product_id=' . (int) $element->product_id . ' ORDER BY a.ordering');
             $element->characteristics = $database->loadObjectList();
             $parentProduct = $class->get((int) $element->product_parent_id);
             $class->checkVariant($element, $parentProduct);
             $rows[$i] = $element;
         }
     }
     if (!empty($pageInfo->search)) {
         $rows = hikashop_search($pageInfo->search, $rows, 'waitlist_id');
     }
     $database->setQuery('SELECT COUNT(*)' . $query);
     $pageInfo->elements = new stdClass();
     $pageInfo->elements->total = $database->loadResult();
     $pageInfo->elements->page = count($rows);
     $toggleClass = hikashop_get('helper.toggle');
     $this->assignRef('toggleClass', $toggleClass);
     $this->assignRef('rows', $rows);
     $this->assignRef('pageInfo', $pageInfo);
     $this->getPagination();
     hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
     $config =& hikashop_config();
     $manage = hikashop_isAllowed($config->get('acl_waitlist_manage', 'all'));
     $this->assignRef('manage', $manage);
     $this->toolbar = array(array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_waitlist_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard');
 }
开发者ID:q0821,项目名称:esportshop,代码行数:59,代码来源:view.html.php

示例2: listing

 function listing()
 {
     $app = JFactory::getApplication();
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'a.currency_id', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'asc', 'word');
     $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     if (JRequest::getVar('search') != $app->getUserState($this->paramBase . ".search")) {
         $app->setUserState($this->paramBase . '.limitstart', 0);
         $pageInfo->limit->start = 0;
     } else {
         $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int');
     }
     $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string');
     $pageInfo->search = JString::strtolower(trim($pageInfo->search));
     $database = JFactory::getDBO();
     $searchMap = array('a.currency_symbol', 'a.currency_code', 'a.currency_name', 'a.currency_id');
     $filters = array();
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . hikashop_getEscaped($pageInfo->search, true) . '%\'';
         $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}";
     }
     $query = 'FROM ' . hikashop_table('currency') . ' AS a';
     if (!empty($filters)) {
         $query .= ' WHERE (' . implode(') AND (', $filters) . ')';
     }
     if (!empty($pageInfo->filter->order->value)) {
         $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
     }
     $database->setQuery('SELECT a.* ' . $query, $pageInfo->limit->start, $pageInfo->limit->value);
     $rows = $database->loadObjectList('currency_id');
     $currencyClass = hikashop_get('class.currency');
     $currencyClass->getCurrencies(null, $rows);
     if (!empty($pageInfo->search)) {
         $rows = hikashop_search($pageInfo->search, $rows, 'currency_id');
     }
     $database->setQuery('SELECT count(*) ' . $query);
     $pageInfo->elements = new stdClass();
     $pageInfo->elements->total = $database->loadResult();
     $pageInfo->elements->page = count($rows);
     hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
     $config =& hikashop_config();
     $manage = hikashop_isAllowed($config->get('acl_currency_manage', 'all'));
     $this->assignRef('manage', $manage);
     $this->toolbar = array(array('name' => 'confirm', 'check' => false, 'msg' => JText::_('UPDATE_RATES_WARNING'), 'icon' => 'upload', 'alt' => JText::_('UPDATE_RATES'), 'task' => 'update', 'display' => $manage && hikashop_level(2)), array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_currency_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard');
     $toggleClass = hikashop_get('helper.toggle');
     $this->assignRef('toggleClass', $toggleClass);
     $this->assignRef('currency', $currencyClass);
     $this->assignRef('rows', $rows);
     $this->assignRef('pageInfo', $pageInfo);
     $this->getPagination();
 }
开发者ID:rodhoff,项目名称:MNW,代码行数:55,代码来源:view.html.php

示例3: leads

 function leads()
 {
     $this->paramBase = 'leads';
     $app = JFactory::getApplication();
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $fieldsClass = hikashop_get('class.field');
     $fields = $fieldsClass->getData('backend_listing', 'user', false);
     $this->assignRef('fields', $fields);
     $this->assignRef('fieldsClass', $fieldsClass);
     $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string');
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'a.user_id', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
     $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int');
     $database = JFactory::getDBO();
     $user_id = hikashop_getCID('user_id');
     $userClass = hikashop_get('class.user');
     $user = $userClass->get($user_id);
     $this->assignRef('user', $user);
     $filters = array('a.user_partner_id=' . $user_id, 'a.user_partner_paid=0');
     $searchMap = array('a.user_id', 'a.user_email', 'b.username', 'b.email', 'b.name');
     foreach ($fields as $field) {
         $searchMap[] = 'a.' . $field->field_namekey;
     }
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . hikashop_getEscaped($pageInfo->search, true) . '%\'';
         $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}";
     }
     $order = '';
     if (!empty($pageInfo->filter->order->value)) {
         $order = ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
     }
     if (!empty($filters)) {
         $filters = ' WHERE (' . implode(') AND (', $filters) . ')';
     } else {
         $filters = '';
     }
     $query = ' FROM ' . hikashop_table('user') . ' AS a LEFT JOIN ' . hikashop_table('users', false) . ' AS b ON a.user_cms_id=b.id ' . $filters . $order;
     $database->setQuery('SELECT a.*,b.*' . $query, (int) $pageInfo->limit->start, (int) $pageInfo->limit->value);
     $rows = $database->loadObjectList();
     $fieldsClass->handleZoneListing($fields, $rows);
     if (!empty($pageInfo->search)) {
         $rows = hikashop_search($pageInfo->search, $rows, 'user_id');
     }
     $database->setQuery('SELECT COUNT(*)' . $query);
     $pageInfo->elements = new stdClass();
     $pageInfo->elements->total = $database->loadResult();
     $pageInfo->elements->page = count($rows);
     $this->assignRef('rows', $rows);
     $this->assignRef('pageInfo', $pageInfo);
     $this->getPagination();
     $currencyClass = hikashop_get('class.currency');
     $this->assignRef('currencyHelper', $currencyClass);
 }
开发者ID:q0821,项目名称:esportshop,代码行数:57,代码来源:view.html.php

示例4: downloads

 function downloads()
 {
     $user = hikashop_loadUser(true);
     if (hikashop_loadUser() == null) {
         return false;
     }
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $config = hikashop_config();
     $this->assignRef('config', $config);
     $order_statuses = explode(',', $config->get('order_status_for_download', 'shipped,confirmed'));
     foreach ($order_statuses as $k => $o) {
         $order_statuses[$k] = $db->Quote(trim($o));
     }
     $download_time_limit = $config->get('download_time_limit', 0);
     $this->assignRef('download_time_limit', $download_time_limit);
     $paramBase = HIKASHOP_COMPONENT . '.' . $this->getName();
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . '.filter_order', 'filter_order', 'max_order_created', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . '.filter_order_Dir', 'filter_order_Dir', 'desc', 'word');
     $pageInfo->search = $app->getUserStateFromRequest($paramBase . '.search', 'search', '', 'string');
     $pageInfo->search = JString::strtolower($pageInfo->search);
     $pageInfo->limit->start = $app->getUserStateFromRequest($paramBase . '.limitstart', 'limitstart', 0, 'int');
     $oldValue = $app->getUserState($paramBase . '.list_limit');
     $searchMap = array('op.order_product_name', 'f.file_name');
     $order = '';
     if (!empty($pageInfo->filter->order->value)) {
         if ($pageInfo->filter->order->value == 'f.file_name') {
             $order = ' ORDER BY f.file_name ' . $pageInfo->filter->order->dir . ', f.file_path ' . $pageInfo->filter->order->dir;
         } else {
             $order = ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
         }
     }
     $filters = array('o.order_type = \'sale\'', 'o.order_status IN (' . implode(',', $order_statuses) . ')', 'f.file_ref_id > 0', 'f.file_type = \'file\'', 'o.order_user_id = ' . $user->user_id);
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . hikashop_getEscaped(JString::strtolower(trim($pageInfo->search)), true) . '%\'';
         $filter = '(' . implode(' LIKE ' . $searchVal . ' OR ', $searchMap) . ' LIKE ' . $searchVal . ')';
         $filters[] = $filter;
     }
     $filters = implode(' AND ', $filters);
     if (empty($oldValue)) {
         $oldValue = $app->getCfg('list_limit');
     }
     $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     if ($oldValue != $pageInfo->limit->value) {
         $pageInfo->limit->start = 0;
         $app->setUserState($paramBase . '.limitstart', 0);
     }
     $select = 'o.order_id, o.order_created, p.*, f.*, op.* ';
     $selectSum = ', MIN(o.order_created) as min_order_created, MAX(o.order_created) as max_order_created, SUM(op.order_product_quantity) as file_quantity ';
     $selectUniq = ', IF( REPLACE(LEFT(f.file_path, 1) , \'#\', \'@\') = \'@\', CONCAT(f.file_id, \'@\', o.order_id), f.file_id ) as uniq_id';
     $query = ' FROM ' . hikashop_table('order') . ' AS o ' . ' INNER JOIN ' . hikashop_table('order_product') . ' AS op ON op.order_id = o.order_id ' . ' INNER JOIN ' . hikashop_table('product') . ' AS p ON op.product_id = p.product_id ' . ' INNER JOIN ' . hikashop_table('file') . ' AS f ON (op.product_id = f.file_ref_id OR p.product_parent_id = f.file_ref_id) ' . ' WHERE ' . $filters;
     $groupBy = ' GROUP BY uniq_id ';
     $db->setQuery('SELECT ' . $select . $selectSum . $selectUniq . $query . $groupBy . $order, (int) $pageInfo->limit->start, (int) $pageInfo->limit->value);
     $downloadData = $db->loadObjectList('uniq_id');
     if (!empty($pageInfo->search)) {
         $downloadData = hikashop_search($pageInfo->search, $downloadData, 'order_id');
     }
     $db->setQuery('SELECT COUNT(*) as all_results_count FROM (SELECT f.file_id ' . $selectUniq . $query . $groupBy . ') AS all_results');
     $pageInfo->elements = new stdClass();
     $pageInfo->elements->total = $db->loadResult('total');
     $pageInfo->elements->page = count($downloadData);
     $file_ids = array();
     $order_ids = array();
     foreach ($downloadData as $k => $data) {
         if ((int) $data->order_id > 0) {
             $order_ids[(int) $data->order_id] = (int) $data->order_id;
         }
         $downloadData[$k]->download_total = 0;
         $downloadData[$k]->downloads = array();
         $downloadData[$k]->orders = array();
         if (strpos($k, '@') === false) {
             $file_ids[] = $k;
         }
     }
     if (!empty($file_ids)) {
         $db->setQuery('SELECT ' . $select . $query . ' AND f.file_id IN (' . implode(',', $file_ids) . ')');
         $orders = $db->loadObjectList();
         foreach ($orders as $o) {
             if (isset($downloadData[$o->file_id])) {
                 $downloadData[$o->file_id]->orders[(int) $o->order_id] = $o;
                 $downloadData[$o->file_id]->orders[(int) $o->order_id]->file_qty = 0;
                 $downloadData[$o->file_id]->orders[(int) $o->order_id]->download_total = 0;
             }
             $order_ids[(int) $o->order_id] = (int) $o->order_id;
         }
     }
     if (!empty($order_ids)) {
         $db->setQuery('SELECT * FROM ' . hikashop_table('download') . ' WHERE order_id IN (' . implode(',', $order_ids) . ')');
         $downloads = $db->loadObjectList();
         foreach ($downloads as $download) {
             $uniq_id = $download->file_id . '@' . $download->order_id;
             if (isset($downloadData[$uniq_id])) {
                 $downloadData[$uniq_id]->download_total += (int) $download->download_number;
                 $downloadData[$uniq_id]->downloads[$download->file_pos] = $download;
             } else {
                 if (isset($downloadData[$download->file_id])) {
//.........这里部分代码省略.........
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:view.html.php

示例5: product_select

    function product_select()
    {
        $app = JFactory::getApplication();
        $config =& hikashop_config();
        $this->assignRef('config', $config);
        $this->paramBase .= "_product_select";
        $element = new stdClass();
        $element->order_id = JRequest::getInt('order_id');
        $this->assignRef('element', $element);
        $pageInfo = new stdClass();
        $pageInfo->filter = new stdClass();
        $pageInfo->filter->order = new stdClass();
        $pageInfo->limit = new stdClass();
        $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'a.ordering', 'cmd');
        $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'asc', 'word');
        if (JRequest::getVar('search') != $app->getUserState($this->paramBase . ".search")) {
            $app->setUserState($this->paramBase . '.limitstart', 0);
            $pageInfo->limit->start = 0;
        } else {
            $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int');
        }
        $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string');
        $pageInfo->search = JString::strtolower(trim($pageInfo->search));
        $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
        if (empty($pageInfo->limit->value)) {
            $pageInfo->limit->value = 500;
        }
        $selectedType = $app->getUserStateFromRequest($this->paramBase . ".filter_type", 'filter_type', 0, 'int');
        $pageInfo->filter->filter_id = $app->getUserStateFromRequest($this->paramBase . ".filter_id", 'filter_id', 0, 'string');
        $pageInfo->filter->filter_product_type = $app->getUserStateFromRequest($this->paramBase . ".filter_product_type", 'filter_product_type', 'main', 'word');
        $database = JFactory::getDBO();
        $filters = array();
        $searchMap = array('b.product_name', 'b.product_description', 'b.product_id', 'b.product_code');
        if (empty($pageInfo->filter->filter_id) || !is_numeric($pageInfo->filter->filter_id)) {
            $pageInfo->filter->filter_id = 'product';
            $class = hikashop_get('class.category');
            $class->getMainElement($pageInfo->filter->filter_id);
        }
        if (!empty($pageInfo->search)) {
            $searchVal = '\'%' . hikashop_getEscaped($pageInfo->search, true) . '%\'';
            $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}";
        }
        $order = '';
        if (!$selectedType) {
            $filters[] = 'a.category_id=' . (int) $pageInfo->filter->filter_id;
            $select = 'SELECT a.ordering, b.*';
        } else {
            $categoryClass = hikashop_get('class.category');
            $categoryClass->parentObject =& $this;
            $children = $categoryClass->getChildren((int) $pageInfo->filter->filter_id, true, array(), '', 0, 0);
            $filter = 'a.category_id IN (';
            foreach ($children as $child) {
                $filter .= $child->category_id . ',';
            }
            $filters[] = $filter . (int) $pageInfo->filter->filter_id . ')';
            $select = 'SELECT DISTINCT b.*';
        }
        if ($pageInfo->filter->filter_product_type == 'all') {
            if (!empty($pageInfo->filter->order->value)) {
                $select .= ',' . $pageInfo->filter->order->value . ' as sorting_column';
                $order = ' ORDER BY sorting_column ' . $pageInfo->filter->order->dir;
            }
        } else {
            if (!empty($pageInfo->filter->order->value)) {
                $order = ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
            }
        }
        JPluginHelper::importPlugin('hikashop');
        $dispatcher = JDispatcher::getInstance();
        $dispatcher->trigger('onBeforeProductListingLoad', array(&$filters, &$order, &$this, &$select, &$select2, &$a, &$b, &$on));
        if ($pageInfo->filter->filter_product_type == 'all') {
            $query = '( ' . $select . ' FROM ' . hikashop_table('product_category') . ' AS a LEFT JOIN ' . hikashop_table('product') . ' AS b ON a.product_id=b.product_id WHERE ' . implode(' AND ', $filters) . ' AND b.product_id IS NOT NULL )
			UNION
						( ' . $select . ' FROM ' . hikashop_table('product_category') . ' AS a LEFT JOIN ' . hikashop_table('product') . ' AS b ON a.product_id=b.product_parent_id WHERE ' . implode(' AND ', $filters) . ' AND b.product_parent_id IS NOT NULL ) ';
            $database->setQuery($query . $order, (int) $pageInfo->limit->start, (int) $pageInfo->limit->value);
        } else {
            $filters[] = 'b.product_type = ' . $database->Quote($pageInfo->filter->filter_product_type);
            if ($pageInfo->filter->filter_product_type != 'variant') {
                $lf = 'a.product_id=b.product_id';
            } else {
                $lf = 'a.product_id=b.product_parent_id';
            }
            $query = ' FROM ' . hikashop_table('product_category') . ' AS a LEFT JOIN ' . hikashop_table('product') . ' AS b ON ' . $lf . ' WHERE ' . implode(' AND ', $filters);
            $database->setQuery($select . $query . $order, (int) $pageInfo->limit->start, (int) $pageInfo->limit->value);
        }
        $rows = $database->loadObjectList();
        if (!empty($pageInfo->search)) {
            $rows = hikashop_search($pageInfo->search, $rows, 'product_id');
        }
        if ($pageInfo->filter->filter_product_type == 'all') {
            $database->setQuery('SELECT COUNT(*) FROM (' . $query . ') as u');
        } else {
            $database->setQuery('SELECT COUNT(DISTINCT(b.product_id))' . $query);
        }
        $pageInfo->elements = new stdClass();
        $pageInfo->elements->total = $database->loadResult();
        $pageInfo->elements->page = count($rows);
        if ($pageInfo->elements->page) {
            $this->_loadPrices($rows);
        }
//.........这里部分代码省略.........
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:view.html.php

示例6: getTax

 function getTax($zone_id, $tax_category_id, $type = '')
 {
     static $calculated = array();
     static $calculatedFullInfo = array();
     if (empty($tax_category_id)) {
         return 0;
     }
     if (empty($zone_id)) {
         $zone_id = $this->mainTaxZone();
         if (empty($zone_id)) {
             return 0;
         }
     }
     if (empty($type)) {
         $type = $this->getTaxType();
     }
     $taxPlans = array();
     while (empty($taxPlans) && !empty($tax_category_id)) {
         $key = $zone_id . '_' . $tax_category_id . '_' . $type;
         if (!isset($calculated[$key])) {
             $filter = '';
             switch ($type) {
                 default:
                     $filter = '(taxation_type = ' . $this->database->Quote($type) . ' OR taxation_type LIKE \'%' . hikashop_getEscaped($type, true) . '%\')';
                 case '':
                     $typeFilter = 'taxation_type = \'\'';
                     if (!empty($filter)) {
                         $typeFilter = '( ' . $typeFilter . ' OR ' . $filter . ' )';
                     }
                     break;
             }
             $filters = array('a.category_id = ' . (int) $tax_category_id, 'b.taxation_published=1', $typeFilter, 'b.taxation_date_start <= ' . time(), '(b.taxation_date_end = 0 OR b.taxation_date_end > ' . time() . ')');
             hikashop_addACLFilters($filters, 'taxation_access', 'b');
             $query = 'SELECT b.*,c.* FROM ' . hikashop_table('category') . ' AS a ' . 'LEFT JOIN ' . hikashop_table('taxation') . ' AS b ON a.category_namekey=b.category_namekey ' . 'LEFT JOIN ' . hikashop_table('tax') . ' AS c ON b.tax_namekey=c.tax_namekey WHERE ' . implode(' AND ', $filters) . ' ORDER BY b.taxation_id ASC';
             $this->database->setQuery($query);
             $taxPlans = $this->database->loadObjectList('taxation_id');
             if (empty($taxPlans)) {
                 $query = 'SELECT category_parent_id FROM ' . hikashop_table('category') . ' WHERE category_id = ' . (int) $tax_category_id;
                 $this->database->setQuery($query);
                 $category_parent_id = $this->database->loadResult();
                 if (!empty($category_parent_id)) {
                     $tax_category_id = $category_parent_id;
                 } else {
                     break;
                 }
             }
         } else {
             break;
         }
     }
     if (!isset($calculated[$key])) {
         $query = 'SELECT * FROM ' . hikashop_table('zone') . ' WHERE zone_id = ' . (int) $zone_id;
         $this->database->setQuery($query);
         $zone = $this->database->loadObject();
         $quotedTaxNamekeys = array();
         $this->taxRates = array();
         $tax = 0;
         if (!empty($taxPlans) && !empty($zone)) {
             $matches = array();
             $cumulative = false;
             $already = array($zone->zone_id => $zone);
             foreach ($taxPlans as $taxPlan) {
                 if (empty($taxPlan->zone_namekey)) {
                     continue;
                 }
                 $taxPlan->zone_namekey = explode(',', $taxPlan->zone_namekey);
                 foreach ($taxPlan->zone_namekey as $zone_namekey) {
                     $quotedTaxNamekeys[] = $this->database->Quote($zone_namekey);
                 }
                 if (in_array($zone->zone_namekey, $taxPlan->zone_namekey) && $this->_matchPostCode($taxPlan)) {
                     $taxPlan->zone_type = $zone->zone_type;
                     $matches[$taxPlan->taxation_id] = $taxPlan;
                     if (!empty($taxPlan->taxation_cumulative)) {
                         $cumulative = true;
                     }
                 }
             }
             if (count($quotedTaxNamekeys) && (count($matches) == 0 || $cumulative)) {
                 $childs = array($this->database->Quote($zone->zone_namekey));
                 $this->_getParents($childs, $matches, $already, $quotedTaxNamekeys, $taxPlans);
             }
             JPluginHelper::importPlugin('hikashop');
             $dispatcher = JDispatcher::getInstance();
             $dispatcher->trigger('onHikashopGetTax', array(&$this, $zone_id, $tax_category_id, $type, &$matches, &$taxPlans));
             if (count($matches) != 0) {
                 $type = 'state';
                 $types = array('country', 'tax');
                 $found = false;
                 while (!$found) {
                     foreach ($matches as $match) {
                         if ($match->zone_type == $type) {
                             $tax += floatval(@$match->tax_rate);
                             $this->taxRates[] = $match;
                             if (empty($match->taxation_cumulative)) {
                                 $found = true;
                                 break;
                             }
                         }
                     }
                     if (!$found) {
//.........这里部分代码省略.........
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:currency.php

示例7: onSearch

 function onSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     if (!defined('DS')) {
         define('DS', DIRECTORY_SEPARATOR);
     }
     if (!(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php')) {
         return array();
     }
     $db = JFactory::getDBO();
     if (is_array($areas)) {
         if (!array_intersect($areas, array_keys($this->onSearchAreas()))) {
             return array();
         }
     }
     $limit = $this->params->def('search_limit', 50);
     $text = trim($text);
     if ($text == '') {
         return array();
     }
     switch ($ordering) {
         case 'alpha':
             $order = 'a.product_name ASC';
             break;
         case 'newest':
             $order = 'a.product_modified DESC';
             break;
         case 'oldest':
             $order = 'a.product_created ASC';
             break;
         case 'popular':
             $order = 'a.product_hit DESC';
             break;
         case 'category':
         default:
             $order = 'a.product_name DESC';
             break;
     }
     $trans = hikashop_get('helper.translation');
     $multi = $trans->isMulti();
     $trans_table = 'jf_content';
     if ($trans->falang) {
         $trans_table = 'falang_content';
     }
     $rows = array();
     $filters = array('a.product_published=1');
     $variants = (int) $this->params->get('variants', '0');
     if (!$variants) {
         $filters[] = 'a.product_type=\'main\'';
     }
     $out_of_stock = (int) $this->params->get('out_of_stock_display', '1');
     if (!$out_of_stock) {
         $filters[] = 'a.product_quantity!=0';
     }
     hikashop_addACLFilters($filters, 'product_access', 'a');
     $leftjoin = '';
     $catFilters = array('category_published=1', 'category_type=\'product\'');
     hikashop_addACLFilters($catFilters, 'category_access');
     $db->setQuery('SELECT category_id FROM ' . hikashop_table('category') . ' WHERE ' . implode(' AND ', $catFilters));
     if (!HIKASHOP_J25) {
         $cats = $db->loadResultArray();
     } else {
         $cats = $db->loadColumn();
     }
     if (!empty($cats)) {
         $filters[] = 'b.category_id IN (' . implode(',', $cats) . ')';
     }
     if ($variants) {
         $leftjoin = ' INNER JOIN ' . hikashop_table('product_category') . ' AS b ON a.product_parent_id=b.product_id OR a.product_id=b.product_id';
     } else {
         $leftjoin = ' INNER JOIN ' . hikashop_table('product_category') . ' AS b ON a.product_id=b.product_id';
     }
     $filters2 = array();
     if ($multi) {
         $registry = JFactory::getConfig();
         if (!HIKASHOP_J25) {
             $code = $registry->getValue('config.jflang');
         } else {
             $code = $registry->get('language');
         }
         $lg = $trans->getId($code);
         $filters2[] = "b.reference_table='hikashop_product'";
         $filters2[] = "b.published=1";
         $filters2[] = 'b.language_id=' . $lg;
     }
     $fields = $this->params->get('fields', '');
     if (empty($fields)) {
         $fields = array('product_name', 'product_description');
     } else {
         $fields = explode(',', $fields);
     }
     switch ($phrase) {
         case 'exact':
             $text = $db->Quote('%' . hikashop_getEscaped($text, true) . '%', false);
             $filters1 = array();
             foreach ($fields as $f) {
                 $filters1[] = "a." . $f . " LIKE " . $text;
             }
             if ($multi) {
                 $filters2[] = "b.value LIKE " . $text;
             }
//.........这里部分代码省略.........
开发者ID:rodhoff,项目名称:MNW,代码行数:101,代码来源:hikashop_products.php

示例8: activate

 function activate()
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $usersConfig = JComponentHelper::getParams('com_users');
     $userActivation = $usersConfig->get('useractivation');
     $allowUserRegistration = $usersConfig->get('allowUserRegistration');
     if ($user->get('id')) {
         $app->redirect(hikashop_completeLink('checkout', false, true));
     }
     if ($allowUserRegistration == '0' || $userActivation == '0') {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
     $lang = JFactory::getLanguage();
     $lang->load('com_user', JPATH_SITE);
     jimport('joomla.user.helper');
     $activation = hikashop_getEscaped(JRequest::getVar('activation', '', '', 'alnum'));
     if (empty($activation)) {
         $app->enqueueMessage(JText::_('HIKA_REG_ACTIVATE_NOT_FOUND'));
         return;
     }
     if (version_compare(JVERSION, '1.6', '<')) {
         $result = JUserHelper::activateUser($activation);
     } else {
         if (HIKASHOP_J30) {
             JModelLegacy::addIncludePath(HIKASHOP_ROOT . DS . 'components' . DS . 'com_users' . DS . 'models');
         } else {
             JModel::addIncludePath(HIKASHOP_ROOT . DS . 'components' . DS . 'com_users' . DS . 'models');
         }
         $model = $this->getModel('Registration', 'UsersModel', array(), true);
         $language = JFactory::getLanguage();
         $language->load('com_users', JPATH_SITE, $language->getTag(), true);
         if ($model) {
             $result = $model->activate($activation);
         }
     }
     if (!$result) {
         $app->enqueueMessage(JText::_('HIKA_REG_ACTIVATE_NOT_FOUND'));
         return;
     } else {
         $app->enqueueMessage(JText::_('HIKA_REG_ACTIVATE_COMPLETE'));
         $id = JRequest::getInt('id', 0);
         $class = hikashop_get('class.user');
         $user = $class->get($id);
         if ($id && file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_comprofiler' . DS . 'comprofiler.php') && $userActivation < 2) {
             $class->addAndConfirmUserInCB($user);
         }
         $infos = JRequest::getVar('infos', '');
         global $Itemid;
         $url = '';
         if (!empty($Itemid)) {
             $url = '&Itemid=' . $Itemid;
         }
         if (!empty($infos) && function_exists('json_decode')) {
             $infos = json_decode(base64_decode($infos), true);
             JPluginHelper::importPlugin('user');
             if ($userActivation < 2 && !empty($infos['passwd']) && !empty($infos['username']) && $this->_doLogin($infos['username'], $infos['passwd'], false)) {
                 $page = JRequest::getString('page', 'checkout');
                 if ($page == 'checkout') {
                     $this->before_address();
                     $app->redirect(hikashop_completeLink('checkout' . $url, false, true));
                 } else {
                     JRequest::setVar('layout', 'activate');
                     return parent::display();
                 }
             } elseif ($userActivation >= 2) {
                 $app->enqueueMessage(JText::_('HIKA_ADMIN_CONFIRM_ACTIVATION'));
             }
         }
         if (version_compare(JVERSION, '1.6', '<')) {
             $url = 'index.php?option=com_user&view=login' . $url;
         } else {
             $url = 'index.php?option=com_users&view=login' . $url;
         }
         $app->redirect(JRoute::_($url, false));
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:79,代码来源:checkout.php

示例9: showcarts

 function showcarts()
 {
     $app = JFactory::getApplication();
     $config = hikashop_config();
     $menus = $app->getMenu();
     $menu = $menus->getActive();
     global $Itemid;
     if (empty($menu)) {
         if (!empty($Itemid)) {
             $menus->setActive($Itemid);
             $menu = $menus->getItem($Itemid);
         }
     }
     if (is_object($menu) && is_object($menu->params)) {
         $cart_type = $menu->params->get('cart_type');
     }
     if (!empty($cart_type)) {
         JRequest::setVar('cart_type', $cart_type);
     } else {
         $cart_type = JRequest::getString('cart_type', 'cart');
         if (!in_array($cart_type, array('cart', 'wishlist'))) {
             $cart_type = 'cart';
         }
     }
     $this->assignRef('cart_type', $cart_type);
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'a.cart_id', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
     $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string');
     $pageInfo->search = JString::strtolower(trim($pageInfo->search));
     $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int');
     $oldValue = $app->getUserState($this->paramBase . '.list_limit');
     if (empty($oldValue)) {
         $oldValue = $app->getCfg('list_limit');
     }
     $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     if ($oldValue != $pageInfo->limit->value) {
         $pageInfo->limit->start = 0;
         $app->setUserState($this->paramBase . '.limitstart', 0);
     }
     $database = JFactory::getDBO();
     $searchMap = array('a.cart_id', 'a.cart_name', 'a.cart_type');
     if (hikashop_loadUser() == null) {
         global $Itemid;
         $url = '';
         if (!empty($Itemid)) {
             $url = '&Itemid=' . $Itemid;
         }
         if (!HIKASHOP_J16) {
             $url = 'index.php?option=com_user&view=login' . $url;
         } else {
             $url = 'index.php?option=com_users&view=login' . $url;
         }
         if ($config->get('enable_multicart', '0')) {
             $app->redirect(JRoute::_($url . '&return=' . urlencode(base64_encode(hikashop_currentUrl('', false))), false));
         } else {
             $app->redirect(JRoute::_($url . '&return=' . base64_encode(hikashop_completeLink('cart&task=showcart&cart_type=' . $cart_type . '&Itemid=' . $Itemid, false, false, true)), false));
         }
         return false;
     }
     $user = hikashop_loadUser(true);
     if (isset($user->user_cms_id)) {
         $user->id = $user->user_cms_id;
     } else {
         if (empty($user)) {
             $user = new stdClass();
         }
         $user->id = 0;
     }
     $session = JFactory::getSession();
     if ($session->getId()) {
         $user->session = $session->getId();
     } else {
         $user->session = '';
     }
     if (hikashop_loadUser() == null) {
         $filters = array('a.session_id=' . $database->Quote($user->session) . ' AND a.cart_type =' . $database->quote($cart_type));
     } else {
         $filters = array('(a.user_id=' . (int) $user->id . ' OR a.session_id=' . $database->Quote($user->session) . ') AND a.cart_type =' . $database->quote($cart_type));
     }
     $groupBy = 'GROUP BY a.cart_id';
     $order = '';
     if (!empty($pageInfo->filter->order->value)) {
         $order = 'ORDER BY a.cart_id ASC';
     }
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . hikashop_getEscaped(JString::strtolower(trim($pageInfo->search)), true) . '%\'';
         $filter = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}";
         $filters[] = $filter;
     }
     $from = 'FROM ' . hikashop_table('cart') . ' AS a';
     $cartProduct = 'LEFT JOIN ' . hikashop_table('cart_product') . ' AS b ON a.cart_id=b.cart_id';
     $where = 'WHERE (' . implode(') AND (', $filters) . ') AND a.cart_type =' . $database->quote($cart_type);
     $query = $from . ' ' . $where . ' ' . $groupBy . ' ' . $order;
     //'.$cartProduct.'
     $database->setQuery('SELECT a.* ' . $query);
     $rows = $database->loadObjectList();
//.........这里部分代码省略.........
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:view.html.php

示例10: delete

 function delete(&$elements)
 {
     if (!is_array($elements)) {
         $elements = array($elements);
     }
     foreach ($elements as $key => $val) {
         $elements[$key] = hikashop_getEscaped($val);
     }
     if (empty($elements)) {
         return false;
     }
     $this->database->setQuery('SELECT `field_namekey`,`field_id`,`field_table`,`field_type` FROM ' . hikashop_table('field') . '  WHERE `field_core` = 0 AND `field_id` IN (' . implode(',', $elements) . ')');
     $fieldsToDelete = $this->database->loadObjectList('field_id');
     if (empty($fieldsToDelete)) {
         $app = JFactory::getApplication();
         $app->enqueueMessage(JText::_('CORE_FIELD_DELETE_ERROR'));
         return false;
     }
     $namekeys = array();
     foreach ($fieldsToDelete as $oneField) {
         if ($oneField->field_type == 'customtext') {
             continue;
         }
         if ($oneField->field_table == 'item') {
             $namekeys['cart_product'][] = $oneField->field_namekey;
             $namekeys['order_product'][] = $oneField->field_namekey;
         } elseif ($oneField->field_table != 'contact') {
             $namekeys[$oneField->field_table][] = $oneField->field_namekey;
         }
     }
     foreach ($namekeys as $table => $fields) {
         $this->database->setQuery('ALTER TABLE ' . $this->fieldTable($table) . ' DROP `' . implode('`, DROP `', $fields) . '`');
         $this->database->query();
     }
     $this->database->setQuery('DELETE FROM ' . hikashop_table('field') . ' WHERE `field_id` IN (' . implode(',', array_keys($fieldsToDelete)) . ')');
     $result = $this->database->query();
     if (!$result) {
         return false;
     }
     $affectedRows = $this->database->getAffectedRows();
     foreach ($namekeys as $table => $fields) {
         $orderClass = hikashop_get('helper.order');
         $orderClass->pkey = 'field_id';
         $orderClass->table = 'field';
         $orderClass->groupMap = 'field_table';
         $orderClass->groupVal = $table;
         $orderClass->orderingMap = 'field_ordering';
         $orderClass->reOrder();
     }
     return $affectedRows;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:51,代码来源:field.php

示例11: array

 public function &getNameboxData($typeConfig, &$fullLoad, $mode, $value, $search, $options)
 {
     $ret = array(0 => array(), 1 => array());
     $characteristics = null;
     if (isset($typeConfig['params']['value']) && $typeConfig['params']['value']) {
         if ((int) $options['url_params']['ID'] > 0) {
             $query = 'SELECT characteristic_value, characteristic_alias, characteristic_id FROM ' . hikashop_table('characteristic') . ' WHERE characteristic_parent_id = ' . (int) $options['url_params']['ID'];
             if (!empty($options['vendor'])) {
                 $query .= ' AND characteristic_vendor_id IN (0, ' . (int) $options['vendor'] . ')';
             }
             if (!empty($search)) {
                 $query .= ' AND (characteristic_value LIKE \'%' . hikashop_getEscaped($search) . '%\' OR characteristic_alias LIKE \'%' . hikashop_getEscaped($search) . '%\')';
             }
             $this->database->setQuery($query);
             $characteristics = $this->database->loadObjectList('characteristic_id');
         }
         if (!empty($value)) {
         }
     } else {
         $query = 'SELECT characteristic_value, characteristic_alias, characteristic_id FROM ' . hikashop_table('characteristic') . ' WHERE characteristic_parent_id = 0';
         if (!empty($options['vendor'])) {
             $query .= ' AND characteristic_vendor_id IN (0, ' . (int) $options['vendor'] . ')';
         }
         $this->database->setQuery($query);
         $characteristics = $this->database->loadObjectList('characteristic_id');
         if (!empty($value)) {
         }
     }
     if (!empty($characteristics)) {
         foreach ($characteristics as $k => $v) {
             $v->name = $v->characteristic_value;
             if (!empty($v->characteristic_alias) && $v->characteristic_value != $v->characteristic_alias) {
                 $v->name .= ' (' . $v->characteristic_alias . ')';
             }
             $ret[0][$k] = $v;
         }
         asort($ret[0]);
     }
     unset($characteristics);
     return $ret;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:41,代码来源:characteristic.php

示例12: selectcategory

 function selectcategory()
 {
     $this->paramBase .= '_category';
     $app = JFactory::getApplication();
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'a.category_ordering', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'asc', 'word');
     $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string');
     $pageInfo->search = JString::strtolower(trim($pageInfo->search));
     $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int');
     $selectedType = $app->getUserStateFromRequest($this->paramBase . ".filter_type", 'filter_type', 0, 'int');
     $pageInfo->filter->filter_id = $app->getUserStateFromRequest($this->paramBase . ".filter_id", 'filter_id', 'product', 'string');
     $database = JFactory::getDBO();
     $searchMap = array('a.category_name', 'a.category_description', 'a.category_id');
     $filters = array();
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . hikashop_getEscaped($pageInfo->search, true) . '%\'';
         $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}";
     }
     $order = '';
     if (!empty($pageInfo->filter->order->value)) {
         $order = ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
     }
     $class = hikashop_get('class.category');
     $class->parentObject =& $this;
     $rows = $class->getChildren($pageInfo->filter->filter_id, $selectedType, $filters, $order, $pageInfo->limit->start, $pageInfo->limit->value, false);
     if (!empty($pageInfo->search)) {
         $rows = hikashop_search($pageInfo->search, $rows, 'category_id');
     }
     $database->setQuery('SELECT COUNT(*)' . $class->query);
     $pageInfo->elements = new stdClass();
     $pageInfo->elements->total = $database->loadResult();
     $pageInfo->elements->page = count($rows);
     hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
     $this->toolbar = array('addNew', 'editList', 'deleteList', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard');
     $toggleClass = hikashop_get('helper.toggle');
     $this->assignRef('toggleClass', $toggleClass);
     $childClass = hikashop_get('type.childdisplay');
     $childDisplay = $childClass->display('filter_type', $selectedType, false);
     $this->assignRef('childDisplay', $childDisplay);
     $breadcrumbClass = hikashop_get('type.breadcrumb');
     $breadcrumb = $breadcrumbClass->display('filter_id', $pageInfo->filter->filter_id, 'product');
     $this->assignRef('breadCrumb', $breadcrumb);
     $this->assignRef('rows', $rows);
     $this->assignRef('pageInfo', $pageInfo);
     $order = new stdClass();
     $order->ordering = false;
     $order->orderUp = 'orderup';
     $order->orderDown = 'orderdown';
     $order->reverse = false;
     if ($pageInfo->filter->order->value == 'a.category_ordering') {
         $order->ordering = true;
         if ($pageInfo->filter->order->dir == 'desc') {
             $order->orderUp = 'orderdown';
             $order->orderDown = 'orderup';
             $order->reverse = true;
         }
     }
     $this->assignRef('order', $order);
     $config =& hikashop_config();
     $this->assignRef('config', $config);
     $this->getPagination();
 }
开发者ID:q0821,项目名称:esportshop,代码行数:67,代码来源:view.html.php

示例13: productDisplay

    function productDisplay()
    {
        $app = JFactory::getApplication();
        $db = JFactory::getDBO();
        $editor_name = JRequest::getString('editor_name', 'jform_articletext');
        $pageInfo = new stdClass();
        $pageInfo->limit = new stdClass();
        $pageInfo->search = $app->getUserStateFromRequest("com_content.productbutton.search", 'search', '', 'string');
        $pageInfo->search = JString::strtolower(trim($pageInfo->search));
        $pageInfo->limit->value = $app->getUserStateFromRequest('com_content.productbutton.limit', 'limit', $app->getCfg('list_limit'), 'int');
        $pageInfo->limit->start = $app->getUserStateFromRequest('com_content.productbutton.limitstart', 'limitstart', 0, 'int');
        if (JRequest::getVar('search') != $app->getUserState('com_content.productbutton.search') || JRequest::getVar('limit') != $app->getUserState('com_content.productbutton.limit')) {
            $pageInfo->limit->start = 0;
            $app->setUserState('com_content.productbutton.limitstart', 0);
        }
        $Select = 'SELECT * FROM ' . hikashop_table('product');
        $Where = ' WHERE product_type=\'main\' AND product_access=\'all\' AND product_published=1 ';
        $orderBY = ' ORDER BY product_id ASC';
        $searchMap = array('product_name', 'product_code', 'product_id');
        $filters = array();
        if (!empty($pageInfo->search)) {
            $searchVal = '\'%' . hikashop_getEscaped(JString::strtolower(trim($pageInfo->search)), true) . '%\'';
            $filter = '(' . implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}" . ')';
            $filters[] = $filter;
        }
        if (is_array($filters) && count($filters)) {
            $filters = ' AND ' . implode(' AND ', $filters);
        } else {
            $filters = '';
        }
        $db->setQuery($Select . $Where . $filters . $orderBY, (int) $pageInfo->limit->start, (int) $pageInfo->limit->value);
        $products = $db->loadObjectList();
        $db->setQuery('SELECT COUNT(product_id) FROM ' . hikashop_table('product') . ' WHERE product_type=\'main\' AND product_access=\'all\' AND product_published=1' . $filters);
        $nbrow = $db->loadResult();
        $db->setQuery('SELECT * FROM ' . hikashop_table('price') . ' ORDER BY price_product_id ASC');
        $prices = $db->loadObjectList();
        if (HIKASHOP_J30) {
            $pagination = hikashop_get('helper.pagination', $nbrow, $pageInfo->limit->start, $pageInfo->limit->value);
        } else {
            jimport('joomla.html.pagination');
            $pagination = new JPagination($nbrow, $pageInfo->limit->start, $pageInfo->limit->value);
        }
        $scriptV1 = "function insertTag(tag){ window.parent.jInsertEditorText(tag,'text'); return true;}";
        $scriptV2 = "function insertTag(tag){ window.parent.jInsertEditorText(tag,'" . str_replace(array('\\', '\''), array('\\\\', '\\\''), $editor_name) . "'); return true;}";
        if (!HIKASHOP_PHP5) {
            $doc =& JFactory::getDocument();
        } else {
            $doc = JFactory::getDocument();
        }
        if (version_compare(JVERSION, '1.6.0', '<')) {
            $doc->addScriptDeclaration($scriptV1);
        } else {
            $doc->addScriptDeclaration($scriptV2);
        }
        $config =& hikashop_config();
        $pricetaxType = hikashop_get('type.pricetax');
        $discountDisplayType = hikashop_get('type.discount_display');
        ?>
	<script language="JavaScript" type="text/javascript">
		function divhidder(){
			if (document.getElementById('price').checked) {
				document.getElementById('Priceopt').style.visibility = 'visible';
			}
			else {
				document.getElementById('Priceopt').style.visibility = 'hidden';
			}
		}
		function checkSelect(){
			form = document.getElementById('adminForm');
			inputs = form.getElementsByTagName('input');
			nbbox = 0;
			nbboxOk = 0;
			nbboxProd = 0;
			for(i=0 ; i < inputs.length ; i++){
				if(inputs[i].type == 'checkbox' && inputs[i].checked==true){
					nbbox++;
				}
			}
			for(i=0 ; i < inputs.length ; i++){
				if(inputs[i].type == 'checkbox' && inputs[i].checked==true){
					nbboxOk++;
					if(inputs[i].id.match(/product_checkbox.*/)){
						if (nbboxProd == 0)
							document.getElementById('product_insert').value = '{product ';
						nbboxProd++;
						document.getElementById('product_insert').value = document.getElementById('product_insert').value +  inputs[i].name;
						if(nbbox > nbboxOk){
							document.getElementById('product_insert').value = document.getElementById('product_insert').value + '|';
						}
					}
				}
			}
			if( nbboxProd > 0 )
			{
				if(document.getElementById('name').checked==true){
					document.getElementById('product_insert').value =document.getElementById('product_insert').value +  '|name';
				}
				if(document.getElementById('cart').checked==true){
					document.getElementById('product_insert').value =document.getElementById('product_insert').value +  '|cart';
				}
//.........这里部分代码省略.........
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:hikashopproduct.php

示例14: select_coupon

 function select_coupon()
 {
     $badge = JRequest::getVar('badge', 'false');
     $this->assignRef('badge', $badge);
     $app = JFactory::getApplication();
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'a.discount_id', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
     $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string');
     $pageInfo->search = JString::strtolower(trim($pageInfo->search));
     $pageInfo->filter->filter_type = $app->getUserStateFromRequest($this->paramBase . ".filter_type", 'filter_type', '', 'string');
     $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     if (empty($pageInfo->limit->value)) {
         $pageInfo->limit->value = 500;
     }
     $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int');
     $database = JFactory::getDBO();
     $searchMap = array('a.discount_code', 'a.discount_id');
     $filters = array();
     if ($badge != 'false') {
         $filters[] = 'a.discount_type="discount"';
     }
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . hikashop_getEscaped($pageInfo->search, true) . '%\'';
         $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}";
     }
     $query = ' FROM ' . hikashop_table('discount') . ' AS a';
     if ($badge == 'false' && !empty($pageInfo->filter->filter_type)) {
         switch ($pageInfo->filter->filter_type) {
             case 'all':
                 break;
             default:
                 $filters[] = 'a.discount_type = ' . $database->Quote($pageInfo->filter->filter_type);
                 break;
         }
     }
     if (!empty($filters)) {
         $query .= ' WHERE (' . implode(') AND (', $filters) . ')';
     }
     if (!empty($pageInfo->filter->order->value)) {
         $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
     }
     $database->setQuery('SELECT a.*' . $query, $pageInfo->limit->start, $pageInfo->limit->value);
     $rows = $database->loadObjectList();
     if (!empty($pageInfo->search)) {
         $rows = hikashop_search($pageInfo->search, $rows, 'discount_id');
     }
     $database->setQuery('SELECT count(*)' . $query);
     $pageInfo->elements = new stdClass();
     $pageInfo->elements->total = $database->loadResult();
     $pageInfo->elements->page = count($rows);
     if ($pageInfo->limit->value == 500) {
         $pageInfo->limit->value = 100;
     }
     hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
     $config =& hikashop_config();
     $manage = hikashop_isAllowed($config->get('acl_discount_manage', 'all'));
     $this->assignRef('manage', $manage);
     $this->toolbar = array(array('name' => 'custom', 'icon' => 'copy', 'task' => 'copy', 'alt' => JText::_('HIKA_COPY'), 'display' => $manage), array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_discount_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard');
     $discountType = hikashop_get('type.discount');
     $this->assignRef('filter_type', $discountType);
     $toggleClass = hikashop_get('helper.toggle');
     $this->assignRef('toggleClass', $toggleClass);
     $this->assignRef('rows', $rows);
     $this->assignRef('pageInfo', $pageInfo);
     $this->getPagination();
     $currencyHelper = hikashop_get('class.currency');
     $this->assignRef('currencyHelper', $currencyHelper);
 }
开发者ID:rodhoff,项目名称:MNW,代码行数:72,代码来源:view.html.php

示例15: onSearch

 function onSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     if (!defined('DS')) {
         define('DS', DIRECTORY_SEPARATOR);
     }
     if (!(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php')) {
         return array();
     }
     $db = JFactory::getDBO();
     $types = array();
     if (!empty($areas) && is_array($areas)) {
         $valid = array_keys($this->onSearchAreas());
         $use = array_intersect($areas, $valid);
         if (!$use) {
             return array();
         }
         if (in_array('categories', $valid)) {
             $types[] = '\'product\'';
         }
         if (in_array('manufacturers', $valid)) {
             $types[] = '\'manufacturer\'';
         }
     } else {
         $types[] = '\'product\'';
         if (1 == (int) $this->params->get('manufacturers', '1')) {
             $types[] = '\'manufacturer\'';
         }
     }
     $limit = $this->params->def('search_limit', 50);
     $text = trim($text);
     if ($text == '') {
         return array();
     }
     switch ($ordering) {
         case 'alpha':
             $order = 'a.category_name ASC';
             break;
         case 'newest':
             $order = 'a.category_modified DESC';
             break;
         case 'oldest':
             $order = 'a.category_created ASC';
             break;
         case 'category':
         case 'popular':
         default:
             $order = 'a.category_name DESC';
             break;
     }
     $trans = hikashop_get('helper.translation');
     $multi = $trans->isMulti();
     $trans_table = 'jf_content';
     if ($trans->falang) {
         $trans_table = 'falang_content';
     }
     $rows = array();
     $filters = array('a.category_published=1');
     if (count($types)) {
         $filters[] = 'a.category_type IN (' . implode(',', $types) . ')';
     } else {
         $filters[] = 'a.category_type NOT IN (\'status\',\'tax\')';
     }
     hikashop_addACLFilters($filters, 'category_access', 'a');
     $filters2 = array();
     if ($multi) {
         $registry = JFactory::getConfig();
         if (!HIKASHOP_J25) {
             $code = $registry->getValue('config.jflang');
         } else {
             $code = $registry->get('language');
         }
         $myLang = $trans->getId($code);
         $filters2[] = "b.reference_table='hikashop_category'";
         $filters2[] = "b.published=1";
         $filters2[] = 'b.language_id=' . $myLang;
     }
     switch ($phrase) {
         case 'exact':
             $text = $db->Quote('%' . hikashop_getEscaped($text, true) . '%', false);
             $filters1 = array();
             $filters1[] = "a.category_name LIKE " . $text;
             $filters1[] = "a.category_description LIKE " . $text;
             if ($multi) {
                 $filters2[] = "b.value LIKE " . $text;
             }
             break;
         case 'all':
         case 'any':
         default:
             $words = explode(' ', $text);
             $wordFilters = array();
             $subWordFilters1 = array();
             $subWordFilters2 = array();
             $wordFilters2 = array();
             foreach ($words as $word) {
                 $word = $db->Quote('%' . hikashop_getEscaped($word, true) . '%', false);
                 $subWordFilters1[] = "a.category_name LIKE " . $word;
                 $subWordFilters2[] = "a.category_description LIKE " . $word;
                 if ($multi) {
                     $wordFilters2[] = "b.value LIKE " . $word;
//.........这里部分代码省略.........
开发者ID:rodhoff,项目名称:MNW,代码行数:101,代码来源:hikashop_categories.php


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