how to add custom header link and showing items count in magento?how to add custom action in manage products...

Why did Democrats in the Senate oppose the Born-Alive Abortion Survivors Protection Act (2019 S.130)?

How to play electric guitar and bass as a duet

What's a good word to describe a public place that looks like it wouldn't be rough?

A curious equality of integrals involving the prime counting function?

Is there any risk in sharing info about technologies and products we use with a supplier?

How much mayhem could I cause as a sentient fish?

Does every functor from Set to Set preserve products?

A starship is travelling at 0.9c and collides with a small rock. Will it leave a clean hole through, or will more happen?

When can a QA tester start his job?

Words and Words with "ver-" Prefix

Does dispel magic end a master's control over their undead?

A Missing Symbol for This Logo

Is it a fallacy if someone claims they need an explanation for every word of your argument to the point where they don't understand common terms?

Why is it that Bernie Sanders is always called a "socialist"?

How do you catch Smeargle in Pokemon Go?

When do I have to declare that I want to twin my spell?

Dilemma of explaining to interviewer that he is the reason for declining second interview

Why avoid shared user accounts?

Why are the books in the Game of Thrones citadel library shelved spine inwards?

What is the purpose of easy combat scenarios that don't need resource expenditure?

Why exactly do action photographers need high fps burst cameras?

What is the data structure of $@ in shell?

Potential client has a problematic employee I can't work with

Line of Bones to Travel and Conform to Curve (Like Train on a Track, Snake...)



how to add custom header link and showing items count in magento?


how to add custom action in manage products and perform that action? in magentoNot showing my custom api in wsdl(url) and web service list?Magento custom module adds HTML to headerClass 'Mage_Checkout_CartController' not foundadd custom data with quote item magentodifference between cart getItemsCount() and getSummaryCount()How to add dynamic link to top-links?how to add link url in magento 1.8How do i get total cart count in magento?Magento : Categories Page Products Count Showing Wrong in Admin













0















How to add custom header link and showing items count like My wishlist, cart etc.










