Display a custom attribute below product name in the front-end Magento 1.9.3.8












0















I need to display a custom attribute bellow the product name and I don't know how can I call this attribute.



I am editing the file /app/design/frontend/templatemela/MAG100219_1/template/catalog/product/view.phtml
But how can I call this attribute in php? I tried calling a string echo with the name I put in the attribute, but it didn't work.



Code is as below:



<div class="page-title product-title"> 
<h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
</div>

<div class="codigoinmetro">
<h2><?php echo $_helper->productAttribute($_product, $_product->getName(), 'registroinmetro') ?></h2>
</div>









share|improve this question

























  • Which type of attribute you have text or dropdown?

    – Utsav Gupta
    Jan 2 at 13:28
















0















I need to display a custom attribute bellow the product name and I don't know how can I call this attribute.



I am editing the file /app/design/frontend/templatemela/MAG100219_1/template/catalog/product/view.phtml
But how can I call this attribute in php? I tried calling a string echo with the name I put in the attribute, but it didn't work.



Code is as below:



<div class="page-title product-title"> 
<h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
</div>

<div class="codigoinmetro">
<h2><?php echo $_helper->productAttribute($_product, $_product->getName(), 'registroinmetro') ?></h2>
</div>









share|improve this question

























  • Which type of attribute you have text or dropdown?

    – Utsav Gupta
    Jan 2 at 13:28














0












0








0








I need to display a custom attribute bellow the product name and I don't know how can I call this attribute.



I am editing the file /app/design/frontend/templatemela/MAG100219_1/template/catalog/product/view.phtml
But how can I call this attribute in php? I tried calling a string echo with the name I put in the attribute, but it didn't work.



Code is as below:



<div class="page-title product-title"> 
<h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
</div>

<div class="codigoinmetro">
<h2><?php echo $_helper->productAttribute($_product, $_product->getName(), 'registroinmetro') ?></h2>
</div>









share|improve this question
















I need to display a custom attribute bellow the product name and I don't know how can I call this attribute.



I am editing the file /app/design/frontend/templatemela/MAG100219_1/template/catalog/product/view.phtml
But how can I call this attribute in php? I tried calling a string echo with the name I put in the attribute, but it didn't work.



Code is as below:



<div class="page-title product-title"> 
<h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
</div>

<div class="codigoinmetro">
<h2><?php echo $_helper->productAttribute($_product, $_product->getName(), 'registroinmetro') ?></h2>
</div>






php attributes magento-1 product-view






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 19 '18 at 10:08









Chirag Rajput

1,254321




1,254321










asked Apr 17 '18 at 10:16









Emanuell VieiraEmanuell Vieira

12




12













  • Which type of attribute you have text or dropdown?

    – Utsav Gupta
    Jan 2 at 13:28



















  • Which type of attribute you have text or dropdown?

    – Utsav Gupta
    Jan 2 at 13:28

















Which type of attribute you have text or dropdown?

– Utsav Gupta
Jan 2 at 13:28





Which type of attribute you have text or dropdown?

– Utsav Gupta
Jan 2 at 13:28










3 Answers
3






active

oldest

votes


















0














Check below code i'm using this code. this code working fine. replace your attribute name with (Brand)



<?php
$brandname = $_product->getAttributeText('brand');
if (trim($brandname)) {
echo "" .$this->htmlEscape($brandname);
}
?>





