Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Magento-显示shoppingcart图像,而不是“购物车”;“我的车”;在Toplinks中?_Php_Css_Magento - Fatal编程技术网

Php Magento-显示shoppingcart图像,而不是“购物车”;“我的车”;在Toplinks中?

Php Magento-显示shoppingcart图像,而不是“购物车”;“我的车”;在Toplinks中?,php,css,magento,Php,Css,Magento,我正在尝试显示shoppingcart图像,而不是“我的购物车”短语。上面的shoppingcart图像仅显示购物车中要显示的项目数 要更改文本,必须编辑mage/checkout/block/links.php,其中包含以下部分: public function addCartLink() { $parentBlock = $this->getParentBlock(); if ($parentBlock && Mage::helper('core')-&

我正在尝试显示shoppingcart图像,而不是“我的购物车”短语。上面的shoppingcart图像仅显示购物车中要显示的项目数

要更改文本,必须编辑mage/checkout/block/links.php,其中包含以下部分:

public function addCartLink()
{
    $parentBlock = $this->getParentBlock();
    if ($parentBlock && Mage::helper('core')->isModuleOutputEnabled('Mage_Checkout')) {
        $count = $this->getSummaryQty() ? $this->getSummaryQty()
            : $this->helper('checkout/cart')->getSummaryCount();
        if ($count == 1) {
            $text = $this->__('My Cart (%s item)', $count);
        } elseif ($count > 0) {
            $text = $this->__('My Cart (%s items)', $count);
        } else {
            $text = $this->__('My Cart (0 items)');
        }

公共函数addCartLink()
{
$parentBlock=$this->getParentBlock();
if($parentBlock&&Mage::helper('core')->ismoduleoutputened('Mage_Checkout')){
$count=$this->getSummaryQty()?$this->getSummaryQty()
:$this->helper('checkout/cart')->getSummaryCount();
如果($count==1){
$text=$this->\uuuuuu('%s',$count);
}elseif($count>0){
$text=$this->\uuuuuu('%s',$count);
}否则{
$text=$this->_uu('0');
}
所以,现在商品编号显示在购物车图像的内部/上方。正如我所希望的。问题是:通过浏览链接,它现在显示商品编号前后的span标记


你知道如何更改链接标题吗?或者有没有更好的方法在toplinks中显示shoppingcart图像?

在你在Magento源代码中引用的块下方,我看到这一行:

$parentBlock->addLink($text, 'checkout/cart', $text, true, array(), 50, null, 'class="top-link-cart"');

尝试为$text指定的两个值提供不同的值-我打赌其中一个是链接的HTML,另一个是工具提示文本。(您可能应该使用
$this->\uuu()
对于新文本,为了保持一致性-虽然不太可能有任何效果,因为它允许Magento将该文本翻译成另一种语言。)然后,您可以在HTML版本中使用跨距,而不在工具提示中使用跨距。

您可以不使用跨距标记,并调整CSS使其不需要跨距标记吗?(也许你应该发布你的CSS。)另外,第二块代码是你实际使用的吗?因为它不是有效的PHP(错放的引号).你是对的,我现在没有span标签,它工作了。在CSS中,我使用display:block而不是display:inline,这在以前给我带来了一些麻烦。通过在购物车上胡闹,它现在显示了商品编号,这不是完美的,但还行。
$parentBlock->addLink($text, 'checkout/cart', $text, true, array(), 50, null, 'class="top-link-cart"');