share|improve this question





























    0















    How to add custom header link and showing items count like My wishlist, cart etc.










    share|improve this question



























      0












      0








      0








      How to add custom header link and showing items count like My wishlist, cart etc.










      share|improve this question
















      How to add custom header link and showing items count like My wishlist, cart etc.







      magento-1.8 php-5.4






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 40 mins ago









      Teja Bhagavan Kollepara

      2,96341847




      2,96341847










      asked Feb 11 '14 at 7:04









      Manoj KumarManoj Kumar

      76052351




      76052351






















          1 Answer
          1






          active

          oldest

          votes


















          1














          You can try to replicate the way that the wishlist link is added.

          So you need to create a module that contains a block. Let's name the module Namespace_Module and the block Links.

          Add this in the layout file of your module,



          <default>
          <reference name="top.links">
          <block type="module/links" name="module_link" />
          <action method="addLinkBlock"><blockName>module_link</blockName></action>
          </reference>
          </default>


          Now your block class can look like this:



          class Namespace_Module_Block_Links extends Mage_Page_Block_Template_Links_Block
          {
          /**
          * Position in link list
          * @var int
          */
          protected $_position = 120;

          /**
          * @return string
          */
          protected function _toHtml()
          {
          $text = $this->_createLabel($this->_getItemCount());
          $this->_label = $text;
          $this->_title = $text;
          $this->_url = $this->getUrl('wishlist');
          return parent::_toHtml();
          }
          protected function _getItemCount()
          {
          //this method should contain the logic to return the number you need
          return 5;
          }
          //this generated the label
          protected function _createLabel($count)
          {
          if ($count > 1) {
          return $this->__('My Label (%d items)', $count);
          } else if ($count == 1) {
          return $this->__('My Label (%d item)', $count);
          } else {
          return $this->__('My Label');
          }
          }
          }





          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "479"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f14815%2fhow-to-add-custom-header-link-and-showing-items-count-in-magento%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            You can try to replicate the way that the wishlist link is added.

            So you need to create a module that contains a block. Let's name the module Namespace_Module and the block Links.

            Add this in the layout file of your module,



            <default>
            <reference name="top.links">
            <block type="module/links" name="module_link" />
            <action method="addLinkBlock"><blockName>module_link</blockName></action>
            </reference>
            </default>


            Now your block class can look like this:



            class Namespace_Module_Block_Links extends Mage_Page_Block_Template_Links_Block
            {
            /**
            * Position in link list
            * @var int
            */
            protected $_position = 120;

            /**
            * @return string
            */
            protected function _toHtml()
            {
            $text = $this->_createLabel($this->_getItemCount());
            $this->_label = $text;
            $this->_title = $text;
            $this->_url = $this->getUrl('wishlist');
            return parent::_toHtml();
            }
            protected function _getItemCount()
            {
            //this method should contain the logic to return the number you need
            return 5;
            }
            //this generated the label
            protected function _createLabel($count)
            {
            if ($count > 1) {
            return $this->__('My Label (%d items)', $count);
            } else if ($count == 1) {
            return $this->__('My Label (%d item)', $count);
            } else {
            return $this->__('My Label');
            }
            }
            }





            share|improve this answer




























              1














              You can try to replicate the way that the wishlist link is added.

              So you need to create a module that contains a block. Let's name the module Namespace_Module and the block Links.

              Add this in the layout file of your module,



              <default>
              <reference name="top.links">
              <block type="module/links" name="module_link" />
              <action method="addLinkBlock"><blockName>module_link</blockName></action>
              </reference>
              </default>


              Now your block class can look like this:



              class Namespace_Module_Block_Links extends Mage_Page_Block_Template_Links_Block
              {
              /**
              * Position in link list
              * @var int
              */
              protected $_position = 120;

              /**
              * @return string
              */
              protected function _toHtml()
              {
              $text = $this->_createLabel($this->_getItemCount());
              $this->_label = $text;
              $this->_title = $text;
              $this->_url = $this->getUrl('wishlist');
              return parent::_toHtml();
              }
              protected function _getItemCount()
              {
              //this method should contain the logic to return the number you need
              return 5;
              }
              //this generated the label
              protected function _createLabel($count)
              {
              if ($count > 1) {
              return $this->__('My Label (%d items)', $count);
              } else if ($count == 1) {
              return $this->__('My Label (%d item)', $count);
              } else {
              return $this->__('My Label');
              }
              }
              }





              share|improve this answer


























                1












                1








                1







                You can try to replicate the way that the wishlist link is added.

                So you need to create a module that contains a block. Let's name the module Namespace_Module and the block Links.

                Add this in the layout file of your module,



                <default>
                <reference name="top.links">
                <block type="module/links" name="module_link" />
                <action method="addLinkBlock"><blockName>module_link</blockName></action>
                </reference>
                </default>


                Now your block class can look like this:



                class Namespace_Module_Block_Links extends Mage_Page_Block_Template_Links_Block
                {
                /**
                * Position in link list
                * @var int
                */
                protected $_position = 120;

                /**
                * @return string
                */
                protected function _toHtml()
                {
                $text = $this->_createLabel($this->_getItemCount());
                $this->_label = $text;
                $this->_title = $text;
                $this->_url = $this->getUrl('wishlist');
                return parent::_toHtml();
                }
                protected function _getItemCount()
                {
                //this method should contain the logic to return the number you need
                return 5;
                }
                //this generated the label
                protected function _createLabel($count)
                {
                if ($count > 1) {
                return $this->__('My Label (%d items)', $count);
                } else if ($count == 1) {
                return $this->__('My Label (%d item)', $count);
                } else {
                return $this->__('My Label');
                }
                }
                }





                share|improve this answer













                You can try to replicate the way that the wishlist link is added.

                So you need to create a module that contains a block. Let's name the module Namespace_Module and the block Links.

                Add this in the layout file of your module,



                <default>
                <reference name="top.links">
                <block type="module/links" name="module_link" />
                <action method="addLinkBlock"><blockName>module_link</blockName></action>
                </reference>
                </default>


                Now your block class can look like this:



                class Namespace_Module_Block_Links extends Mage_Page_Block_Template_Links_Block
                {
                /**
                * Position in link list
                * @var int
                */
                protected $_position = 120;

                /**
                * @return string
                */
                protected function _toHtml()
                {
                $text = $this->_createLabel($this->_getItemCount());
                $this->_label = $text;
                $this->_title = $text;
                $this->_url = $this->getUrl('wishlist');
                return parent::_toHtml();
                }
                protected function _getItemCount()
                {
                //this method should contain the logic to return the number you need
                return 5;
                }
                //this generated the label
                protected function _createLabel($count)
                {
                if ($count > 1) {
                return $this->__('My Label (%d items)', $count);
                } else if ($count == 1) {
                return $this->__('My Label (%d item)', $count);
                } else {
                return $this->__('My Label');
                }
                }
                }






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 11 '14 at 7:24









                MariusMarius

                166k28317677




                166k28317677






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f14815%2fhow-to-add-custom-header-link-and-showing-items-count-in-magento%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    迭戈·戈丁...

                    A phrase ”follow into" in a context The 2019 Stack Overflow Developer Survey Results Are...

                    1960s short story making fun of James Bond-style spy fiction The 2019 Stack Overflow Developer...