Dynamic Content based on items in BasketCreate link in cart sidebar to view all added items After limit reachedAdd a tab on product page based on attribute setAdding Tabs and static block content on product pageFill basket with itemsCross-sell product is not showing in the product detail pageDynamically updating the sku on the product page of a configurable product based on selected optionsMagento 1.9 - Product not being added to basket for logged out usersMagento 1.x custom block with dynamic contentMagento 2: How to show the number of cart items in a custom blockDynamically change template based on user type

Which colors are these? (minted package)

Gold Battle KoTH

Is it unprofessional to mention your cover letter and resume are best viewed in Chrome?

How to prevent a single-element caster from being useless against immune foes?

Numerically Stable IIR filter

How does Asimov's second law deal with contradictory orders from different people?

Why would an invisible personal shield be necessary?

What force enables us to walk? Friction or normal reaction?

How do I make my photos have more impact?

What is a Mono Word™?

Using Python in a Bash Script

In the Schrödinger equation, can I have a Hamiltonian without a kinetic term?

Should 2FA be enabled on service accounts?

Avoiding Implicit Conversion in Constructor. Explicit keyword doesn't help here

Adding a (stair/baby) gate without facing walls

Academic progression in Germany, what happens after a postdoc? What is the next step?

"Fewer errors means better products" or fewer errors mean better products."

Planting Trees in Outer Space

How can a class have multiple methods without breaking the single responsibility principle

Best Ergonomic Design for a handheld ranged weapon

How do I respond appropriately to an overseas company that obtained a visa for me without hiring me?

When did J.K. Rowling decide to make Ron and Hermione a couple?

Move arrows along a contour

Should students have access to past exams or an exam bank?



Dynamic Content based on items in Basket


Create link in cart sidebar to view all added items After limit reachedAdd a tab on product page based on attribute setAdding Tabs and static block content on product pageFill basket with itemsCross-sell product is not showing in the product detail pageDynamically updating the sku on the product page of a configurable product based on selected optionsMagento 1.9 - Product not being added to basket for logged out usersMagento 1.x custom block with dynamic contentMagento 2: How to show the number of cart items in a custom blockDynamically change template based on user type






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















Is there a way to dynamically display content on a page, based on whether there is something in your basket.



i.e Page would display certain block of text IF there is something in the customers basket AND would not display if there is nothing in the customers basket.










share|improve this question






























    0















    Is there a way to dynamically display content on a page, based on whether there is something in your basket.



    i.e Page would display certain block of text IF there is something in the customers basket AND would not display if there is nothing in the customers basket.










    share|improve this question


























      0












      0








      0








      Is there a way to dynamically display content on a page, based on whether there is something in your basket.



      i.e Page would display certain block of text IF there is something in the customers basket AND would not display if there is nothing in the customers basket.










      share|improve this question














      Is there a way to dynamically display content on a page, based on whether there is something in your basket.



      i.e Page would display certain block of text IF there is something in the customers basket AND would not display if there is nothing in the customers basket.







      product cart dynamic






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jul 22 at 12:03









      RoddersRodders

      314 bronze badges




      314 bronze badges























          1 Answer
          1






          active

          oldest

          votes


















          2














          If you're comfortable with widgets, you can create a widget for this. In your widget block file, you can inject an instance of MagentoCheckoutHelperCart so you can use the helper functions around the cart state.



          You can then override the ::_toHtml() method like so:



          protected function _toHtml() 
          if (0 === $this->_checkoutCartHelper->getItemsCount()) return ''; //Return nothing if no items
          return parent::_toHtml(); //Return normal content otherwise



          You can then have whatever content you need in your widget. The bonus of widgets is that they can be edited in the backend of Magento, both in terms of positioning & content.






          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%2f282849%2fdynamic-content-based-on-items-in-basket%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









            2














            If you're comfortable with widgets, you can create a widget for this. In your widget block file, you can inject an instance of MagentoCheckoutHelperCart so you can use the helper functions around the cart state.



            You can then override the ::_toHtml() method like so:



            protected function _toHtml() 
            if (0 === $this->_checkoutCartHelper->getItemsCount()) return ''; //Return nothing if no items
            return parent::_toHtml(); //Return normal content otherwise



            You can then have whatever content you need in your widget. The bonus of widgets is that they can be edited in the backend of Magento, both in terms of positioning & content.






            share|improve this answer





























              2














              If you're comfortable with widgets, you can create a widget for this. In your widget block file, you can inject an instance of MagentoCheckoutHelperCart so you can use the helper functions around the cart state.



              You can then override the ::_toHtml() method like so:



              protected function _toHtml() 
              if (0 === $this->_checkoutCartHelper->getItemsCount()) return ''; //Return nothing if no items
              return parent::_toHtml(); //Return normal content otherwise



              You can then have whatever content you need in your widget. The bonus of widgets is that they can be edited in the backend of Magento, both in terms of positioning & content.






              share|improve this answer



























                2












                2








                2







                If you're comfortable with widgets, you can create a widget for this. In your widget block file, you can inject an instance of MagentoCheckoutHelperCart so you can use the helper functions around the cart state.



                You can then override the ::_toHtml() method like so:



                protected function _toHtml() 
                if (0 === $this->_checkoutCartHelper->getItemsCount()) return ''; //Return nothing if no items
                return parent::_toHtml(); //Return normal content otherwise



                You can then have whatever content you need in your widget. The bonus of widgets is that they can be edited in the backend of Magento, both in terms of positioning & content.






                share|improve this answer













                If you're comfortable with widgets, you can create a widget for this. In your widget block file, you can inject an instance of MagentoCheckoutHelperCart so you can use the helper functions around the cart state.



                You can then override the ::_toHtml() method like so:



                protected function _toHtml() 
                if (0 === $this->_checkoutCartHelper->getItemsCount()) return ''; //Return nothing if no items
                return parent::_toHtml(); //Return normal content otherwise



                You can then have whatever content you need in your widget. The bonus of widgets is that they can be edited in the backend of Magento, both in terms of positioning & content.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jul 22 at 15:20









                Adam MellenAdam Mellen

                815 bronze badges




                815 bronze badges






























                    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%2f282849%2fdynamic-content-based-on-items-in-basket%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