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


PHP Category::getHomeCategories方法代码示例

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


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

示例1: hookHome

    /**
     * Returns module content
     *
     * @param array $params Parameters
     * @return string Content
     */
    function hookHome($params)
    {
        global $smarty, $cookie;
        /*  ONLY FOR THEME OLDER THAN v1.0 */
        global $link;
        $smarty->assign(array('categories' => Category::getHomeCategories(intval($params['cookie']->id_lang), true), 'link' => $link));
        /* ELSE */
        $id_customer = intval($params['cookie']->id_customer);
        $maxdepth = 1;
        if (!($result = Db::getInstance()->ExecuteS('
		SELECT DISTINCT c.*, cl.*
		FROM `' . _DB_PREFIX_ . 'category` c 
		LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = ' . intval($params['cookie']->id_lang) . ')
		LEFT JOIN `' . _DB_PREFIX_ . 'category_group` cg ON (cg.`id_category` = c.`id_category`)
		WHERE 1' . (intval($maxdepth) != 0 ? ' AND `level_depth` <= ' . intval($maxdepth) : '') . '
		AND (c.`active` = 1 OR c.`id_category`= 1)
		AND cg.`id_group` ' . (!$cookie->id_customer ? '= 1' : 'IN (SELECT id_group FROM ' . _DB_PREFIX_ . 'customer_group WHERE id_customer = ' . intval($cookie->id_customer) . ')') . '
		ORDER BY `level_depth` ASC, cl.`name` ASC'))) {
            return;
        }
        $resultParents = array();
        $resultIds = array();
        foreach ($result as $row) {
            ${$row}['name'] = Category::hideCategoryPosition($row['name']);
            $resultParents[$row['id_parent']][] = $row;
            $resultIds[$row['id_category']] = $row;
        }
        $blockCategTree = $this->getTree($resultParents, $resultIds, 1);
        $smarty->assign('blockCategTree', $blockCategTree);
        return $this->display(__FILE__, 'home_menu.tpl');
    }
开发者ID:raulgimenez,项目名称:dreamongraphics_shop,代码行数:37,代码来源:home_menu.php

示例2: hookLeftColumn

    function hookLeftColumn($params)
    {
        global $smarty, $cookie;
        /*  ONLY FOR THEME OLDER THAN v1.0 */
        global $link;
        $smarty->assign(array('categories' => Category::getHomeCategories(intval($params['cookie']->id_lang), true), 'link' => $link));
        /* ELSE */
        $id_customer = intval($params['cookie']->id_customer);
        $maxdepth = Configuration::get('BLOCK_CATEG_MAX_DEPTH');
        if (!($result = Db::getInstance()->ExecuteS('
		SELECT DISTINCT c.*, cl.*
		FROM `' . _DB_PREFIX_ . 'category` c 
		LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = ' . intval($params['cookie']->id_lang) . ')
		LEFT JOIN `' . _DB_PREFIX_ . 'category_group` ctg ON (ctg.`id_category` = c.`id_category`)
		' . ($id_customer ? 'INNER JOIN `' . _DB_PREFIX_ . 'customer_group` cg ON (cg.`id_group` = ctg.`id_group` AND cg.`id_customer` = ' . intval($id_customer) . ')' : '') . '
		WHERE 1' . (intval($maxdepth) != 0 ? ' AND `level_depth` <= ' . intval($maxdepth) : '') . '
		AND (c.`active` = 1 OR c.`id_category`= 1)
		' . (!$id_customer ? 'AND ctg.`id_group` = 1' : '') . '
		ORDER BY `level_depth` ASC, cl.`name` ASC'))) {
            return;
        }
        $resultParents = array();
        $resultIds = array();
        foreach ($result as $row) {
            ${$row}['name'] = Category::hideCategoryPosition($row['name']);
            $resultParents[$row['id_parent']][] = $row;
            $resultIds[$row['id_category']] = $row;
        }
        $blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEG_MAX_DEPTH'));
        $isDhtml = Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false;
        if (isset($_GET['id_category'])) {
            $cookie->last_visited_category = intval($_GET['id_category']);
            $smarty->assign('currentCategoryId', intval($_GET['id_category']));
        }
        if (isset($_GET['id_product'])) {
            if (!isset($cookie->last_visited_category) or !Product::idIsOnCategoryId(intval($_GET['id_product']), array('0' => array('id_category' => $cookie->last_visited_category)))) {
                $product = new Product(intval($_GET['id_product']));
                if (isset($product) and Validate::isLoadedObject($product)) {
                    $cookie->last_visited_category = intval($product->id_category_default);
                }
            }
            $smarty->assign('currentCategoryId', intval($cookie->last_visited_category));
        }
        $smarty->assign('blockCategTree', $blockCategTree);
        if (file_exists(_PS_THEME_DIR_ . 'modules/blockcategories/blockcategories.tpl')) {
            $smarty->assign('branche_tpl_path', _PS_THEME_DIR_ . 'modules/blockcategories/category-tree-branch.tpl');
        } else {
            $smarty->assign('branche_tpl_path', _PS_MODULE_DIR_ . 'blockcategories/category-tree-branch.tpl');
        }
        $smarty->assign('isDhtml', $isDhtml);
        /* /ONLY FOR THEME OLDER THAN v1.0 */
        return $this->display(__FILE__, 'blockcategories.tpl');
    }
开发者ID:sealence,项目名称:local,代码行数:53,代码来源:blockcategories.php

示例3: hookHome

 function hookHome($params)
 {
     $number_categorydisplay = 3;
     global $smarty;
     $categories = Category::getHomeCategories((int) $params['cookie']->id_lang, true);
     shuffle($categories);
     for ($i = 0; $i < $number_categorydisplay; $i++) {
         $categorydisplay[] = $categories[$i];
     }
     //var_dump($categorydisplay);
     foreach ($categorydisplay as $cate) {
         $category = new Category($cate[id_category], Configuration::get('PS_LANG_DEFAULT'));
         $nb = (int) Configuration::get('HOME_FEATURED_NBR');
         $products[$cate[id_category]] = $category->getProducts((int) $params['cookie']->id_lang, 1, 10, null, null, false, true, true, 3);
         $n++;
     }
     $smarty->assign(array('products' => $products, 'categories' => $categorydisplay, 'homeSize' => Image::getSize('home')));
     return $this->display(__FILE__, 'blocknewproductcatagories.tpl');
 }
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:19,代码来源:blocknewproductcatagories.php

示例4: assignCategory

 /**
  * Assign template vars related to category
  */
 protected function assignCategory()
 {
     // Assign category to the template
     if ($this->category !== false && Validate::isLoadedObject($this->category)) {
         $this->context->smarty->assign(array('path' => Tools::getPath($this->category->id, $this->product->name, true), 'category' => $this->category, 'subCategories' => $this->category->getSubCategories($this->context->language->id, true), 'id_category_current' => (int) $this->category->id, 'id_category_parent' => (int) $this->category->id_parent, 'return_category_name' => Tools::safeOutput($this->category->name)));
     } else {
         $this->context->smarty->assign('path', Tools::getPath((int) $this->product->id_category_default, $this->product->name));
     }
     $this->context->smarty->assign('categories', Category::getHomeCategories($this->context->language->id));
     $this->context->smarty->assign(array('HOOK_PRODUCT_FOOTER' => Hook::exec('displayFooterProduct', array('product' => $this->product, 'category' => $this->category))));
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:14,代码来源:ProductController.php

示例5: assignCategory

 /**
  * Assign template vars related to category
  */
 protected function assignCategory()
 {
     // Assign category to the template
     if ($this->category !== false && Validate::isLoadedObject($this->category) && $this->category->inShop() && $this->category->isAssociatedToShop()) {
         $path = Tools::getPath($this->category->id, $this->product->name, true);
     } elseif (Category::inShopStatic($this->product->id_category_default, $this->context->shop)) {
         $this->category = new Category((int) $this->product->id_category_default, (int) $this->context->language->id);
         if (Validate::isLoadedObject($this->category) && $this->category->active && $this->category->isAssociatedToShop()) {
             $path = Tools::getPath((int) $this->product->id_category_default, $this->product->name);
         }
     }
     if (!isset($path) || !$path) {
         $path = Tools::getPath((int) $this->context->shop->id_category, $this->product->name);
     }
     $sub_categories = array();
     if (Validate::isLoadedObject($this->category)) {
         $sub_categories = $this->category->getSubCategories($this->context->language->id, true);
         // various assignements before Hook::exec
         $this->context->smarty->assign(array('path' => $path, 'category' => $this->category, 'subCategories' => $sub_categories, 'id_category_current' => (int) $this->category->id, 'id_category_parent' => (int) $this->category->id_parent, 'return_category_name' => Tools::safeOutput($this->category->getFieldByLang('name')), 'categories' => Category::getHomeCategories($this->context->language->id, true, (int) $this->context->shop->id)));
     }
     $this->context->smarty->assign(array('HOOK_PRODUCT_FOOTER' => Hook::exec('displayFooterProduct', array('product' => $this->product, 'category' => $this->category))));
 }
开发者ID:zangles,项目名称:lennyba,代码行数:25,代码来源:ProductController.php

示例6: process


//.........这里部分代码省略.........
     if ((int) Tools::getValue('pp') == 1) {
         $time8 = time();
         echo 'time8: ' . $time8;
     }
     if ($this->is_saree || $this->is_lehenga) {
         if ($this->is_lehenga) {
             self::$smarty->assign('is_lehenga', $this->is_lehenga);
         }
         self::$smarty->assign('as_shown', (bool) $this->product->as_shown);
         /*if($blouse_measurements = $this->getCustomerMeasurements(self::$cookie->id_customer, 1))
               self::$smarty->assign('measurement_info', $blouse_measurements);
           if($skirt_measurements = $this->getCustomerMeasurements(self::$cookie->id_customer, 2))
               self::$smarty->assign('skirt_measurement_info', $skirt_measurements);*/
         if ((int) Tools::getValue('pp') == 1) {
             $time81 = time();
             echo 'time81: ' . $time81;
         }
         if ($this->is_saree) {
             //count of all styles mapped to this product
             $res = Db::getInstance()->getRow("select count(s.id_style) as style_count from ps_styles s inner join ps_product_style ps on ps.id_style = s.id_style and ps.id_product = {$id_product} and s.style_type = 1");
             $style_count = (int) $res['style_count'];
             if ($style_count === 0) {
                 // show the default style for sarees
                 $style = array('id_style' => 1, 'style_image_small' => '1-small.png', 'style_name' => 'Round');
             } else {
                 $res = Db::getInstance()->getRow("select s.id_style, s.style_name, s.style_image_small  from ps_styles s inner join ps_product_style ps on ps.id_style = s.id_style and ps.id_product = {$id_product} and s.style_type = 1 and ps.is_default = 1");
                 if (!empty($res)) {
                     //show the default style for this product
                     $style = array('id_style' => $res['id_style'], 'style_image_small' => $res['style_image_small'], 'style_name' => $res['style_name']);
                 }
             }
             if ((int) Tools::getValue('pp') == 1) {
                 $time82 = time();
                 echo 'time82: ' . $time82;
             }
             self::$smarty->assign('blouse_style_count', $style_count);
             self::$smarty->assign('blouse_style', $style);
         }
     } else {
         if ($this->is_skd || $this->is_skd_rts) {
             self::$smarty->assign('is_anarkali', $this->is_anarkali);
             if ($this->is_anarkali) {
                 if ($kurta_measurements = $this->getCustomerMeasurements(self::$cookie->id_customer, 5)) {
                     self::$smarty->assign('kurta_measurement_info', $kurta_measurements);
                 }
             } else {
                 if ($kurta_measurements = $this->getCustomerMeasurements(self::$cookie->id_customer, 3)) {
                     self::$smarty->assign('kurta_measurement_info', $kurta_measurements);
                 }
             }
             if ($salwar_measurements = $this->getCustomerMeasurements(self::$cookie->id_customer, 4)) {
                 self::$smarty->assign('salwar_measurement_info', $salwar_measurements);
             }
             //get default styles for this product (RTS)
             if ($this->is_skd_rts) {
                 $res = Db::getInstance()->ExecuteS("select count(s.id_style) as style_count, s.style_type, ps.id_product from ps_styles s inner join ps_product_style ps on ps.id_style = s.id_style and ps.id_product = {$id_product} group by ps.id_product,s.style_type");
                 foreach ($res as $s) {
                     $style_count = (int) $s['style_count'];
                     if ((int) $s['style_type'] === 4) {
                         self::$smarty->assign('kurta_style_count', $style_count);
                     } else {
                         if ((int) $s['style_type'] === 5) {
                             self::$smarty->assign('salwar_style_count', $style_count);
                         }
                     }
                 }
                 $res = Db::getInstance()->ExecuteS("select s.id_style, s.style_type, s.style_image_small, s.style_name from ps_styles s inner join ps_product_style ps on ps.id_style = s.id_style and ps.id_product = {$id_product} and ps.is_default = 1");
                 foreach ($res as $s) {
                     $style = array('id_style' => $s['id_style'], 'style_image_small' => $s['style_image_small'], 'style_name' => $s['style_name']);
                     if ((int) $s['style_type'] === 4) {
                         self::$smarty->assign('kurta_style', $style);
                     } else {
                         if ((int) $s['style_type'] === 5) {
                             self::$smarty->assign('salwar_style', $style);
                         }
                     }
                 }
             }
         }
     }
     self::$smarty->assign('is_bottoms', $this->is_bottoms);
     self::$smarty->assign('is_abaya', $this->is_abaya);
     self::$smarty->assign('is_wristwear', $this->is_wristwear);
     self::$smarty->assign('is_pakistani_rts', $this->is_pakistani_rts);
     if ((int) Tools::getValue('pp') == 1) {
         $time85 = time();
         echo 'time85: ' . $time85;
     }
     self::$smarty->assign(array('ENT_NOQUOTES' => ENT_NOQUOTES, 'outOfStockAllowed' => (int) Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'errors' => $this->errors, 'categories' => Category::getHomeCategories((int) self::$cookie->id_lang), 'have_image' => Product::getCover((int) Tools::getValue('id_product')), 'tax_enabled' => Configuration::get('PS_TAX'), 'display_qties' => (int) Configuration::get('PS_DISPLAY_QTIES'), 'display_ht' => !Tax::excludeTaxeOption(), 'ecotax' => !sizeof($this->errors) and $this->product->ecotax > 0 ? Tools::convertPrice((double) $this->product->ecotax) : 0, 'currencySign' => $currency->sign, 'currencyRate' => $currency->conversion_rate, 'currencyFormat' => $currency->format, 'currencyBlank' => $currency->blank, 'jqZoomEnabled' => Configuration::get('PS_DISPLAY_JQZOOM')));
     if ((int) Tools::getValue('pp') == 1) {
         $time9 = time();
         echo 'time9: ' . $time9;
     }
     //add this to product stats
     //Tools::captureActivity(PSTAT_VIEWS,$id_product);
     if ((int) Tools::getValue('pp') == 1) {
         $time1 = time();
         echo 'process end: ' . $time1;
     }
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:101,代码来源:ProductController_20aug_bkp.php

示例7: foreach

                            }
                        }
                    }
                }
                foreach ($groups as &$group) {
                    natcasesort($group['attributes']);
                }
                foreach ($combinations as $id_product_attribute => $comb) {
                    $attributeList = '';
                    foreach ($comb['attributes'] as $id_attribute) {
                        $attributeList .= '\'' . intval($id_attribute) . '\',';
                    }
                    $attributeList = rtrim($attributeList, ',');
                    $combinations[$id_product_attribute]['list'] = $attributeList;
                }
                $smarty->assign(array('groups' => $groups, 'combinaisons' => $combinations, 'combinations' => $combinations, 'colors' => (sizeof($colors) and $product->id_color_default) ? $colors : false, 'combinationImages' => $combinationImages));
            }
        }
        $smarty->assign(array('no_tax' => Tax::excludeTaxeOption() or !Tax::getApplicableTax(intval($product->id_tax), 1), 'customizationFields' => $product->getCustomizationFields(intval($cookie->id_lang))));
        // Pack management
        $smarty->assign('packItems', Pack::getItemTable($product->id, intval($cookie->id_lang), true));
        $smarty->assign('packs', Pack::getPacksTable($product->id, intval($cookie->id_lang), true, 1));
    }
}
$smarty->assign(array('ENT_NOQUOTES' => ENT_NOQUOTES, 'outOfStockAllowed' => intval(Configuration::get('PS_ORDER_OUT_OF_STOCK')), 'errors' => $errors, 'categories' => Category::getHomeCategories(intval($cookie->id_lang)), 'have_image' => Product::getCover(intval(Tools::getValue('id_product'))), 'tax_enabled' => Configuration::get('PS_TAX'), 'display_qties' => intval(Configuration::get('PS_DISPLAY_QTIES')), 'display_ht' => !Tax::excludeTaxeOption()));
if (file_exists(_PS_THEME_DIR_ . 'thickbox.tpl')) {
    $smarty->display(_PS_THEME_DIR_ . 'thickbox.tpl');
}
$smarty->assign(array('currencySign' => $currency->sign, 'currencyRate' => $currency->conversion_rate, 'currencyFormat' => $currency->format, 'currencyBlank' => $currency->blank));
$smarty->display(_PS_THEME_DIR_ . 'product.tpl');
include dirname(__FILE__) . '/footer.php';
开发者ID:vincent,项目名称:theinvertebrates,代码行数:31,代码来源:product.php

