dsfs23434
2014-07-07 15:42
浏览 40
已采纳

opencart在标题菜单中添加自定义菜单

This is a tricky problem that I am having.

I have a client / friend that wants on their open cart menu a button for home, which I was able to solve. However he wants a drop down menu for advice which holds 5 items. These 5 items are Faq's, Contact us, Delivery Details, Privacy policy and Returns policy.

Straight forward enough however the pages are information pages.

What I'd like to do is to link to these pages.

The ID of the advise is 80

            foreach ($children as $child) {
                if ($child['category_id'] == 80) {
                    $children_data[] = array(
                        'name' => $this->data['text_advicefaq'] = $this->language->get('text_advicefaq'),
                        'href' => $this->url->link('information/information', 'information_id=13')
                    );
                }

                $data = array(
                    'filter_category_id'  => $child['category_id'],
                    'filter_sub_category' => true
                );

                $product_total = $this->model_catalog_product->getTotalProducts($data);

                $children_data[] = array(
                    'name'  => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $product_total . ')' : ''),
                    'href'  => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
                );      
            }

图片转代码服务由CSDN问答提供 功能建议

这是我遇到的棘手问题。

我有一个 客户/朋友想要在他们的开放式购物车菜单上找到一个家用按钮,我能够解决这个问题。 然而,他想要一个下拉菜单,提供包含5个项目的建议。 这5个项目是常见问题联系我们交付详情隐私政策退货政策

直接向前,但页面是信息页面。

我想做的是 链接到这些页面。

建议的ID是 80

  foreach($ children as $ child){
 if($ child ['category_id'] == 80){
 $ children_data [] = array(
'name'=> $ this-  > data ['text_advicefaq'] = $ this-> language-> get('text_advicefaq'),
'href'=> $ this-> url-> link('information / information',  'information_id = 13')
); 
} 
 
 $ data = array(
'filter_category_id'=> $ child ['category_id'],
'filter_sub_category'=> true 
)  ; 
 
 $ prod  uct_total = $ this-> model_catalog_product-> getTotalProducts($ data); 
 
 $ children_data [] = array(
'name'=>  $ child ['name']。  ($ this-> config-> get('config_product_count')?'('。product_total。')':''),
'href'=>  $ this-> url-> link('product / category','path ='。$ category ['category_id']。'_'。$ child ['category_id'])
);  
} 
   
 
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doumi0737 2014-07-07 16:36
    已采纳

    Try something like

    Step 1

    Open file catalog/view/theme/<your theme>/template/common/header.tpl.

    Find menu code.

    Add before </ul> tag:

          <li><a><?php echo $text_information; ?></a>
            <div>
              <ul>
                <?php foreach ($informations as $information) { ?>
                <li><a href="<?php echo $information['href']; ?>"><?php echo $information['title']; ?></a></li>
                <?php } ?>
              <li><a href="<?php echo $contact; ?>"><?php echo $text_contact; ?></a></li>
              </ul>
            </div>
          </li>
    


    Step 2

    Open file catalog/controller/common/header.php.

    Find:

    $this->data['text_checkout'] = $this->language->get('text_checkout');
    

    Add After:

    $this->data['text_information'] = $this->language->get('text_information');
    $this->data['text_contact'] = $this->language->get('text_contact');
    


    Step 3

    In the same file catalog/controller/common/header.php

    Find:

        $this->data['checkout'] = $this->url->link('checkout/checkout', '', 'SSL');
    

    Add After:

        $this->load->model('catalog/information');
        $this->data['informations'] = array();
        foreach ($this->model_catalog_information->getInformations() as $result) {
            if ($result['bottom']) {
                $this->data['informations'][] = array(
                    'title' => $result['title'],
                    'href'  => $this->url->link('information/information', 'information_id=' . $result['information_id'])
                );
            }
        }
        $this->data['contact'] = $this->url->link('information/contact');
    

    & then check it.

    点赞 打赏 评论

相关推荐 更多相似问题