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


PHP producthelper::getParentCategory方法代码示例

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


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

示例1: display

 /**
  * Execute and display a template script.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  mixed  A string if successful, otherwise a JError object.
  *
  * @see     fetch()
  * @since   11.1
  */
 public function display($tpl = null)
 {
     global $context;
     $this->app = JFactory::getApplication();
     $this->input = $this->app->input;
     $objhelper = new redhelper();
     $prodhelperobj = new producthelper();
     // Request variables
     $this->option = $this->input->getString('option', 'com_redshop');
     $this->itemid = $this->input->getInt('Itemid', null);
     $this->catid = $this->input->getInt('cid', 0);
     $layout = $this->input->getString('layout', '');
     $this->print = $this->input->getBool('print', false);
     $params = $this->app->getParams($this->option);
     $model = $this->getModel('category');
     JPluginHelper::importPlugin('redshop_product');
     JPluginHelper::importPlugin('redshop_product_type');
     $this->dispatcher = JDispatcher::getInstance();
     $category_template = (int) $params->get('category_template');
     $menu_meta_keywords = $params->get('menu-meta_keywords');
     $menu_robots = $params->get('robots');
     $menu_meta_description = $params->get('menu-meta_description');
     if (!$this->catid && $layout == 'detail') {
         $this->catid = $params->get('cid');
         $this->setLayout('detail');
     }
     if (empty($layout) && $this->catid > 0) {
         $this->setLayout('detail');
     }
     $document = JFactory::getDocument();
     JHtml::Script('jquery.js', 'components/com_redshop/assets/js/', false);
     JHtml::Script('redBOX.js', 'components/com_redshop/assets/js/', false);
     JHtml::Script('attribute.js', 'components/com_redshop/assets/js/', false);
     JHtml::Script('common.js', 'components/com_redshop/assets/js/', false);
     JHtml::Stylesheet('priceslider.css', 'components/com_redshop/assets/css/');
     // Add jQueryUI because of IE9 issue
     $document->addStyleSheet('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css');
     $lists = array();
     $minmax = array(0, 0);
     $product = array();
     $maincat = $model->_loadCategory();
     $allCategoryTemplate = $model->getCategoryTemplate();
     $order_data = $objhelper->getOrderByList();
     $manufacturers = $model->getManufacturer();
     $loadCategorytemplate = $model->loadCategoryTemplate();
     $detail = $model->getdata();
     if (count($maincat) > 0 && $maincat->canonical_url != "") {
         $main_url = JURI::root() . $maincat->canonical_url;
         $canonical = '<link rel="canonical" href="' . $main_url . '" />';
         $document->addCustomTag($canonical);
     }
     $pageheadingtag = '';
     if ($this->catid) {
         // Restrict category if category not published
         if ($maincat->published == 0) {
             JError::raiseError(404, sprintf(JText::_('COM_REDSHOP_CATEGORY_IS_NOT_PUBLISHED'), $maincat->category_name, $maincat->category_id));
         }
         $isSlider = false;
         if (count($loadCategorytemplate) > 0 && strstr($loadCategorytemplate[0]->template_desc, "{product_price_slider}")) {
             $limit_product = $model->getCategoryProduct(1);
             $minmax[0] = $limit_product[0]->minprice;
             $minmax[1] = $limit_product[0]->maxprice;
             $isSlider = true;
             $texpricemin = $this->input->getInt('texpricemin', $minmax[0]);
             $texpricemax = $this->input->getInt('texpricemax', $minmax[1]);
             $model->setMaxMinProductPrice(array($texpricemin, $texpricemax));
         }
         $product = $model->getCategoryProduct(0, $isSlider);
         $document->setMetaData('keywords', $maincat->metakey);
         $document->setMetaData('description', $maincat->metadesc);
         $document->setMetaData('robots', $maincat->metarobot_info);
         // For page title
         $pagetitletag = SEO_PAGE_TITLE_CATEGORY;
         $parentcat = "";
         $parentid = $prodhelperobj->getParentCategory($maincat->category_id);
         while ($parentid != 0) {
             $parentdetail = $prodhelperobj->getSection("category", $parentid);
             $parentcat = $parentdetail->category_name . "  " . $parentcat;
             $parentid = $prodhelperobj->getParentCategory($parentdetail->category_id);
         }
         $pagetitletag = str_replace("{parentcategoryloop}", $parentcat, $pagetitletag);
         $pagetitletag = str_replace("{categoryname}", $maincat->category_name, $pagetitletag);
         $pagetitletag = str_replace("{shopname}", SHOP_NAME, $pagetitletag);
         $pagetitletag = str_replace("{categoryshortdesc}", strip_tags($maincat->category_short_description), $pagetitletag);
         if ($maincat->pagetitle != "" && AUTOGENERATED_SEO && SEO_PAGE_TITLE_CATEGORY != '') {
             if ($maincat->append_to_global_seo == 'append') {
                 $pagetitletag = $pagetitletag . $maincat->pagetitle;
                 $document->setTitle($pagetitletag);
             } elseif ($maincat->append_to_global_seo == 'prepend') {
                 $pagetitletag = $maincat->pagetitle . $pagetitletag;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例2: count

     $template_desc = str_replace("{pagination}", "", $template_desc);
 } else {
     $print_url = $url . "index.php?option=com_redshop&view=category&layout=detail&cid=" . $this->catid;
     $print_url .= "&print=1&tmpl=component&Itemid=" . $this->itemid;
     $print_url .= "&limit=" . $endlimit . "&texpricemin=" . $texpricemin . "&texpricemax=" . $texpricemax . "&order_by=" . $this->order_by_select;
     $print_url .= "&manufacturer_id=" . $this->manufacturer_id . "&category_template=" . $this->category_template_id;
     $onclick = "onclick='window.open(\"{$print_url}\",\"mywindow\",\"scrollbars=1\",\"location=1\")'";
 }
 $print_tag = "<a " . $onclick . " title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "'>";
 $print_tag .= "<img src='" . JSYSTEM_IMAGES_PATH . "printButton.png' alt='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' title='" . JText::_('COM_REDSHOP_PRINT_LBL') . "' />";
 $print_tag .= "</a>";
 $template_desc = str_replace("{print}", $print_tag, $template_desc);
 $template_desc = str_replace("{total_product}", count($this->product), $template_desc);
 $template_desc = str_replace("{total_product_lbl}", JText::_('COM_REDSHOP_TOTAL_PRODUCT'), $template_desc);
 if (strstr($template_desc, '{returntocategory_link}') || strstr($template_desc, '{returntocategory_name}') || strstr($template_desc, '{returntocategory}')) {
     $parentid = $producthelper->getParentCategory($this->catid);
     if ($parentid != 0) {
         $categorylist = $producthelper->getSection("category", $parentid);
         $returncatlink = JRoute::_("index.php?option=" . $this->option . "&view=category&cid=" . $parentid . '&manufacturer_id=' . $this->manufacturer_id . "&Itemid=" . $this->itemid);
         $returntocategory = '<a href="' . $returncatlink . '">' . DAFULT_RETURN_TO_CATEGORY_PREFIX . '&nbsp;' . $categorylist->category_name . '</a>';
     } else {
         $categorylist->category_name = DAFULT_RETURN_TO_CATEGORY_PREFIX;
         $returncatlink = JRoute::_("index.php?option=" . $this->option . "&view=category&manufacturer_id=" . $this->manufacturer_id . "&Itemid=" . $this->itemid);
         $returntocategory = '<a href="' . $returncatlink . '">' . DAFULT_RETURN_TO_CATEGORY_PREFIX . '</a>';
     }
     $template_desc = str_replace("{returntocategory_link}", $returncatlink, $template_desc);
     $template_desc = str_replace('{returntocategory_name}', $categorylist->category_name, $template_desc);
     $template_desc = str_replace("{returntocategory}", $returntocategory, $template_desc);
 }
 if (strstr($template_desc, '{category_main_description}')) {
     $main_cat_desc = $Redconfiguration->maxchar($this->maincat->category_description, CATEGORY_SHORT_DESC_MAX_CHARS, CATEGORY_SHORT_DESC_END_SUFFIX);
开发者ID:,项目名称:,代码行数:31,代码来源:


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