奇怪的替换magento URL

时间:2014-02-01 04:06:54

标签: magento

出于某种原因,仅在产品列表上的视图模式图标上显示“?”将网址替换为“#21”。例:"#%21mode=list"

有人可以帮助我吗?

一些代码:

app / design / frontend / default / themename / template / catalog / product / list / toolbar.phtml

<?php if( $this->isEnabledViewSwitcher() ): ?>
<p class="view-mode">
    <?php $_modes = $this->getModes(); ?>
    <?php if($_modes && count($_modes)>1): ?>
    <label><?php echo $this->__('View as') ?>:</label>
    <?php foreach ($this->getModes() as $_code=>$_label): ?>
        <?php if($this->isModeActive($_code)): ?>
            <strong title="<?php echo $_label ?>" class="<?php echo strtolower($_code); ?>"><?php echo $_label ?></strong>&nbsp;
        <?php else: ?>
            <a href="<?php echo $this->getModeUrl($_code) ?>" title="<?php echo $_label ?>" class="<?php echo strtolower($_code); ?>"><?php echo $_label ?></a>&nbsp;
        <?php endif; ?>
    <?php endforeach; ?>
    <?php endif; ?>
</p>
<?php endif; ?>

应用程序/代码//芯/法师/目录/砌块/产品/列表/ Toolbar.php

public function getModeUrl($mode)
{
    return $this->getPagerUrl( array($this->getModeVarName()=>$mode, $this->getPageVarName() => null) );
}

和...

public function getPagerUrl($params=array())
{
    $urlParams = array();
    $urlParams['_current']  = true;
    $urlParams['_escape']   = true; // I already tried set false, but didn't helps
    $urlParams['_use_rewrite']   = true;
    $urlParams['_query']    = $params;
    return $this->getUrl('*/*/*', $urlParams); // I also tried not use the getUrl and concat the querystring, strangely the replace still happends...
}

1 个答案:

答案 0 :(得分:0)

我找不到问题,但我做了一个糟糕的解决方案:

<?php echo str_replace('#%21', '&', $this->getModeUrl($_code)); ?>

我希望有人找到更好的解决方案:)