Magento : How To Add an Attribute to Static Block












1















How to add attribute to static block. I am not looking for code, but also where put code.

Assume attribute is named test and static block name sttest.

I have search on this, but always get lost on where to add that code.



Thanks










share|improve this question
















bumped to the homepage by Community 15 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • specify your magento version.

    – Dhiren Vasoya
    Feb 13 '17 at 3:11











  • Also which type of attribute you need to display

    – Vaibhav Ahalpara
    Feb 13 '17 at 3:50











  • Let me explain what I’m trying to accomplish. I’m using Magento ver. 1.9.1.0. I want to add a CMS block tab on my product pages. I know how to create a block, and how to add that block to a product pages. The problem is getting the block to show what I want it to. I want to have the block to show the information of an attribute. I understand the code you just provided should be in the block, but that alone is not the only changes that need to be made …right? What else must be done? Thanks.

    – Michael
    Feb 17 '17 at 1:57
















1















How to add attribute to static block. I am not looking for code, but also where put code.

Assume attribute is named test and static block name sttest.

I have search on this, but always get lost on where to add that code.



Thanks










share|improve this question
















bumped to the homepage by Community 15 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • specify your magento version.

    – Dhiren Vasoya
    Feb 13 '17 at 3:11











  • Also which type of attribute you need to display

    – Vaibhav Ahalpara
    Feb 13 '17 at 3:50











  • Let me explain what I’m trying to accomplish. I’m using Magento ver. 1.9.1.0. I want to add a CMS block tab on my product pages. I know how to create a block, and how to add that block to a product pages. The problem is getting the block to show what I want it to. I want to have the block to show the information of an attribute. I understand the code you just provided should be in the block, but that alone is not the only changes that need to be made …right? What else must be done? Thanks.

    – Michael
    Feb 17 '17 at 1:57














1












1








1








How to add attribute to static block. I am not looking for code, but also where put code.

Assume attribute is named test and static block name sttest.

I have search on this, but always get lost on where to add that code.



Thanks










share|improve this question
















How to add attribute to static block. I am not looking for code, but also where put code.

Assume attribute is named test and static block name sttest.

I have search on this, but always get lost on where to add that code.



Thanks







attributes custom-attributes cms-block






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 13 '17 at 4:39









Dhiren Vasoya

4,26551742




4,26551742










asked Feb 13 '17 at 2:16









MichaelMichael

61




61





bumped to the homepage by Community 15 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 15 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • specify your magento version.

    – Dhiren Vasoya
    Feb 13 '17 at 3:11











  • Also which type of attribute you need to display

    – Vaibhav Ahalpara
    Feb 13 '17 at 3:50











  • Let me explain what I’m trying to accomplish. I’m using Magento ver. 1.9.1.0. I want to add a CMS block tab on my product pages. I know how to create a block, and how to add that block to a product pages. The problem is getting the block to show what I want it to. I want to have the block to show the information of an attribute. I understand the code you just provided should be in the block, but that alone is not the only changes that need to be made …right? What else must be done? Thanks.

    – Michael
    Feb 17 '17 at 1:57



















  • specify your magento version.

    – Dhiren Vasoya
    Feb 13 '17 at 3:11











  • Also which type of attribute you need to display

    – Vaibhav Ahalpara
    Feb 13 '17 at 3:50











  • Let me explain what I’m trying to accomplish. I’m using Magento ver. 1.9.1.0. I want to add a CMS block tab on my product pages. I know how to create a block, and how to add that block to a product pages. The problem is getting the block to show what I want it to. I want to have the block to show the information of an attribute. I understand the code you just provided should be in the block, but that alone is not the only changes that need to be made …right? What else must be done? Thanks.

    – Michael
    Feb 17 '17 at 1:57

















specify your magento version.

– Dhiren Vasoya
Feb 13 '17 at 3:11





specify your magento version.

– Dhiren Vasoya
Feb 13 '17 at 3:11













Also which type of attribute you need to display

– Vaibhav Ahalpara
Feb 13 '17 at 3:50