share|improve this answer































    0














    Try the code below:



     <div class="page-title product-title"> 
    <h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
    </div>

    <div class="codigoinmetro">
    <h2><?php echo $_helper->productAttribute($_product, $_product->getRegistroinmetro(), 'registroinmetro') ?></h2>
    </div>





    share|improve this answer


























    • what this $_helper point to ?

      – Sourav
      Apr 17 '18 at 10:21











    • Its points to product module (Magento core Module For Product) helper. If you open that helper file you will see "productAttribute" function.

      – Chirag Rajput
      Apr 17 '18 at 10:23











    • @Sourav , $_helper in my code is the correction of the question's code.

      – Chirag Rajput
      Apr 17 '18 at 10:31











    • @EmanuellVieira , had your problem solved yet?

      – Chirag Rajput
      Apr 19 '18 at 9:27



















    0














    If you have select type attribute then you can use below code to get attribute value:


    $attributeName = $product->getAttributeText('attributename');

    If you have input type attribute then you can use below:

    $attributeName = $product->getAttributeName ();






    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%2f222631%2fdisplay-a-custom-attribute-below-product-name-in-the-front-end-magento-1-9-3-8%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      Check below code i'm using this code. this code working fine. replace your attribute name with (Brand)



      <?php
      $brandname = $_product->getAttributeText('brand');
      if (trim($brandname)) {
      echo "" .$this->htmlEscape($brandname);
      }
      ?>





      share|improve this answer




























        0














        Check below code i'm using this code. this code working fine. replace your attribute name with (Brand)



        <?php
        $brandname = $_product->getAttributeText('brand');
        if (trim($brandname)) {
        echo "" .$this->htmlEscape($brandname);
        }
        ?>





        share|improve this answer


























          0












          0








          0







          Check below code i'm using this code. this code working fine. replace your attribute name with (Brand)



          <?php
          $brandname = $_product->getAttributeText('brand');
          if (trim($brandname)) {
          echo "" .$this->htmlEscape($brandname);
          }
          ?>





          share|improve this answer













          Check below code i'm using this code. this code working fine. replace your attribute name with (Brand)



          <?php
          $brandname = $_product->getAttributeText('brand');
          if (trim($brandname)) {
          echo "" .$this->htmlEscape($brandname);
          }
          ?>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 17 '18 at 10:33









          Wajahat BashirWajahat Bashir

          10012




          10012

























              0














              Try the code below:



               <div class="page-title product-title"> 
              <h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
              </div>

              <div class="codigoinmetro">
              <h2><?php echo $_helper->productAttribute($_product, $_product->getRegistroinmetro(), 'registroinmetro') ?></h2>
              </div>





              share|improve this answer


























              • what this $_helper point to ?

                – Sourav
                Apr 17 '18 at 10:21











              • Its points to product module (Magento core Module For Product) helper. If you open that helper file you will see "productAttribute" function.

                – Chirag Rajput
                Apr 17 '18 at 10:23











              • @Sourav , $_helper in my code is the correction of the question's code.

                – Chirag Rajput
                Apr 17 '18 at 10:31











              • @EmanuellVieira , had your problem solved yet?

                – Chirag Rajput
                Apr 19 '18 at 9:27
















              0














              Try the code below:



               <div class="page-title product-title"> 
              <h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
              </div>

              <div class="codigoinmetro">
              <h2><?php echo $_helper->productAttribute($_product, $_product->getRegistroinmetro(), 'registroinmetro') ?></h2>
              </div>





              share|improve this answer


























              • what this $_helper point to ?

                – Sourav
                Apr 17 '18 at 10:21











              • Its points to product module (Magento core Module For Product) helper. If you open that helper file you will see "productAttribute" function.

                – Chirag Rajput
                Apr 17 '18 at 10:23











              • @Sourav , $_helper in my code is the correction of the question's code.

                – Chirag Rajput
                Apr 17 '18 at 10:31











              • @EmanuellVieira , had your problem solved yet?

                – Chirag Rajput
                Apr 19 '18 at 9:27














              0












              0








              0







              Try the code below:



               <div class="page-title product-title"> 
              <h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
              </div>

              <div class="codigoinmetro">
              <h2><?php echo $_helper->productAttribute($_product, $_product->getRegistroinmetro(), 'registroinmetro') ?></h2>
              </div>





              share|improve this answer















              Try the code below:



               <div class="page-title product-title"> 
              <h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
              </div>

              <div class="codigoinmetro">
              <h2><?php echo $_helper->productAttribute($_product, $_product->getRegistroinmetro(), 'registroinmetro') ?></h2>
              </div>






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Apr 19 '18 at 9:22









              Chester

              1,53022043




              1,53022043










              answered Apr 17 '18 at 10:18









              Chirag RajputChirag Rajput

              1,254321




              1,254321













              • what this $_helper point to ?

                – Sourav
                Apr 17 '18 at 10:21











              • Its points to product module (Magento core Module For Product) helper. If you open that helper file you will see "productAttribute" function.

                – Chirag Rajput
                Apr 17 '18 at 10:23











              • @Sourav , $_helper in my code is the correction of the question's code.

                – Chirag Rajput
                Apr 17 '18 at 10:31











              • @EmanuellVieira , had your problem solved yet?

                – Chirag Rajput
                Apr 19 '18 at 9:27



















              • what this $_helper point to ?

                – Sourav
                Apr 17 '18 at 10:21











              • Its points to product module (Magento core Module For Product) helper. If you open that helper file you will see "productAttribute" function.

                – Chirag Rajput
                Apr 17 '18 at 10:23











              • @Sourav , $_helper in my code is the correction of the question's code.

                – Chirag Rajput
                Apr 17 '18 at 10:31











              • @EmanuellVieira , had your problem solved yet?

                – Chirag Rajput
                Apr 19 '18 at 9:27

















              what this $_helper point to ?

              – Sourav
              Apr 17 '18 at 10:21





              what this $_helper point to ?

              – Sourav
              Apr 17 '18 at 10:21













              Its points to product module (Magento core Module For Product) helper. If you open that helper file you will see "productAttribute" function.

              – Chirag Rajput
              Apr 17 '18 at 10:23





              Its points to product module (Magento core Module For Product) helper. If you open that helper file you will see "productAttribute" function.

              – Chirag Rajput
              Apr 17 '18 at 10:23













              @Sourav , $_helper in my code is the correction of the question's code.

              – Chirag Rajput
              Apr 17 '18 at 10:31





              @Sourav , $_helper in my code is the correction of the question's code.

              – Chirag Rajput
              Apr 17 '18 at 10:31













              @EmanuellVieira , had your problem solved yet?

              – Chirag Rajput
              Apr 19 '18 at 9:27





              @EmanuellVieira , had your problem solved yet?

              – Chirag Rajput
              Apr 19 '18 at 9:27











              0














              If you have select type attribute then you can use below code to get attribute value:


              $attributeName = $product->getAttributeText('attributename');

              If you have input type attribute then you can use below:

              $attributeName = $product->getAttributeName ();






              share|improve this answer






























                0














                If you have select type attribute then you can use below code to get attribute value:


                $attributeName = $product->getAttributeText('attributename');

                If you have input type attribute then you can use below:

                $attributeName = $product->getAttributeName ();






                share|improve this answer




























                  0












                  0








                  0







                  If you have select type attribute then you can use below code to get attribute value:


                  $attributeName = $product->getAttributeText('attributename');

                  If you have input type attribute then you can use below:

                  $attributeName = $product->getAttributeName ();






                  share|improve this answer















                  If you have select type attribute then you can use below code to get attribute value:


                  $attributeName = $product->getAttributeText('attributename');

                  If you have input type attribute then you can use below:

                  $attributeName = $product->getAttributeName ();







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jan 19 at 15:51









                  magefms

                  452115




                  452115










                  answered Jan 2 at 13:33









                  Utsav GuptaUtsav Gupta

                  30415




                  30415






























                      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%2f222631%2fdisplay-a-custom-attribute-below-product-name-in-the-front-end-magento-1-9-3-8%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

                      An IMO inspired problem

                      Management

                      Has there ever been an instance of an active nuclear power plant within or near a war zone?