需要有关愿望清单的帮助

发布于 2024-10-28 20:20:24 字数 156 浏览 1 评论 0原文

当其中的所有项目都被删除时,侧边栏中的愿望清单部分就会消失..但即使愿望清单中没有带有文本“将一些项目添加到您的愿望清单”的项目,我也想拍摄它..就像“比较部分” ..我该怎么做?

我尝试编辑 .phtml 文件来执行此操作,但它不起作用..我需要为此编辑任何 xml 布局文件吗?

The wishlist section in the sidebar disappears when all the items in it are removed.. but i want to shot it even when there is no items in wishlist with a text "Add some items to your wishlist".. as like "Compare section".. how do i do it?

i tried editing the .phtml file for doing it, but its not working.. do i need to edit any xml layout file for this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

划一舟意中人 2024-11-04 20:20:24

仅供参考,请勿评价。

愿望清单类在 1.4.2 后已更改:

* @deprecated after 1.4.2.0
     * @see Mage_Wishlist_Block_Links::__construct
     *
     * @return array
     */
    public function addWishlistLink()
    {
        return $this;
    } 

这是您请求的功能(查看计数):

/**
     * Add link on wishlist page in parent block
     *
     * @return Mage_Wishlist_Block_Links
     */
    public function addWishlistLink()
    {
        $parentBlock = $this->getParentBlock();
        if ($parentBlock && $this->helper('wishlist')->isAllow()) {
            $count = $this->helper('wishlist')->getItemCount();
            if ($count > 1) {
                $text = $this->__('My Wishlist (%d items)', $count);
            }
            else if ($count == 1) {
                $text = $this->__('My Wishlist (%d item)', $count);
            }
            else {
                $text = $this->__('My Wishlist');
            }
            $parentBlock->addLink($text, 'wishlist', $text, true, array(), 30, null, 'class="top-link-wishlist"');
        }
        return $this;
    }

For just info, please don't reputate.

The wishlist class has been changed after 1.4.2 :

* @deprecated after 1.4.2.0
     * @see Mage_Wishlist_Block_Links::__construct
     *
     * @return array
     */
    public function addWishlistLink()
    {
        return $this;
    } 

and here is the your requested feature ( look at count ) :

/**
     * Add link on wishlist page in parent block
     *
     * @return Mage_Wishlist_Block_Links
     */
    public function addWishlistLink()
    {
        $parentBlock = $this->getParentBlock();
        if ($parentBlock && $this->helper('wishlist')->isAllow()) {
            $count = $this->helper('wishlist')->getItemCount();
            if ($count > 1) {
                $text = $this->__('My Wishlist (%d items)', $count);
            }
            else if ($count == 1) {
                $text = $this->__('My Wishlist (%d item)', $count);
            }
            else {
                $text = $this->__('My Wishlist');
            }
            $parentBlock->addLink($text, 'wishlist', $text, true, array(), 30, null, 'class="top-link-wishlist"');
        }
        return $this;
    }
念﹏祤嫣 2024-11-04 20:20:24

Magento 1.6.1.0

/app/code/core/Mage/Wishlist/Block/Customer/Sidebar.php

包含函数 _toHtml()

protected function _toHtml()
{
    if (($this->getCustomWishlist() && $this->getItemCount()) || $this->hasWishlistItems()) {
        return parent::_toHtml();
    }

    return '';
}

复制:

/app/code/core/Mage/Wishlist/Block/Customer/Sidebar.php

到:

/app/code/local/Mage/Wishlist/Block/Customer/Sidebar.php

在复制的文件中,将函数 _toHtml() 的内容替换为 returnparent::_toHtml();:

protected function _toHtml()
{
        return parent::_toHtml();
}

Magento 1.6.1.0

/app/code/core/Mage/Wishlist/Block/Customer/Sidebar.php

contains the function _toHtml():

protected function _toHtml()
{
    if (($this->getCustomWishlist() && $this->getItemCount()) || $this->hasWishlistItems()) {
        return parent::_toHtml();
    }

    return '';
}

Copy:

/app/code/core/Mage/Wishlist/Block/Customer/Sidebar.php

to:

/app/code/local/Mage/Wishlist/Block/Customer/Sidebar.php

In the copied file, replace the contents of function _toHtml() with return parent::_toHtml();:

protected function _toHtml()
{
        return parent::_toHtml();
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文