【问题标题】:For my bread crumbs anchor links are not present in magento 1.9.x对于我的面包屑,magento 1.9.x 中不存在锚链接
【发布时间】:2017-07-20 09:37:08
【问题描述】:

请看breadcrumbs.phtml的代码:

    <?php if($crumbs && is_array($crumbs)): ?>
    <!-- SLIDER START HERE-->
    <div class="container">
      <div class="innerSlider relative">
        <div class="innerSlidercontent">
          <h2>“People with thyroid problems avoid eating millet on a daily basis 
      as it is believed to contain some”</h2>
        </div>
        <div class="insideSlidePic"> <img src="<?php echo $this-
       >  getSkinUrl('images/barnyard_millet_bisi_belle_bhaat_recipe.jpg'); ?>"  
      alt=""> </div>
      </div>
      <div class="clear"></div>
      <ul class="routeMenu">
        <?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
            <li class="<?php echo $_crumbName ?>">
            <?php if($_crumbInfo['link']): 

               if($_crumbInfo['title']=="Home"){
                $_crumbInfo['link']=Mage::getUrl();
            }


            ?>
                <a class="sc_hover" href="<?php echo $_crumbInfo['link'] ?>" 
    title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><?php echo 
   $this->escapeHtml($_crumbInfo['label']) ?></a>
            <?php elseif($_crumbInfo['last']): ?>
                <span><?php echo $this->escapeHtml($_crumbInfo['label']) ?>
      </span>
            <?php else: ?>
                <?php echo $this->escapeHtml($_crumbInfo['label']) ?>
            <?php endif; ?>
            <?php if(!$_crumbInfo['last']): ?>

            <?php endif; ?>
            </li>
        <?php endforeach; ?>
      </ul>
      </div>
      <div class="clear"></div>

      <!-- SLIDER END HERE-->
       <?php endif; ?>

帮助我弄清楚为什么我的面包屑中没有锚链接,但文本来了。在这里,我看到的代码与其他代码有些不同,面包屑是正确的代码。

【问题讨论】:

  • 在类标签中存在一些问题,因为面包屑链接没有启用任何解决方案

标签: php magento coding-style magento-1.9


【解决方案1】:

请检查默认的 magento 主题。我认为面包屑会起作用。如果面包屑正在使用您的默认主题,则通过重命名布局和主题文件来检查您当前的自定义主题。

【讨论】:

    【解决方案2】:

    //要么替换下面的代码,要么用基本文件替换文件。

     <?php if($crumbs && is_array($crumbs)): ?>
        <!-- SLIDER START HERE-->
        <div class="container">
          <div class="innerSlider relative">
    
            <div class="innerSlidercontent">
              <h2>“People with thyroid problems avoid eating millet on a daily basis 
          as it is believed to contain some”</h2>
            </div>
            <div class="insideSlidePic"> <img src="<?php echo $this->getSkinUrl('images/barnyard_millet_bisi_belle_bhaat_recipe.jpg'); ?>"  
          alt=""> </div>
          </div>
    
          <div class="clear"></div>
    
          <ul class="routeMenu">
            <?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
                <li class="<?php echo $_crumbName ?>">
                <?php if($_crumbInfo['link']): 
    
                   if($_crumbInfo['title']=="Home"){
                    $_crumbInfo['link']=Mage::getUrl();
                }
                ?>
                    <a class="sc_hover" href="<?php echo $_crumbInfo['link'] ?>" 
        title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><?php echo 
       $this->escapeHtml($_crumbInfo['label']) ?></a>
                <?php elseif($_crumbInfo['last']): ?>
                    <span><?php echo $this->escapeHtml($_crumbInfo['label']) ?>
          </span>
                <?php else: ?>
                    <?php echo $this->escapeHtml($_crumbInfo['label']) ?>
                <?php endif; ?>
                <?php if(!$_crumbInfo['last']): ?>
    
                <?php endif; ?>
                </li>
            <?php endforeach; ?>
          </ul>
          </div>
          <div class="clear"></div>
          </div>
    
          <!-- SLIDER END HERE-->
           <?php endif; ?>
    

    将基本文件复制到您的自定义设计路径的替代解决方案如下。

    app/design/frontend/base/default/template/page/html/breadcrumbs.phtml
    
    copy from base to your custom design path.
    
    app/design/frontend/your-package/your-theme/template/page/html/breadcrumbs.phtml
    

    【讨论】:

    • 感谢您的帮助,但它不起作用链接未启用
    • 因为您的代码包含不必要的 div 标签,所以我删除并编辑了我上面的答案。请检查并验证它现在对我有用。
    • 它可以在没有 div 标签的情况下工作,谢谢,但是有了这个描述,它也必须出现,我无法删除该描述,您的任何建议将不胜感激
    • 根据您的上述评论,我再次编辑了我上面的答案,请从我的答案中复制您的代码并检查。
    • 在类标签中存在一些问题,因为面包屑链接没有启用任何解决方案,非常感谢完整
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多