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


PHP Combination::isFeatureActive方法代码示例

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


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

示例1: getStaticblockLists

    public function getStaticblockLists($id_shop = NULL, $hook_position = 'top')
    {
        if (!Combination::isFeatureActive()) {
            return array();
        }
        $id_lang = (int) Context::getContext()->language->id;
        $object = Db::getInstance()->executeS('
                    SELECT * FROM ' . _DB_PREFIX_ . 'pos_staticblock AS psb 
					LEFT JOIN ' . _DB_PREFIX_ . 'pos_staticblock_lang AS psl ON psb.id_posstaticblock = psl.id_posstaticblock
                    LEFT JOIN ' . _DB_PREFIX_ . 'pos_staticblock_shop AS pss ON psb.id_posstaticblock = pss.id_posstaticblock
                    WHERE id_shop =' . $id_shop . ' 
						AND id_lang =' . $id_lang . '
						AND `hook_position` = "' . $hook_position . '" 
						AND `showhook` = 1 ORDER BY `posorder` ASC
		');
        $newObject = array();
        if (count($newObject > 0)) {
            foreach ($object as $key => $ob) {
                $nameModule = $ob['name_module'];
                $hookModule = $ob['hook_module'];
                $blockModule = $this->getModuleAssign($nameModule, $hookModule);
                $ob['block_module'] = $blockModule;
                $description = $ob['description'];
                $description = str_replace('/pos_hitstore/', __PS_BASE_URI__, $description);
                $ob['description'] = $description;
                // array_push($ob, $blockModule);
                $newObject[$key] = $ob;
            }
            return $newObject;
        }
        return null;
    }
开发者ID:IngenioContenidoDigital,项目名称:serta,代码行数:32,代码来源:Staticblock.php

示例2: initFieldsetFeaturesDetachables

 public function initFieldsetFeaturesDetachables()
 {
     $this->fields_form[2]['form'] = array('legend' => array('title' => $this->l('Optional features'), 'icon' => 'icon-puzzle-piece'), 'description' => $this->l('Some features can be disabled in order to improve performance.'), 'input' => array(array('type' => 'hidden', 'name' => 'features_detachables_up'), array('type' => 'switch', 'label' => $this->l('Combinations'), 'name' => 'combination', 'is_bool' => true, 'disabled' => Combination::isCurrentlyUsed(), 'values' => array(array('id' => 'combination_1', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'combination_0', 'value' => 0, 'label' => $this->l('No'))), 'hint' => $this->l('Choose "No" to disable Product Combinations.'), 'desc' => Combination::isCurrentlyUsed() ? $this->l('You cannot set this parameter to No when combinations are already used by some of your products') : null), array('type' => 'switch', 'label' => $this->l('Features'), 'name' => 'feature', 'is_bool' => true, 'values' => array(array('id' => 'feature_1', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'feature_0', 'value' => 0, 'label' => $this->l('No'))), 'hint' => $this->l('Choose "No" to disable Product Features.')), array('type' => 'switch', 'label' => $this->l('Customer Groups'), 'name' => 'customer_group', 'is_bool' => true, 'disabled' => Group::isCurrentlyUsed(), 'values' => array(array('id' => 'group_1', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'group_0', 'value' => 0, 'label' => $this->l('No'))), 'hint' => $this->l('Choose "No" to disable Customer Groups.'))), 'submit' => array('title' => $this->l('Save')));
     $this->fields_value['combination'] = Combination::isFeatureActive();
     $this->fields_value['feature'] = Feature::isFeatureActive();
     $this->fields_value['customer_group'] = Group::isFeatureActive();
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:7,代码来源:AdminPerformanceController.php

示例3: getProducts

    public static function getProducts($product_ids, $p = 1, $n, $active = true, Context $context = null)
    {
        if (!$context) {
            $context = Context::getContext();
        }
        $id_lang = $context->language->id;
        $front = true;
        if (!in_array($context->controller->controller_type, array('front', 'modulefront'))) {
            $front = false;
        }
        if ($p < 1) {
            $p = 1;
        }
        $sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) AS quantity' . (Combination::isFeatureActive() ? ', IFNULL(product_attribute_shop.id_product_attribute, 0) AS id_product_attribute,
					product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity' : '') . ', 
						pl.`description`, pl.`description_short`, pl.`available_now`,
					pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, 
					pl.`meta_title`, pl.`name`, image_shop.`id_image` id_image,
					il.`legend` as legend, m.`name` AS manufacturer_name, cl.`name` AS category_default,
					DATEDIFF(product_shop.`date_add`, DATE_SUB("' . date('Y-m-d') . ' 00:00:00",
					INTERVAL ' . (int) Configuration::get('PS_NB_DAYS_NEW_PRODUCT') . ' DAY)) > 0 AS new, product_shop.price AS orderprice
				FROM `' . _DB_PREFIX_ . 'category_product` cp
				LEFT JOIN `' . _DB_PREFIX_ . 'product` p
					ON p.`id_product` = cp.`id_product`
				' . Shop::addSqlAssociation('product', 'p') . (Combination::isFeatureActive() ? ' LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute_shop` product_attribute_shop
				ON (p.`id_product` = product_attribute_shop.`id_product` AND product_attribute_shop.`default_on` = 1 
					AND product_attribute_shop.id_shop=' . (int) $context->shop->id . ')' : '') . '
				' . Product::sqlStock('p', 0) . '
				LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl
					ON (product_shop.`id_category_default` = cl.`id_category`
					AND cl.`id_lang` = ' . (int) $id_lang . Shop::addSqlRestrictionOnLang('cl') . ')
				LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl
					ON (p.`id_product` = pl.`id_product`
					AND pl.`id_lang` = ' . (int) $id_lang . Shop::addSqlRestrictionOnLang('pl') . ')
				LEFT JOIN `' . _DB_PREFIX_ . 'image_shop` image_shop
					ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop=' . (int) $context->shop->id . ')
				LEFT JOIN `' . _DB_PREFIX_ . 'image_lang` il
					ON (image_shop.`id_image` = il.`id_image`
					AND il.`id_lang` = ' . (int) $id_lang . ')
				LEFT JOIN `' . _DB_PREFIX_ . 'manufacturer` m
					ON m.`id_manufacturer` = p.`id_manufacturer`
				WHERE product_shop.`id_shop` = ' . (int) $context->shop->id . ($active ? ' AND product_shop.`active` = 1' : '') . ($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '') . ($product_ids ? ' AND p.id_product IN (0, ' . pSQL(implode(',', $product_ids)) . ')' : '') . ' GROUP BY cp.id_product';
        if ($n) {
            $sql .= ' LIMIT ' . ((int) $p - 1) * (int) $n . ',' . (int) $n;
        }
        $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql, true, false);
        if (!$result) {
            return array();
        }
        /* Modify SQL result */
        return Product::getProductsProperties($id_lang, $result);
    }
开发者ID:vuduykhuong1412,项目名称:GitHub,代码行数:52,代码来源:productrecommended.php

示例4: postProcess

    public function postProcess()
    {
        if (!Combination::isFeatureActive()) {
            return;
        }
        if (!Tools::getValue($this->identifier) && Tools::getValue('id_attribute') && !Tools::getValue('attributeOrderby')) {
            // Override var of Controller
            $this->table = 'attribute';
            $this->className = 'Attribute';
            $this->identifier = 'id_attribute';
        }
        // If it's an attribute, load object Attribute()
        if (Tools::getValue('updateattribute') || Tools::isSubmit('deleteattribute') || Tools::isSubmit('submitAddattribute')) {
            if ($this->tabAccess['edit'] !== '1') {
                $this->errors[] = Tools::displayError('You do not have permission to edit this.');
            } else {
                if (!($object = new Attribute((int) Tools::getValue($this->identifier)))) {
                    $this->errors[] = Tools::displayError('An error occurred while updating the status for an object.') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
                }
            }
            if (Tools::getValue('position') !== false && Tools::getValue('id_attribute')) {
                $_POST['id_attribute_group'] = $object->id_attribute_group;
                if (!$object->updatePosition((int) Tools::getValue('way'), (int) Tools::getValue('position'))) {
                    $this->errors[] = Tools::displayError('Failed to update the position.');
                } else {
                    Tools::redirectAdmin(self::$currentIndex . '&conf=5&token=' . Tools::getAdminTokenLite('AdminAttributesGroups') . '#details_details_' . $object->id_attribute_group);
                }
            } else {
                if (Tools::isSubmit('deleteattribute') && Tools::getValue('id_attribute')) {
                    if (!$object->delete()) {
                        $this->errors[] = Tools::displayError('Failed to delete the attribute.');
                    } else {
                        Tools::redirectAdmin(self::$currentIndex . '&conf=1&token=' . Tools::getAdminTokenLite('AdminAttributesGroups'));
                    }
                } else {
                    if (Tools::isSubmit('submitAddattribute')) {
                        Hook::exec('actionObjectAttributeAddBefore');
                        $this->action = 'save';
                        $id_attribute = (int) Tools::getValue('id_attribute');
                        // Adding last position to the attribute if not exist
                        if ($id_attribute <= 0) {
                            $sql = 'SELECT `position`+1
							FROM `' . _DB_PREFIX_ . 'attribute`
							WHERE `id_attribute_group` = ' . (int) Tools::getValue('id_attribute_group') . '
							ORDER BY position DESC';
                            // set the position of the new group attribute in $_POST for postProcess() method
                            $_POST['position'] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
                        }
                        $_POST['id_parent'] = 0;
                        $this->processSave($this->token);
                    }
                }
            }
        } else {
            if (Tools::getValue('submitDel' . $this->table)) {
                if ($this->tabAccess['delete'] === '1') {
                    if (isset($_POST[$this->table . 'Box'])) {
                        $object = new $this->className();
                        if ($object->deleteSelection($_POST[$this->table . 'Box'])) {
                            Tools::redirectAdmin(self::$currentIndex . '&conf=2' . '&token=' . $this->token);
                        }
                        $this->errors[] = Tools::displayError('An error occurred while deleting this selection.');
                    } else {
                        $this->errors[] = Tools::displayError('You must select at least one element to delete.');
                    }
                } else {
                    $this->errors[] = Tools::displayError('You do not have permission to delete this.');
                }
                // clean position after delete
                AttributeGroup::cleanPositions();
            } else {
                if (Tools::isSubmit('submitAdd' . $this->table)) {
                    Hook::exec('actionObjectAttributeGroupAddBefore');
                    $id_attribute_group = (int) Tools::getValue('id_attribute_group');
                    // Adding last position to the attribute if not exist
                    if ($id_attribute_group <= 0) {
                        $sql = 'SELECT `position`+1
							FROM `' . _DB_PREFIX_ . 'attribute_group`
							ORDER BY position DESC';
                        // set the position of the new group attribute in $_POST for postProcess() method
                        $_POST['position'] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
                    }
                    // clean \n\r characters
                    foreach ($_POST as $key => $value) {
                        if (preg_match('/^name_/Ui', $key)) {
                            $_POST[$key] = str_replace('\\n', '', str_replace('\\r', '', $value));
                        }
                    }
                    parent::postProcess();
                } else {
                    parent::postProcess();
                }
            }
        }
    }
开发者ID:rongandat,项目名称:vatfairfoot,代码行数:95,代码来源:AdminAttributesGroupsController.php

示例5: getAttributes

    public static function getAttributes($db, $id_product, $id_lang)
    {
        if (!Combination::isFeatureActive()) {
            return '';
        }
        $attributes = '';
        $attributesArray = $db->executeS('
		SELECT al.name FROM ' . _DB_PREFIX_ . 'product_attribute pa
		INNER JOIN ' . _DB_PREFIX_ . 'product_attribute_combination pac ON pa.id_product_attribute = pac.id_product_attribute
		INNER JOIN ' . _DB_PREFIX_ . 'attribute_lang al ON (pac.id_attribute = al.id_attribute AND al.id_lang = ' . (int) $id_lang . ')
		' . Shop::addSqlAssociation('product_attribute', 'pa') . '
		WHERE pa.id_product = ' . (int) $id_product);
        foreach ($attributesArray as $attribute) {
            $attributes .= $attribute['name'] . ' ';
        }
        return $attributes;
    }
开发者ID:rongandat,项目名称:vatfairfoot,代码行数:17,代码来源:Search.php

示例6: getAttributes

    /**
     * Get all attributes for a given language / group
     *
     * @param integer $id_lang Language id
     * @param boolean $id_attribute_group Attribute group id
     * @return array Attributes
     */
    public static function getAttributes($id_lang, $id_attribute_group)
    {
        if (!Combination::isFeatureActive()) {
            return array();
        }
        return Db::getInstance()->executeS('
			SELECT *
			FROM `' . _DB_PREFIX_ . 'attribute` a
			' . Shop::addSqlAssociation('attribute', 'a') . '
			LEFT JOIN `' . _DB_PREFIX_ . 'attribute_lang` al
				ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = ' . (int) $id_lang . ')
			WHERE a.`id_attribute_group` = ' . (int) $id_attribute_group . '
			ORDER BY `position` ASC
		');
    }
开发者ID:jeprodev,项目名称:jeproshop,代码行数:22,代码来源:attribute.php

示例7: getNewProducts

    public function getNewProducts($where, $id_lang, $page_number = 0, $nb_products = 10, $count = false, $order_by = null, $order_way = null, Context $context = null)
    {
        if (!$context) {
            $context = Context::getContext();
        }
        $front = true;
        if (!in_array($context->controller->controller_type, array('front', 'modulefront'))) {
            $front = false;
        }
        if ($page_number < 0) {
            $page_number = 0;
        }
        if ($nb_products < 1) {
            $nb_products = 10;
        }
        if (empty($order_by) || $order_by == 'position') {
            $order_by = 'date_add';
        }
        if (empty($order_way)) {
            $order_way = 'DESC';
        }
        if ($order_by == 'id_product' || $order_by == 'price' || $order_by == 'date_add' || $order_by == 'date_upd') {
            $order_by_prefix = 'p';
        } else {
            if ($order_by == 'name') {
                $order_by_prefix = 'pl';
            }
        }
        if (!Validate::isOrderBy($order_by) || !Validate::isOrderWay($order_way)) {
            die(Tools::displayError());
        }
        $sql_groups = '';
        if (Group::isFeatureActive()) {
            $groups = FrontController::getCurrentCustomerGroups();
            $sql_groups = 'AND p.`id_product` IN (
					SELECT cp.`id_product`
					FROM `' . _DB_PREFIX_ . 'category_group` cg
					LEFT JOIN `' . _DB_PREFIX_ . 'category_product` cp ON (cp.`id_category` = cg.`id_category`)
					WHERE cg.`id_group` ' . (count($groups) ? 'IN (' . implode(',', $groups) . ')' : '= 1') . '
				)';
        }
        if (strpos($order_by, '.') > 0) {
            $order_by = explode('.', $order_by);
            $order_by_prefix = $order_by[0];
            $order_by = $order_by[1];
        }
        if ($count) {
            $sql = 'SELECT COUNT(p.`id_product`) AS nb
						FROM `' . _DB_PREFIX_ . 'product` p
						' . Shop::addSqlAssociation('product', 'p') . '
						WHERE product_shop.`active` = 1
						AND product_shop.`date_add` > "' . date('Y-m-d', strtotime('-' . (Configuration::get('PS_NB_DAYS_NEW_PRODUCT') ? (int) Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20) . ' DAY')) . '"
						' . ($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '') . '
						' . $sql_groups;
            return (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
        }
        $sql = new DbQuery();
        $sql->select('p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`,
				pl.`meta_keywords`, pl.`meta_title`, pl.`name`, MAX(image_shop.`id_image`) id_image, il.`legend`, m.`name` AS manufacturer_name,
				product_shop.`date_add` > "' . date('Y-m-d', strtotime('-' . (Configuration::get('PS_NB_DAYS_NEW_PRODUCT') ? (int) Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20) . ' DAY')) . '" as new');
        $sql->from('product', 'p');
        $sql->join(Shop::addSqlAssociation('product', 'p'));
        $sql->leftJoin('product_lang', 'pl', '
				p.`id_product` = pl.`id_product`
				AND pl.`id_lang` = ' . (int) $id_lang . Shop::addSqlRestrictionOnLang('pl'));
        $sql->leftJoin('image', 'i', 'i.`id_product` = p.`id_product`');
        $sql->join(Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1'));
        $sql->leftJoin('image_lang', 'il', 'i.`id_image` = il.`id_image` AND il.`id_lang` = ' . (int) $id_lang);
        $sql->leftJoin('manufacturer', 'm', 'm.`id_manufacturer` = p.`id_manufacturer`');
        $sql->where('product_shop.`active` = 1');
        if ($front) {
            $sql->where('product_shop.`visibility` IN ("both", "catalog")');
        }
        $sql->where('product_shop.`date_add` > "' . date('Y-m-d', strtotime('-' . (Configuration::get('PS_NB_DAYS_NEW_PRODUCT') ? (int) Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20) . ' DAY')) . '"');
        if (Group::isFeatureActive()) {
            $sql->where('p.`id_product` IN (
					SELECT cp.`id_product`
					FROM `' . _DB_PREFIX_ . 'category_group` cg
					LEFT JOIN `' . _DB_PREFIX_ . 'category_product` cp ON (cp.`id_category` = cg.`id_category`)
					WHERE ' . $where . ' cg.`id_group` ' . $sql_groups . '
				)');
        }
        $sql->groupBy('product_shop.id_product');
        $sql->orderBy((isset($order_by_prefix) ? pSQL($order_by_prefix) . '.' : '') . '`' . pSQL($order_by) . '` ' . pSQL($order_way));
        $sql->limit($nb_products, $page_number * $nb_products);
        if (Combination::isFeatureActive()) {
            $sql->select('MAX(product_attribute_shop.id_product_attribute) id_product_attribute');
            $sql->leftOuterJoin('product_attribute', 'pa', 'p.`id_product` = pa.`id_product`');
            $sql->join(Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.default_on = 1'));
        }
        $sql->join(Product::sqlStock('p', Combination::isFeatureActive() ? 'product_attribute_shop' : 0));
        $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
        if ($order_by == 'price') {
            Tools::orderbyPrice($result, $order_way);
        }
        if (!$result) {
            return false;
        }
        $products_ids = array();
        foreach ($result as $row) {
//.........这里部分代码省略.........
开发者ID:evgrishin,项目名称:se1614,代码行数:101,代码来源:advancetab.php

示例8: getCrossSells

    public static function getCrossSells($id_product, $id_lang, $limit = 12)
    {
        if (!$id_product || !$id_lang) {
            return;
        }
        $front = true;
        if (!in_array(Context::getContext()->controller->controller_type, array('front', 'modulefront'))) {
            $front = false;
        }
        $orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
		SELECT o.id_order
		FROM ' . _DB_PREFIX_ . 'orders o
		LEFT JOIN ' . _DB_PREFIX_ . 'order_detail od ON (od.id_order = o.id_order)
		WHERE o.valid = 1 AND od.product_id = ' . (int) $id_product);
        if (count($orders)) {
            $list = '';
            foreach ($orders as $order) {
                $list .= (int) $order['id_order'] . ',';
            }
            $list = rtrim($list, ',');
            $order_products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
				SELECT DISTINCT od.product_id, p.id_product, pl.name, pl.link_rewrite, p.reference, i.id_image, product_shop.show_price,
				cl.link_rewrite category, p.ean13, p.out_of_stock, p.id_category_default ' . (Combination::isFeatureActive() ? ', IFNULL(product_attribute_shop.id_product_attribute,0) id_product_attribute' : '') . '
				FROM ' . _DB_PREFIX_ . 'order_detail od
				LEFT JOIN ' . _DB_PREFIX_ . 'product p ON (p.id_product = od.product_id)
				' . Shop::addSqlAssociation('product', 'p') . (Combination::isFeatureActive() ? 'LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute_shop` product_attribute_shop
				ON (p.`id_product` = product_attribute_shop.`id_product` AND product_attribute_shop.`default_on` = 1 AND product_attribute_shop.id_shop=' . (int) Context::getContext()->shop->id . ')' : '') . '
				LEFT JOIN ' . _DB_PREFIX_ . 'product_lang pl ON (pl.id_product = od.product_id' . Shop::addSqlRestrictionOnLang('pl') . ')
				LEFT JOIN ' . _DB_PREFIX_ . 'category_lang cl ON (cl.id_category = product_shop.id_category_default' . Shop::addSqlRestrictionOnLang('cl') . ')
				LEFT JOIN ' . _DB_PREFIX_ . 'image i ON (i.id_product = od.product_id)
				WHERE od.id_order IN (' . $list . ')
					AND pl.id_lang = ' . (int) $id_lang . '
					AND cl.id_lang = ' . (int) $id_lang . '
					AND od.product_id != ' . (int) $id_product . '
					AND i.cover = 1
					AND product_shop.active = 1' . ($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '') . '
				ORDER BY RAND()
				LIMIT ' . (int) $limit . '
			', true, false);
            $tax_calc = Product::getTaxCalculationMethod();
            if (is_array($order_products)) {
                foreach ($order_products as &$order_product) {
                    $order_product['image'] = Context::getContext()->link->getImageLink($order_product['link_rewrite'], (int) $order_product['product_id'] . '-' . (int) $order_product['id_image'], ImageType::getFormatedName('medium'));
                    $order_product['link'] = Context::getContext()->link->getProductLink((int) $order_product['product_id'], $order_product['link_rewrite'], $order_product['category'], $order_product['ean13']);
                    if ($tax_calc == 0 || $tax_calc == 2) {
                        $order_product['displayed_price'] = Product::getPriceStatic((int) $order_product['product_id'], true, null);
                    } elseif ($tax_calc == 1) {
                        $order_product['displayed_price'] = Product::getPriceStatic((int) $order_product['product_id'], false, null);
                    }
                }
                return Product::getProductsProperties($id_lang, $order_products);
            }
        }
    }
开发者ID:nmardones,项目名称:PrestaShop,代码行数:54,代码来源:OrderDetail.php

示例9: initContent

 public function initContent()
 {
     if (!Combination::isFeatureActive()) {
         $url = '<a href="index.php?tab=AdminPerformance&token=' . Tools::getAdminTokenLite('AdminPerformance') . '#featuresDetachables">' . $this->trans('Performance', array(), 'Admin.Global') . '</a>';
         $this->displayWarning(sprintf($this->trans('This feature has been disabled. You can activate it here: %s.', array('%s' => $url), 'Admin.Catalog.Notification')));
         return;
     }
     // Init toolbar
     $this->initPageHeaderToolbar();
     $this->initGroupTable();
     $attributes = Attribute::getAttributes(Context::getContext()->language->id, true);
     $attribute_js = array();
     foreach ($attributes as $k => $attribute) {
         $attribute_js[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name'];
     }
     $attribute_groups = AttributeGroup::getAttributesGroups($this->context->language->id);
     $this->product = new Product((int) Tools::getValue('id_product'));
     $this->context->smarty->assign(array('tax_rates' => $this->product->getTaxesRate(), 'generate' => isset($_POST['generate']) && !count($this->errors), 'combinations_size' => count($this->combinations), 'product_name' => $this->product->name[$this->context->language->id], 'product_reference' => $this->product->reference, 'url_generator' => self::$currentIndex . '&id_product=' . (int) Tools::getValue('id_product') . '&attributegenerator&token=' . Tools::getValue('token'), 'attribute_groups' => $attribute_groups, 'attribute_js' => $attribute_js, 'toolbar_btn' => $this->toolbar_btn, 'toolbar_scroll' => true, 'show_page_header_toolbar' => $this->show_page_header_toolbar, 'page_header_toolbar_title' => $this->page_header_toolbar_title, 'page_header_toolbar_btn' => $this->page_header_toolbar_btn));
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:19,代码来源:AdminAttributeGeneratorController.php

示例10: searchProducts

    public function searchProducts($query)
    {
        if (version_compare(_PS_VERSION_, '1.5', '<')) {
            $sql = '
				SELECT p.`id_product`, pl.`name`, p.`weight`
				FROM `' . _DB_PREFIX_ . 'category_product` cp
				LEFT JOIN `' . _DB_PREFIX_ . 'product` p ON (p.`id_product` = cp.`id_product`)
				LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = "' . (int) $this->context->language->id . '")
				WHERE pl.`name` LIKE \'%' . pSQL($query) . '%\'
					OR p.`ean13` LIKE \'%' . pSQL($query) . '%\'
					OR p.`upc` LIKE \'%' . pSQL($query) . '%\'
					OR p.`reference` LIKE \'%' . pSQL($query) . '%\'
					OR p.`supplier_reference` LIKE \'%' . pSQL($query) . '%\'
				GROUP BY `id_product`
				ORDER BY pl.`name` ASC
			';
        } else {
            $sql = new DbQuery();
            $sql->select('p.`id_product`, pl.`name`, p.`weight`');
            $sql->from('category_product', 'cp');
            $sql->leftJoin('product', 'p', 'p.`id_product` = cp.`id_product`');
            $sql->join(Shop::addSqlAssociation('product', 'p'));
            $sql->leftJoin('product_lang', 'pl', '
				p.`id_product` = pl.`id_product`
				AND pl.`id_lang` = ' . (int) $this->context->language->id . Shop::addSqlRestrictionOnLang('pl'));
            $where = 'pl.`name` LIKE \'%' . pSQL($query) . '%\'
			OR p.`ean13` LIKE \'%' . pSQL($query) . '%\'
			OR p.`upc` LIKE \'%' . pSQL($query) . '%\'
			OR p.`reference` LIKE \'%' . pSQL($query) . '%\'
			OR p.`supplier_reference` LIKE \'%' . pSQL($query) . '%\'
			OR  p.`id_product` IN (SELECT id_product FROM ' . _DB_PREFIX_ . 'product_supplier sp WHERE `product_supplier_reference` LIKE \'%' . pSQL($query) . '%\')';
            $sql->groupBy('`id_product`');
            $sql->orderBy('pl.`name` ASC');
            if (Combination::isFeatureActive()) {
                $sql->leftJoin('product_attribute', 'pa', 'pa.`id_product` = p.`id_product`');
                $sql->join(Shop::addSqlAssociation('product_attribute', 'pa', false));
                $where .= ' OR pa.`reference` LIKE \'%' . pSQL($query) . '%\'';
            }
            $sql->where($where);
        }
        $result = Db::getInstance()->executeS($sql);
        if (!$result) {
            return array('found' => false, 'notfound' => $this->l('No product has been found.'));
        }
        foreach ($result as &$product) {
            $product['id_product_attribute'] = Product::getDefaultAttribute($product['id_product']);
            $product['weight_numeric'] = $product['weight'];
            $product['weight'] = sprintf('%.3f', $product['weight']) . ' ' . _DPDPOLAND_DEFAULT_WEIGHT_UNIT_;
        }
        return array('products' => $result, 'found' => true);
    }
开发者ID:rokaszygmantas,项目名称:dpdpoland,代码行数:51,代码来源:dpdpoland.php

示例11: initFieldsetFeaturesDetachables

 public function initFieldsetFeaturesDetachables()
 {
     $this->fields_form[2]['form'] = array('legend' => array('title' => $this->l('Optional features'), 'image' => '../img/admin/tab-plugins.gif'), 'desc' => $this->l('Some features can be disabled in order to improve performance.'), 'input' => array(array('type' => 'hidden', 'name' => 'features_detachables_up'), array('type' => 'radio', 'label' => $this->l('Combinations'), 'name' => 'combination', 'class' => 't', 'is_bool' => true, 'disabled' => Combination::isCurrentlyUsed(), 'values' => array(array('id' => 'combination_1', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'combination_0', 'value' => 0, 'label' => $this->l('No'))), 'desc' => $this->l('These features will be disabled')), array('type' => 'radio', 'label' => $this->l('Features'), 'name' => 'feature', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'feature_1', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'feature_0', 'value' => 0, 'label' => $this->l('No'))), 'desc' => $this->l('These features will be disabled'))));
     $this->fields_value['combination'] = Combination::isFeatureActive();
     $this->fields_value['feature'] = Feature::isFeatureActive();
 }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:6,代码来源:AdminPerformanceController.php

示例12: getAttributes

    /**
     * Get all attributes for a given language
     *
     * @param integer $id_lang Language id
     * @param boolean $notNull Get only not null fields if true
     * @return array Attributes
     */
    public static function getAttributes($id_lang, $not_null = false)
    {
        if (!Combination::isFeatureActive()) {
            return array();
        }
        return Db::getInstance()->executeS('
			SELECT DISTINCT ag.*, agl.*, a.`id_attribute`, al.`name`, agl.`name` AS `attribute_group`
			FROM `' . _DB_PREFIX_ . 'attribute_group` ag
			LEFT JOIN `' . _DB_PREFIX_ . 'attribute_group_lang` agl
				ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = ' . (int) $id_lang . ')
			LEFT JOIN `' . _DB_PREFIX_ . 'attribute` a
				ON a.`id_attribute_group` = ag.`id_attribute_group`
			LEFT JOIN `' . _DB_PREFIX_ . 'attribute_lang` al
				ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = ' . (int) $id_lang . ')
			' . Shop::addSqlAssociation('attribute_group', 'ag') . '
			' . Shop::addSqlAssociation('attribute', 'a') . '
			' . ($not_null ? 'WHERE a.`id_attribute` IS NOT NULL AND al.`name` IS NOT NULL' : '') . '
			ORDER BY agl.`name` ASC, a.`position` ASC
		');
    }
开发者ID:jicheng17,项目名称:pengwine,代码行数:27,代码来源:Attribute.php

示例13: getProductProperties

 public static function getProductProperties($id_lang, $row, Context $context = null)
 {
     if (!$row['id_product']) {
         return false;
     }
     if ($context == null) {
         $context = Context::getContext();
     }
     // Product::getDefaultAttribute is only called if id_product_attribute is missing from the SQL query at the origin of it:
     // consider adding it in order to avoid unnecessary queries
     $row['allow_oosp'] = Product::isAvailableWhenOutOfStock($row['out_of_stock']);
     if (Combination::isFeatureActive() && (!isset($row['id_product_attribute']) || !$row['id_product_attribute']) && (isset($row['cache_default_attribute']) && ($ipa_default = $row['cache_default_attribute']) !== null || ($ipa_default = Product::getDefaultAttribute($row['id_product'], !$row['allow_oosp'])))) {
         $row['id_product_attribute'] = $ipa_default;
     }
     if (!Combination::isFeatureActive() || !isset($row['id_product_attribute'])) {
         $row['id_product_attribute'] = 0;
     }
     // Tax
     $usetax = Tax::excludeTaxeOption();
     $cache_key = $row['id_product'] . '-' . $row['id_product_attribute'] . '-' . $id_lang . '-' . (int) $usetax;
     if (isset($row['id_product_pack'])) {
         $cache_key .= '-pack' . $row['id_product_pack'];
     }
     if (isset(self::$producPropertiesCache[$cache_key])) {
         return self::$producPropertiesCache[$cache_key];
     }
     // Datas
     $row['category'] = Category::getLinkRewrite((int) $row['id_category_default'], (int) $id_lang);
     $row['link'] = $context->link->getProductLink((int) $row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']);
     $row['attribute_price'] = 0;
     if (isset($row['id_product_attribute']) && $row['id_product_attribute']) {
         $row['attribute_price'] = (double) Product::getProductAttributePrice($row['id_product_attribute']);
     }
     $row['price_tax_exc'] = Product::getPriceStatic((int) $row['id_product'], false, isset($row['id_product_attribute']) && !empty($row['id_product_attribute']) ? (int) $row['id_product_attribute'] : null, self::$_taxCalculationMethod == PS_TAX_EXC ? 2 : 6);
     if (self::$_taxCalculationMethod == PS_TAX_EXC) {
         $row['price_tax_exc'] = Tools::ps_round($row['price_tax_exc'], 2);
         $row['price'] = Product::getPriceStatic((int) $row['id_product'], true, isset($row['id_product_attribute']) && !empty($row['id_product_attribute']) ? (int) $row['id_product_attribute'] : null, 6);
         $row['price_without_reduction'] = Product::getPriceStatic((int) $row['id_product'], false, isset($row['id_product_attribute']) && !empty($row['id_product_attribute']) ? (int) $row['id_product_attribute'] : null, 2, null, false, false);
     } else {
         $row['price'] = Tools::ps_round(Product::getPriceStatic((int) $row['id_product'], true, isset($row['id_product_attribute']) && !empty($row['id_product_attribute']) ? (int) $row['id_product_attribute'] : null, 2), 2);
         $row['price_without_reduction'] = Product::getPriceStatic((int) $row['id_product'], true, isset($row['id_product_attribute']) && !empty($row['id_product_attribute']) ? (int) $row['id_product_attribute'] : null, 6, null, false, false);
     }
     $row['reduction'] = Product::getPriceStatic((int) $row['id_product'], (bool) $usetax, (int) $row['id_product_attribute'], 6, null, true, true, 1, true, null, null, null, $specific_prices);
     $row['specific_prices'] = $specific_prices;
     if ($row['id_product_attribute']) {
         $row['quantity_all_versions'] = $row['quantity'];
         $row['quantity'] = Product::getQuantity((int) $row['id_product'], $row['id_product_attribute'], isset($row['cache_is_pack']) ? $row['cache_is_pack'] : null);
     } else {
         $row['quantity'] = Product::getQuantity((int) $row['id_product']);
     }
     $row['id_image'] = Product::defineProductImage($row, $id_lang);
     $row['features'] = Product::getFrontFeaturesStatic((int) $id_lang, $row['id_product']);
     $row['attachments'] = array();
     if (!isset($row['cache_has_attachments']) || $row['cache_has_attachments']) {
         $row['attachments'] = Product::getAttachmentsStatic((int) $id_lang, $row['id_product']);
     }
     $row['virtual'] = !isset($row['is_virtual']) || $row['is_virtual'] ? 1 : 0;
     // Pack management
     $row['pack'] = !isset($row['cache_is_pack']) ? Pack::isPack($row['id_product']) : (int) $row['cache_is_pack'];
     $row['packItems'] = $row['pack'] ? Pack::getItemTable($row['id_product'], $id_lang) : array();
     $row['nopackprice'] = $row['pack'] ? Pack::noPackPrice($row['id_product']) : 0;
     if ($row['pack'] && !Pack::isInStock($row['id_product'])) {
         $row['quantity'] = 0;
     }
     self::$producPropertiesCache[$cache_key] = $row;
     return self::$producPropertiesCache[$cache_key];
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:67,代码来源:Product.php

示例14: getOrderProducts

 /**
  * @param array $products_id an array of product ids
  * @return array
  */
 protected function getOrderProducts(array $products_id)
 {
     $q_orders = 'SELECT o.id_order
     FROM ' . _DB_PREFIX_ . 'orders o
     LEFT JOIN ' . _DB_PREFIX_ . 'order_detail od ON (od.id_order = o.id_order)
     WHERE o.valid = 1 AND od.product_id IN (' . implode(',', $products_id) . ')';
     $orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($q_orders);
     $final_products_list = array();
     if (count($orders) > 0) {
         $list = '';
         foreach ($orders as $order) {
             $list .= (int) $order['id_order'] . ',';
         }
         $list = rtrim($list, ',');
         $list_product_ids = join(',', $products_id);
         if (Group::isFeatureActive()) {
             $sql_groups_join = '
             LEFT JOIN `' . _DB_PREFIX_ . 'category_product` cp ON (cp.`id_category` = product_shop.id_category_default
                 AND cp.id_product = product_shop.id_product)
             LEFT JOIN `' . _DB_PREFIX_ . 'category_group` cg ON (cp.`id_category` = cg.`id_category`)';
             $groups = FrontController::getCurrentCustomerGroups();
             $sql_groups_where = 'AND cg.`id_group` ' . (count($groups) ? 'IN (' . implode(',', $groups) . ')' : '=' . (int) Group::getCurrent()->id);
         }
         $order_products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
             SELECT DISTINCT od.product_id, pl.name, pl.description_short, pl.link_rewrite, p.reference, i.id_image, product_shop.show_price,
                 cl.link_rewrite category, p.ean13, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity
             FROM ' . _DB_PREFIX_ . 'order_detail od
             LEFT JOIN ' . _DB_PREFIX_ . 'product p ON (p.id_product = od.product_id)
             ' . Shop::addSqlAssociation('product', 'p') . (Combination::isFeatureActive() ? 'LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute` pa
             ON (p.`id_product` = pa.`id_product`)
             ' . Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.`default_on` = 1') . '
             ' . Product::sqlStock('p', 'product_attribute_shop', false, $this->context->shop) : Product::sqlStock('p', 'product', false, $this->context->shop)) . '
             LEFT JOIN ' . _DB_PREFIX_ . 'product_lang pl ON (pl.id_product = od.product_id' . Shop::addSqlRestrictionOnLang('pl') . ')
             LEFT JOIN ' . _DB_PREFIX_ . 'category_lang cl ON (cl.id_category = product_shop.id_category_default' . Shop::addSqlRestrictionOnLang('cl') . ')
             LEFT JOIN ' . _DB_PREFIX_ . 'image i ON (i.id_product = od.product_id)
             ' . (Group::isFeatureActive() ? $sql_groups_join : '') . '
             WHERE od.id_order IN (' . $list . ')
             AND pl.id_lang = ' . (int) $this->context->language->id . '
             AND cl.id_lang = ' . (int) $this->context->language->id . '
             AND od.product_id NOT IN (' . $list_product_ids . ')
             AND i.cover = 1
             AND product_shop.active = 1
             ' . (Group::isFeatureActive() ? $sql_groups_where : '') . '
             ORDER BY RAND()
             LIMIT ' . (int) Configuration::get('CROSSSELLING_NBR'));
         $tax_calc = Product::getTaxCalculationMethod();
         foreach ($order_products as &$order_product) {
             $order_product['id_product'] = (int) $order_product['product_id'];
             $order_product['image'] = $this->context->link->getImageLink($order_product['link_rewrite'], (int) $order_product['product_id'] . '-' . (int) $order_product['id_image'], ImageType::getFormatedName('home'));
             $order_product['link'] = $this->context->link->getProductLink((int) $order_product['product_id'], $order_product['link_rewrite'], $order_product['category'], $order_product['ean13']);
             if (Configuration::get('CROSSSELLING_DISPLAY_PRICE') && ($tax_calc == 0 || $tax_calc == 2)) {
                 $order_product['displayed_price'] = Product::getPriceStatic((int) $order_product['product_id'], true, null);
             } elseif (Configuration::get('CROSSSELLING_DISPLAY_PRICE') && $tax_calc == 1) {
                 $order_product['displayed_price'] = Product::getPriceStatic((int) $order_product['product_id'], false, null);
             }
             $order_product['allow_oosp'] = Product::isAvailableWhenOutOfStock((int) $order_product['out_of_stock']);
             if (!isset($final_products_list[$order_product['product_id'] . '-' . $order_product['id_image']])) {
                 $final_products_list[$order_product['product_id'] . '-' . $order_product['id_image']] = $order_product;
             }
         }
     }
     return $final_products_list;
 }
开发者ID:ortegon000,项目名称:tienda,代码行数:67,代码来源:crossselling.php

示例15: _getProducts


//.........这里部分代码省略.........
        }
        $order_by_prefix = false;
        $addJoin = '';
        $addSelect = '';
        if ($order_by == 'id_product' || $order_by == 'date_add' || $order_by == 'date_upd') {
            $order_by_prefix = 'p';
        } elseif ($order_by == 'name') {
            $order_by_prefix = 'pl';
        } elseif ($order_by == 'manufacturer' || $order_by == 'manufacturer_name') {
            $order_by_prefix = 'm';
            $order_by = 'name';
        } elseif ($order_by == 'position') {
            $order_by_prefix = 'cp';
        } elseif ($order_by == 'discount') {
            $order_by_prefix = 'sp';
            $order_by = 'reduction';
            $addJoin = ' LEFT JOIN `' . _DB_PREFIX_ . 'specific_price` sp On p.`id_product` = sp.`id_product` ';
            $addSelect = ', sp.reduction, sp.`from`, sp.`to`';
        } elseif ($order_by == 'review') {
            $order_by_prefix = '';
            $order_by = 'total_review';
            $addJoin = ' LEFT JOIN `' . _DB_PREFIX_ . 'product_comment` pr ON pr.`id_product` = p.`id_product` ';
            $addSelect = ', COUNT(pr.grade) as total_review';
        } elseif ($order_by == 'view') {
            $order_by_prefix = '';
            $order_by = 'total_view';
            $addJoin = ' LEFT JOIN ' . _DB_PREFIX_ . 'simplecategory_product_view as pv ON pv.`product_id` = p.`id_product` ';
            $addSelect = ', pv.total as total_view';
        } elseif ($order_by == 'rate') {
            $order_by_prefix = '';
            $order_by = 'total_avg';
            $addJoin = ' LEFT JOIN `' . _DB_PREFIX_ . 'product_comment` pr ON pr.`id_product` = p.`id_product` ';
            $addSelect = ', (SUM(pr.`grade`) / COUNT(pr.`grade`)) AS total_avg';
        } elseif ($order_by == 'seller') {
            $order_by_prefix = '';
            $order_by = 'sales';
            $addJoin = ' LEFT JOIN `' . _DB_PREFIX_ . 'product_sale` ps ON ps.`id_product` = p.`id_product` ';
            $addSelect = ', ps.`quantity` AS sales';
        }
        if ($order_by != 'reduction' && $on_discount != 2) {
            $addJoin = ' LEFT JOIN `' . _DB_PREFIX_ . 'specific_price` sp On p.`id_product` = sp.`id_product` ';
            $addSelect = ', sp.reduction, sp.`from`, sp.`to`';
        }
        if ($order_by == 'price') {
            $order_by = 'orderprice';
        }
        if (!Validate::isBool($active) || !Validate::isOrderBy($order_by) || !Validate::isOrderWay($order_way)) {
            die(Tools::displayError());
        }
        $id_supplier = (int) Tools::getValue('id_supplier');
        if ($get_total) {
            $sql = 'SELECT COUNT(cp.`id_product`) AS total
					FROM `' . _DB_PREFIX_ . 'product` p 					
					' . Shop::addSqlAssociation('product', 'p') . ' ' . $addJoin . '
					LEFT JOIN `' . _DB_PREFIX_ . 'category_product` cp ON p.`id_product` = cp.`id_product`
					WHERE cp.`id_category` IN (' . implode(', ', $categoryIds) . ') ' . $where . ($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '') . ($active ? ' AND product_shop.`active` = 1' : '') . ($ids_product ? $ids_product : '') . ($id_supplier ? 'AND p.id_supplier = ' . (int) $id_supplier : '');
            return (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
        }
        $sql = 'SELECT DISTINCT 
				p.id_product,  MAX(product_attribute_shop.id_product_attribute) id_product_attribute, pl.`link_rewrite`, pl.`name`, pl.`description_short`, product_shop.`id_category_default`,
				MAX(image_shop.`id_image`) id_image, il.`legend`, p.`ean13`, p.`upc`, cl.`link_rewrite` AS category, p.show_price, p.available_for_order, IFNULL(stock.quantity, 0) as quantity, p.customizable,
				IFNULL(pa.minimal_quantity, p.minimal_quantity) as minimal_quantity, stock.out_of_stock,
				product_shop.`date_add` > "' . date('Y-m-d', strtotime('-' . $PS_NB_DAYS_NEW_PRODUCT . ' DAY')) . '" as `new`,
				product_shop.`on_sale`, MAX(product_attribute_shop.minimal_quantity) AS product_attribute_minimal_quantity, product_shop.price AS orderprice ' . $addSelect . '
				FROM `' . _DB_PREFIX_ . 'category_product` cp 
				LEFT JOIN `' . _DB_PREFIX_ . 'product` p 
					ON p.`id_product` = cp.`id_product` 
				' . Shop::addSqlAssociation('product', 'p') . $addJoin . (Combination::isFeatureActive() ? 'LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute` pa 
				ON (p.`id_product` = pa.`id_product`) 
				' . Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.`default_on` = 1') . ' 
				' . Product::sqlStock('p', 'product_attribute_shop', false, $context->shop) : Product::sqlStock('p', 'product', false, Context::getContext()->shop)) . ' 
				LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl 
					ON (product_shop.`id_category_default` = cl.`id_category` 
					AND cl.`id_lang` = ' . (int) $id_lang . Shop::addSqlRestrictionOnLang('cl') . ')
				LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl 
					ON (p.`id_product` = pl.`id_product` 
					AND pl.`id_lang` = ' . (int) $id_lang . Shop::addSqlRestrictionOnLang('pl') . ')
				LEFT JOIN `' . _DB_PREFIX_ . 'image` i 
					ON (i.`id_product` = p.`id_product`) ' . Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1') . ' 
				LEFT JOIN `' . _DB_PREFIX_ . 'image_lang` il 
					ON (image_shop.`id_image` = il.`id_image` 
					AND il.`id_lang` = ' . (int) $id_lang . ')
				LEFT JOIN `' . _DB_PREFIX_ . 'manufacturer` m 
					ON m.`id_manufacturer` = p.`id_manufacturer` 
				WHERE product_shop.`id_shop` = ' . (int) $context->shop->id . ' 
					AND cp.`id_category` IN (' . implode(', ', $categoryIds) . ') ' . $where . ($active ? ' AND product_shop.`active` = 1' : '') . ($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '') . ($id_supplier ? ' AND p.id_supplier = ' . (int) $id_supplier : '') . ' GROUP BY product_shop.id_product';
        if ($random === true) {
            $sql .= ' ORDER BY RAND() LIMIT ' . (int) $random_number_products;
        } else {
            $sql .= ' ORDER BY ' . (!empty($order_by_prefix) ? $order_by_prefix . '.' : '') . '`' . bqSQL($order_by) . '` ' . pSQL($order_way) . ' LIMIT ' . ((int) $p - 1) * (int) $n . ',' . (int) $n;
        }
        $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
        if ($order_by == 'orderprice') {
            Tools::orderbyPrice($result, $order_way);
        }
        if (!$result) {
            return array();
        }
        return Product::getProductsProperties($id_lang, $result);
    }
开发者ID:zangles,项目名称:lennyba,代码行数:101,代码来源:megaboxs.php


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