Need help with Wishlist
The wishlist section in the sidebar disappears when all the items in it are removed.. but i want to shot it even when the开发者_开发问答re 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?
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;
}
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();
}
精彩评论