Also which type of attribute you need to display

– Vaibhav Ahalpara
Feb 13 '17 at 3:50













Let me explain what I’m trying to accomplish. I’m using Magento ver. 1.9.1.0. I want to add a CMS block tab on my product pages. I know how to create a block, and how to add that block to a product pages. The problem is getting the block to show what I want it to. I want to have the block to show the information of an attribute. I understand the code you just provided should be in the block, but that alone is not the only changes that need to be made …right? What else must be done? Thanks.

– Michael
Feb 17 '17 at 1:57





Let me explain what I’m trying to accomplish. I’m using Magento ver. 1.9.1.0. I want to add a CMS block tab on my product pages. I know how to create a block, and how to add that block to a product pages. The problem is getting the block to show what I want it to. I want to have the block to show the information of an attribute. I understand the code you just provided should be in the block, but that alone is not the only changes that need to be made …right? What else must be done? Thanks.

– Michael
Feb 17 '17 at 1:57










2 Answers
2






active

oldest

votes


















0














Simply replace every instance of $this->getProduct() with Mage::registry('current_product') inside description.phtml.



Alternative (somewhat cleaner): Make this your first line in description.phtml: <?php $this->setProduct(Mage::registry('current_product')) ?>






share|improve this answer































    0














    You can create a block in any of your module and in its corresponding template file you may add/print the attribute test and then call that block in your static pages/block sttest.



    {{block class="VendorModuleBlockMyBlock" name="testblock" template="attributetest.phtml"}}


    You may call the block as mentioned above in your static block in admin area. All you need to do is place this line of code in the content of your static block.



    I hope this helps you. Let me know if you have any doubts.






    share|improve this answer


























    • Let me explain what I’m trying to accomplish. I’m using Magento ver. 1.9.1.0. I want to add a CMS block tab on my product pages. I know how to create a block, and how to add that block to a product pages. The problem is getting the block to show what I want it to. I want to have the block to show the information of an attribute. I understand the code you just provided should be in the block, but that alone is not the only changes that need to be made …right? What else must be done? Thanks.

      – Michael
      Feb 17 '17 at 1:56











    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%2f159477%2fmagento-how-to-add-an-attribute-to-static-block%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Simply replace every instance of $this->getProduct() with Mage::registry('current_product') inside description.phtml.



    Alternative (somewhat cleaner): Make this your first line in description.phtml: <?php $this->setProduct(Mage::registry('current_product')) ?>






    share|improve this answer




























      0














      Simply replace every instance of $this->getProduct() with Mage::registry('current_product') inside description.phtml.



      Alternative (somewhat cleaner): Make this your first line in description.phtml: <?php $this->setProduct(Mage::registry('current_product')) ?>






      share|improve this answer


























        0












        0








        0







        Simply replace every instance of $this->getProduct() with Mage::registry('current_product') inside description.phtml.



        Alternative (somewhat cleaner): Make this your first line in description.phtml: <?php $this->setProduct(Mage::registry('current_product')) ?>






        share|improve this answer













        Simply replace every instance of $this->getProduct() with Mage::registry('current_product') inside description.phtml.



        Alternative (somewhat cleaner): Make this your first line in description.phtml: <?php $this->setProduct(Mage::registry('current_product')) ?>







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 13 '17 at 5:10









        Hansraj SystematixHansraj Systematix

        662




        662

























            0














            You can create a block in any of your module and in its corresponding template file you may add/print the attribute test and then call that block in your static pages/block sttest.



            {{block class="VendorModuleBlockMyBlock" name="testblock" template="attributetest.phtml"}}


            You may call the block as mentioned above in your static block in admin area. All you need to do is place this line of code in the content of your static block.



            I hope this helps you. Let me know if you have any doubts.






            share|improve this answer


























            • Let me explain what I’m trying to accomplish. I’m using Magento ver. 1.9.1.0. I want to add a CMS block tab on my product pages. I know how to create a block, and how to add that block to a product pages. The problem is getting the block to show what I want it to. I want to have the block to show the information of an attribute. I understand the code you just provided should be in the block, but that alone is not the only changes that need to be made …right? What else must be done? Thanks.

              – Michael
              Feb 17 '17 at 1:56
















            0














            You can create a block in any of your module and in its corresponding template file you may add/print the attribute test and then call that block in your static pages/block sttest.



            {{block class="VendorModuleBlockMyBlock" name="testblock" template="attributetest.phtml"}}


            You may call the block as mentioned above in your static block in admin area. All you need to do is place this line of code in the content of your static block.



            I hope this helps you. Let me know if you have any doubts.






            share|improve this answer


























            • Let me explain what I’m trying to accomplish. I’m using Magento ver. 1.9.1.0. I want to add a CMS block tab on my product pages. I know how to create a block, and how to add that block to a product pages. The problem is getting the block to show what I want it to. I want to have the block to show the information of an attribute. I understand the code you just provided should be in the block, but that alone is not the only changes that need to be made …right? What else must be done? Thanks.

              – Michael
              Feb 17 '17 at 1:56














            0












            0








            0







            You can create a block in any of your module and in its corresponding template file you may add/print the attribute test and then call that block in your static pages/block sttest.



            {{block class="VendorModuleBlockMyBlock" name="testblock" template="attributetest.phtml"}}


            You may call the block as mentioned above in your static block in admin area. All you need to do is place this line of code in the content of your static block.



            I hope this helps you. Let me know if you have any doubts.






            share|improve this answer















            You can create a block in any of your module and in its corresponding template file you may add/print the attribute test and then call that block in your static pages/block sttest.



            {{block class="VendorModuleBlockMyBlock" name="testblock" template="attributetest.phtml"}}


            You may call the block as mentioned above in your static block in admin area. All you need to do is place this line of code in the content of your static block.



            I hope this helps you. Let me know if you have any doubts.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Feb 13 '17 at 5:20

























            answered Feb 13 '17 at 5:07









            Sanjay ChaudharySanjay Chaudhary

            331216




            331216













            • Let me explain what I’m trying to accomplish. I’m using Magento ver. 1.9.1.0. I want to add a CMS block tab on my product pages. I know how to create a block, and how to add that block to a product pages. The problem is getting the block to show what I want it to. I want to have the block to show the information of an attribute. I understand the code you just provided should be in the block, but that alone is not the only changes that need to be made …right? What else must be done? Thanks.

              – Michael
              Feb 17 '17 at 1:56



















            • Let me explain what I’m trying to accomplish. I’m using Magento ver. 1.9.1.0. I want to add a CMS block tab on my product pages. I know how to create a block, and how to add that block to a product pages. The problem is getting the block to show what I want it to. I want to have the block to show the information of an attribute. I understand the code you just provided should be in the block, but that alone is not the only changes that need to be made …right? What else must be done? Thanks.

              – Michael
              Feb 17 '17 at 1:56

















            Let me explain what I’m trying to accomplish. I’m using Magento ver. 1.9.1.0. I want to add a CMS block tab on my product pages. I know how to create a block, and how to add that block to a product pages. The problem is getting the block to show what I want it to. I want to have the block to show the information of an attribute. I understand the code you just provided should be in the block, but that alone is not the only changes that need to be made …right? What else must be done? Thanks.

            – Michael
            Feb 17 '17 at 1:56





            Let me explain what I’m trying to accomplish. I’m using Magento ver. 1.9.1.0. I want to add a CMS block tab on my product pages. I know how to create a block, and how to add that block to a product pages. The problem is getting the block to show what I want it to. I want to have the block to show the information of an attribute. I understand the code you just provided should be in the block, but that alone is not the only changes that need to be made …right? What else must be done? Thanks.

            – Michael
            Feb 17 '17 at 1:56


















            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%2f159477%2fmagento-how-to-add-an-attribute-to-static-block%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

            Polycentropodidae

            Magento 2 Error message: Invalid state change requested

            Paulmy