Display a custom attribute below product name in the front-end Magento 1.9.3.8
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
add a comment |
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
Which type of attribute you have text or dropdown?
– Utsav Gupta
Jan 2 at 13:28
add a comment |
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
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
php attributes magento-1 product-view
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
add a comment |
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
add a comment |
3 Answers
3
active
oldest
votes
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);
}
?>
add a comment |
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>
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
add a comment |
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 ();
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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);
}
?>
add a comment |
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);
}
?>
add a comment |
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);
}
?>
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);
}
?>
answered Apr 17 '18 at 10:33
Wajahat BashirWajahat Bashir
10012
10012
add a comment |
add a comment |
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>
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
add a comment |
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>
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
add a comment |
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>
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>
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
add a comment |
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
add a comment |
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 ();
add a comment |
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 ();
add a comment |
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 ();
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 ();
edited Jan 19 at 15:51
magefms
452115
452115
answered Jan 2 at 13:33
Utsav GuptaUtsav Gupta
30415
30415
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Which type of attribute you have text or dropdown?
– Utsav Gupta
Jan 2 at 13:28