示例8: process


//.........这里部分代码省略.........
             $ecotaxTaxAmount = Tools::ps_round($this->product->ecotax, 2);
             if (Product::$_taxCalculationMethod == PS_TAX_INC && (int) Configuration::get('PS_TAX')) {
                 $ecotaxTaxAmount = Tools::ps_round($ecotaxTaxAmount * (1 + $ecotax_rate / 100), 2);
             }
             self::$smarty->assign(array('quantity_discounts' => $this->formatQuantityDiscounts(SpecificPrice::getQuantityDiscounts((int) $this->product->id, (int) Shop::getCurrentShop(), (int) self::$cookie->id_currency, $id_country, $id_group), $this->product->getPrice(Product::$_taxCalculationMethod == PS_TAX_INC, false), (double) $tax), 'product' => $this->product, 'ecotax_tax_inc' => $ecotaxTaxAmount, 'ecotax_tax_exc' => Tools::ps_round($this->product->ecotax, 2), 'ecotaxTax_rate' => $ecotax_rate, 'homeSize' => Image::getSize('home'), 'product_manufacturer' => new Manufacturer((int) $this->product->id_manufacturer, self::$cookie->id_lang), 'token' => Tools::getToken(false), 'productPriceWithoutEcoTax' => (double) $productPriceWithoutEcoTax, 'features' => $features, 'attachments' => $attachments, 'allow_oosp' => $this->product->isAvailableWhenOutOfStock((int) $this->product->out_of_stock), 'last_qties' => (int) Configuration::get('PS_LAST_QTIES'), 'group_reduction' => $group_reduction, 'col_img_dir' => _PS_COL_IMG_DIR_));
             self::$smarty->assign(array('HOOK_EXTRA_LEFT' => Module::hookExec('extraLeft'), 'HOOK_EXTRA_RIGHT' => Module::hookExec('extraRight'), 'HOOK_PRODUCT_OOS' => Hook::productOutOfStock($this->product), 'HOOK_PRODUCT_FOOTER' => Hook::productFooter($this->product, $category), 'HOOK_PRODUCT_ACTIONS' => Module::hookExec('productActions'), 'HOOK_PRODUCT_TAB' => Module::hookExec('productTab'), 'HOOK_PRODUCT_TAB_CONTENT' => Module::hookExec('productTabContent')));
             $images = $this->product->getImages((int) self::$cookie->id_lang);
             $productImages = array();
             foreach ($images as $k => $image) {
                 if ($image['cover']) {
                     self::$smarty->assign('mainImage', $images[0]);
                     $cover = $image;
                     $cover['id_image'] = Configuration::get('PS_LEGACY_IMAGES') ? $this->product->id . '-' . $image['id_image'] : $image['id_image'];
                     $cover['id_image_only'] = (int) $image['id_image'];
                 }
                 $productImages[(int) $image['id_image']] = $image;
             }
             if (!isset($cover)) {
                 $cover = array('id_image' => Language::getIsoById(self::$cookie->id_lang) . '-default', 'legend' => 'No picture', 'title' => 'No picture');
             }
             $size = Image::getSize('large');
             self::$smarty->assign(array('cover' => $cover, 'imgWidth' => (int) $size['width'], 'mediumSize' => Image::getSize('medium'), 'largeSize' => Image::getSize('large'), 'accessories' => $this->product->getAccessories((int) self::$cookie->id_lang)));
             if (count($productImages)) {
                 self::$smarty->assign('images', $productImages);
             }
             /* Attributes / Groups & colors */
             $colors = array();
             $attributesGroups = $this->product->getAttributesGroups((int) self::$cookie->id_lang);
             // @todo (RM) should only get groups and not all declination ?
             if (is_array($attributesGroups) and $attributesGroups) {
                 $groups = array();
                 $combinationImages = $this->product->getCombinationImages((int) self::$cookie->id_lang);
                 foreach ($attributesGroups as $k => $row) {
                     /* Color management */
                     if ((isset($row['attribute_color']) and $row['attribute_color'] or file_exists(_PS_COL_IMG_DIR_ . $row['id_attribute'] . '.jpg')) and $row['id_attribute_group'] == $this->product->id_color_default) {
                         $colors[$row['id_attribute']]['value'] = $row['attribute_color'];
                         $colors[$row['id_attribute']]['name'] = $row['attribute_name'];
                         if (!isset($colors[$row['id_attribute']]['attributes_quantity'])) {
                             $colors[$row['id_attribute']]['attributes_quantity'] = 0;
                         }
                         $colors[$row['id_attribute']]['attributes_quantity'] += (int) $row['quantity'];
                     }
                     if (!isset($groups[$row['id_attribute_group']])) {
                         $groups[$row['id_attribute_group']] = array('name' => $row['public_group_name'], 'is_color_group' => $row['is_color_group'], 'default' => -1);
                     }
                     $groups[$row['id_attribute_group']]['attributes'][$row['id_attribute']] = $row['attribute_name'];
                     if ($row['default_on'] && $groups[$row['id_attribute_group']]['default'] == -1) {
                         $groups[$row['id_attribute_group']]['default'] = (int) $row['id_attribute'];
                     }
                     if (!isset($groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']])) {
                         $groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']] = 0;
                     }
                     $groups[$row['id_attribute_group']]['attributes_quantity'][$row['id_attribute']] += (int) $row['quantity'];
                     $combinations[$row['id_product_attribute']]['attributes_values'][$row['id_attribute_group']] = $row['attribute_name'];
                     $combinations[$row['id_product_attribute']]['attributes'][] = (int) $row['id_attribute'];
                     $combinations[$row['id_product_attribute']]['price'] = (double) $row['price'];
                     $combinations[$row['id_product_attribute']]['ecotax'] = (double) $row['ecotax'];
                     $combinations[$row['id_product_attribute']]['weight'] = (double) $row['weight'];
                     $combinations[$row['id_product_attribute']]['quantity'] = (int) $row['quantity'];
                     $combinations[$row['id_product_attribute']]['reference'] = $row['reference'];
                     $combinations[$row['id_product_attribute']]['unit_impact'] = $row['unit_price_impact'];
                     $combinations[$row['id_product_attribute']]['minimal_quantity'] = $row['minimal_quantity'];
                     $combinations[$row['id_product_attribute']]['id_image'] = isset($combinationImages[$row['id_product_attribute']][0]['id_image']) ? $combinationImages[$row['id_product_attribute']][0]['id_image'] : -1;
                 }
                 //wash attributes list (if some attributes are unavailables and if allowed to wash it)
                 if (!Product::isAvailableWhenOutOfStock($this->product->out_of_stock) && Configuration::get('PS_DISP_UNAVAILABLE_ATTR') == 0) {
                     foreach ($groups as &$group) {
                         foreach ($group['attributes_quantity'] as $key => &$quantity) {
                             if (!$quantity) {
                                 unset($group['attributes'][$key]);
                             }
                         }
                     }
                     foreach ($colors as $key => $color) {
                         if (!$color['attributes_quantity']) {
                             unset($colors[$key]);
                         }
                     }
                 }
                 foreach ($groups as &$group) {
                     natcasesort($group['attributes']);
                 }
                 foreach ($combinations as $id_product_attribute => $comb) {
                     $attributeList = '';
                     foreach ($comb['attributes'] as $id_attribute) {
                         $attributeList .= '\'' . (int) $id_attribute . '\',';
                     }
                     $attributeList = rtrim($attributeList, ',');
                     $combinations[$id_product_attribute]['list'] = $attributeList;
                 }
                 self::$smarty->assign(array('groups' => $groups, 'combinaisons' => $combinations, 'combinations' => $combinations, 'colors' => (sizeof($colors) and $this->product->id_color_default) ? $colors : false, 'combinationImages' => $combinationImages));
             }
             self::$smarty->assign(array('no_tax' => Tax::excludeTaxeOption() or !Tax::getProductTaxRate((int) $this->product->id, $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}), 'customizationFields' => $this->product->customizable ? $this->product->getCustomizationFields((int) self::$cookie->id_lang) : false));
             // Pack management
             self::$smarty->assign('packItems', $this->product->cache_is_pack ? Pack::getItemTable($this->product->id, (int) self::$cookie->id_lang, true) : array());
             self::$smarty->assign('packs', Pack::getPacksTable($this->product->id, (int) self::$cookie->id_lang, true, 1));
         }
     }
     self::$smarty->assign(array('ENT_NOQUOTES' => ENT_NOQUOTES, 'outOfStockAllowed' => (int) Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'errors' => $this->errors, 'categories' => Category::getHomeCategories((int) self::$cookie->id_lang), 'have_image' => isset($cover) ? (int) $cover['id_image'] : false, 'tax_enabled' => Configuration::get('PS_TAX'), 'display_qties' => (int) Configuration::get('PS_DISPLAY_QTIES'), 'display_ht' => !Tax::excludeTaxeOption(), 'ecotax' => !sizeof($this->errors) and $this->product->ecotax > 0 ? Tools::convertPrice((double) $this->product->ecotax) : 0, 'currencySign' => $currency->sign, 'currencyRate' => $currency->conversion_rate, 'currencyFormat' => $currency->format, 'currencyBlank' => $currency->blank, 'jqZoomEnabled' => Configuration::get('PS_DISPLAY_JQZOOM')));
 }
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:101,代码来源:ProductController.php

示例9: assignCategory

 /**
  * Assign template vars related to category.
  */
 protected function assignCategory()
 {
     // Assign category to the template
     if (($this->category === false || !Validate::isLoadedObject($this->category) || !$this->category->inShop() || !$this->category->isAssociatedToShop()) && Category::inShopStatic($this->product->id_category_default, $this->context->shop)) {
         $this->category = new Category((int) $this->product->id_category_default, (int) $this->context->language->id);
     }
     $sub_categories = array();
     if (Validate::isLoadedObject($this->category)) {
         $sub_categories = $this->category->getSubCategories($this->context->language->id, true);
         // various assignements before Hook::exec
         $this->context->smarty->assign(array('category' => $this->category, 'subCategories' => $sub_categories, 'id_category_current' => (int) $this->category->id, 'id_category_parent' => (int) $this->category->id_parent, 'return_category_name' => Tools::safeOutput($this->category->getFieldByLang('name')), 'categories' => Category::getHomeCategories($this->context->language->id, true, (int) $this->context->shop->id)));
     }
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:16,代码来源:ProductController.php

示例10: hookLeftColumn

    public function hookLeftColumn($params)
    {
        global $smarty, $cookie;
        $id_customer = (int) $params['cookie']->id_customer;
        // Get all groups for this customer and concatenate them as a string: "1,2,3..."
        // It is necessary to keep the group query separate from the main select query because it is used for the cache
        $groups = $id_customer ? implode(', ', Customer::getGroupsStatic($id_customer)) : _PS_DEFAULT_CUSTOMER_GROUP_;
        $id_product = (int) Tools::getValue('id_product', 0);
        $id_category = (int) Tools::getValue('id_category', 0);
        $id_lang = (int) $params['cookie']->id_lang;
        $smartyCacheId = 'blockcategories|' . $groups . '_' . $id_lang . '_' . $id_product . '_' . $id_category;
        Tools::enableCache();
        if (!$this->isCached('blockcategories.tpl', $smartyCacheId)) {
            $maxdepth = Configuration::get('BLOCK_CATEG_MAX_DEPTH');
            if (!($result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
				SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
				FROM `' . _DB_PREFIX_ . 'category` c
				LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = ' . $id_lang . ')
				LEFT JOIN `' . _DB_PREFIX_ . 'category_group` cg ON (cg.`id_category` = c.`id_category`)
				WHERE (c.`active` = 1 OR c.`id_category` = 1)
				' . ((int) $maxdepth != 0 ? ' AND `level_depth` <= ' . (int) $maxdepth : '') . '
				AND cg.`id_group` IN (' . pSQL($groups) . ')
				GROUP BY id_category
				ORDER BY `level_depth` ASC, c.`position` ASC'))) {
                return;
            }
            $resultParents = array();
            $resultIds = array();
            foreach ($result as &$row) {
                $resultParents[$row['id_parent']][] =& $row;
                $resultIds[$row['id_category']] =& $row;
            }
            $blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEG_MAX_DEPTH'));
            $categories = Category::getHomeCategories((int) $params['cookie']->id_lang, true);
            foreach ($categories as $cate) {
                $category = new Category($cate[id_category], Configuration::get('PS_LANG_DEFAULT'));
                $products[$cate[id_category]] = $category->getProducts((int) $params['cookie']->id_lang, 1, 4, null, null, false, true);
            }
            $smarty->assign(array('products' => $products, 'categories' => $categories));
            unset($resultParents);
            unset($resultIds);
            $isDhtml = Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false;
            if (Tools::isSubmit('id_category')) {
                $cookie->last_visited_category = $id_category;
                $smarty->assign('currentCategoryId', $cookie->last_visited_category);
            }
            if (Tools::isSubmit('id_product')) {
                if (!isset($cookie->last_visited_category) or !Product::idIsOnCategoryId($id_product, array('0' => array('id_category' => $cookie->last_visited_category)))) {
                    $product = new Product($id_product);
                    if (isset($product) and Validate::isLoadedObject($product)) {
                        $cookie->last_visited_category = (int) $product->id_category_default;
                    }
                }
                $smarty->assign('currentCategoryId', (int) $cookie->last_visited_category);
            }
            $smarty->assign('blockCategTree', $blockCategTree);
            if (file_exists(_PS_THEME_DIR_ . 'modules/blockcategories/blockcategories.tpl')) {
                $smarty->assign('branche_tpl_path', _PS_THEME_DIR_ . 'modules/blockcategories/category-tree-branch.tpl');
            } else {
                $smarty->assign('branche_tpl_path', _PS_MODULE_DIR_ . 'blockcategories/category-tree-branch.tpl');
            }
            $smarty->assign('isDhtml', $isDhtml);
        }
        $smarty->cache_lifetime = 31536000;
        // 1 Year
        $display = $this->display(__FILE__, 'blockcategories.tpl', $smartyCacheId);
        Tools::restoreCacheSettings();
        return $display;
    }
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:69,代码来源:blockcategories.php

示例11: getContent

    public function getContent()
    {
        global $cookie;
        $output = '<h2>' . $this->displayName . '</h2>';
        if (Tools::isSubmit('submit_save')) {
            $res = 1;
            foreach ($this->conf as $c => $v) {
                $res &= Configuration::updateValue($c, intval(Tools::getValue($c)));
            }
            $output .= $res ? $this->displayConfirmation($this->l('Settings updated')) : $this->displayError($this->l('Some setting not updated'));
        }
        $cols = Configuration::getMultiple(array_keys($this->conf));
        $categories = Category::getHomeCategories($cookie->id_lang, false);
        $root_cat = Category::getRootCategory($cookie->id_lang);
        $output .= '		
			<fieldset style="width: 800px;">
				<legend><img src="' . _PS_ADMIN_IMG_ . 'cog.gif" alt="" title="" />' . $this->l('Settings') . '</legend>
				<form action="' . $_SERVER['REQUEST_URI'] . '" method="post">
					<label>' . $this->l('Number of product displayed') . '</label>
					<div class="margin-form">
						<input type="text" size="5" name="HOME_FEATURED_NBR" value="' . ($cols['HOME_FEATURED_NBR'] ? $cols['HOME_FEATURED_NBR'] : '10') . '" />
						<p class="clear">' . $this->l('The number of products displayed on homepage (default: 10).') . '</p>					
					</div>
					<label>' . $this->l('Category of products to display') . '</label>
					<div class="margin-form">
						<select name="HOME_FEATURED_CATALOG">
							<option value="' . $root_cat->id . '" ' . ($cols['HOME_FEATURED_CATALOG'] == $root_cat->id ? 'selected=1' : '') . '>' . $root_cat->name . '</option>';
        foreach ($categories as $c) {
            $output .= '<option value="' . $c['id_category'] . '" ' . ($cols['HOME_FEATURED_CATALOG'] == $c['id_category'] ? 'selected=1' : '') . '>' . $c['name'] . '</option>';
        }
        $output .= '
						</select>
						<p class="clear">' . $this->l('Choose category of products, which will show on the homepage (default : Home category).') . '</p>						
					</div>				
					<label>' . $this->l('Show products randomly') . '</label>
					<div class="margin-form">
						<input type="checkbox" name="HOME_FEATURED_RANDOM" value="1" ' . ($cols['HOME_FEATURED_RANDOM'] ? 'checked="checked"' : '') . ' />
						<p class="clear">' . $this->l('Check it, if you want to show products randomly.') . '</p>
					</div>								
					<label>' . $this->l('Show title of a product') . '</label>
					<div class="margin-form">
						<input type="checkbox" name="HOME_FEATURED_TITLE" value="1" ' . ($cols['HOME_FEATURED_TITLE'] ? 'checked="checked"' : '') . ' />
						<p class="clear">' . $this->l('Check it, if you want to show a product title.') . '</p>
					</div>	
					<label>' . $this->l('Show description of a product') . '</label>
					<div class="margin-form">
						<input type="checkbox" name="HOME_FEATURED_DESCR" value="1" ' . ($cols['HOME_FEATURED_DESCR'] ? 'checked="checked"' : '') . ' />
						<p class="clear">' . $this->l('Check it, if you want to show a product description.') . '</p>
					</div>	
					<label>' . $this->l('Show a "View" button') . '</label>
					<div class="margin-form">
						<input type="checkbox" name="HOME_FEATURED_VIEW" value="1" ' . ($cols['HOME_FEATURED_VIEW'] ? 'checked="checked"' : '') . ' />
						<p class="clear">' . $this->l('Check it, if you want to show a "View" button.') . '</p>
					</div>		
					<label>' . $this->l('Show a "Add to cart" button') . '</label>
					<div class="margin-form">
						<input type="checkbox" name="HOME_FEATURED_CART" value="1" ' . ($cols['HOME_FEATURED_CART'] ? 'checked="checked"' : '') . ' />
						<p class="clear">' . $this->l('Check it, if you want to show a "Add to cart" button. If prestashop catalog mode is enable than the button will not display.') . '</p>
					</div>
					<label>' . $this->l('Show product price') . '</label>
					<div class="margin-form">
						<input type="checkbox" name="HOME_FEATURED_PRICE" value="1" ' . ($cols['HOME_FEATURED_PRICE'] ? 'checked="checked"' : '') . ' />
						<p class="clear">' . $this->l('Check it, if you want to show product price.') . '</p>
					</div>
					<label>' . $this->l('Number of columns to display') . '</label>
					<div class="margin-form">
						<input type="text" size="1" name="HOME_FEATURED_COLS" value="' . ($cols['HOME_FEATURED_COLS'] ? $cols['HOME_FEATURED_COLS'] : '4') . '" />
						<p class="clear">' . $this->l('The number of columns displayed on homepage (default: 4).') . '</p>					
					</div>
					<label>' . $this->l('Block module height adjust') . '</label>
					<div class="margin-form">
						<input type="text" size="3" name="HOME_FEATURED_HEIGHT_ADJUST" value="' . ($cols['HOME_FEATURED_HEIGHT_ADJUST'] ? $cols['HOME_FEATURED_HEIGHT_ADJUST'] : '0') . '" /> px.						
						<p class="clear">' . $this->l('You should input number of pixels to adjust height of the block.') . '</p>
					</div>						
					<label>' . $this->l('Block module width adjust') . '</label>
					<div class="margin-form">
						<input type="text" size="3" name="HOME_FEATURED_WIDTH_ADJUST" value="' . ($cols['HOME_FEATURED_WIDTH_ADJUST'] ? $cols['HOME_FEATURED_WIDTH_ADJUST'] : '0') . '" /> px.						
						<p class="clear">' . $this->l('You should input number of pixels to adjust width of the block.') . '</p>
					</div>					
					<center><input type="submit" name="submit_save" value="' . $this->l('Save') . '" class="button" /></center>
				</form>
			</fieldset>
			<br class="clear" />
		';
        return $output;
    }
开发者ID:zapalm,项目名称:homefeaturez,代码行数:86,代码来源:homefeaturez.php

示例12: initContent

 public function initContent()
 {
     global $id_lang;
     $cats = Category::getHomeCategories($id_lang);
     parent::initContent();
 }
开发者ID:ecSta,项目名称:prestanight,代码行数:6,代码来源:IndexController.php

示例13: initContent

 public function initContent()
 {
     $cats = Category::getHomeCategories($id_lang);
     var_dump($cats);
     parent::initContent();
 }
开发者ID:ecSta,项目名称:prestanight,代码行数:6,代码来源:FrontController.php


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