Specific attribute in a tab

This area is devoted to Product Tab Slider. Please ask questions, report bugs and share ideas here.

Specific attribute in a tab

Postby hollister » Thu Dec 22, 2011 10:45 pm

I have an attribute that I would like to show in a tab.
I have looked at other-magento-extensions-itoris/insert-custom-options-tabs-slider-t2024.html but to be honest, it's a bit over my head.
On the view.phtml page I just enter in this code:
Code: Select all
<?php echo $_product->getResource()->getAttribute('height')->getFrontend()->getValue($_product) ?>
and it echo's the attribute data. How can I get that into a tab?
Thanks
hollister
 
Posts: 4
Joined: Fri Sep 09, 2011 11:22 pm

Re: Specific attribute in a tab

Postby hollister » Fri Jan 20, 2012 10:26 pm

is this something that is possible?
hollister
 
Posts: 4
Joined: Fri Sep 09, 2011 11:22 pm

Re: Specific attribute in a tab

Postby robohaus » Fri Nov 03, 2017 12:36 pm

Team,

It took me a few days (weeks) of research but I did it in three parts...

1 - Create the attribute.

2 - Create a tab and in the tab's text field enter ->
Code: Select all
{{block class="Itoris\Producttabsslider\Block\Frontend\Description" display_Attribute="specifications" template="Itoris_Producttabsslider::product/view/displayattribute.phtml}}


Note: the text display_Attribute="specifications" is the name of the attribute.

Note: you can display multiple attributes and place the content anywhere you like, you just need to change the name of the attribute you want to display i.e. change specifications to whatever.

3 - Using FTP go to /public_html/app/code/Itoris/Producttabsslider/view/frontend/templates/product/view/

then create a file called displayattribute.html

then in the file displayattribute.html enter...

Code: Select all
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

/**
* Product view template
*
* @see \Magento\Catalog\Block\Product\View
*/
?>
<?php
$_helper = $this->helper('Magento\Catalog\Helper\Output');
$_product = $block->getProduct();
$_call = $block->getAtCall();
$_code = $block->getAtCode();
$_className = $block->getCssClass();
$_attributeLabel = $block->getAtLabel();
$_attributeType = $block->getAtType();
$_attributeAddAttribute = $block->getAddAttribute();

if ($_attributeLabel && $_attributeLabel == 'default') {
    $_attributeLabel = $_product->getResource()->getAttribute($_code)->getFrontendLabel();
}
if ($_attributeType && $_attributeType == 'text') {
    $_attributeValue = ($_helper->productAttribute($_product, $_product->$_call(), $_code)) ? $_product->getAttributeText($_code) : '';
} else {
    $_attributeValue = $_helper->productAttribute($_product, $_product->$_call(), $_code);
}

echo $_product->getResource()->getAttribute($block->getData('display_Attribute'))->getFrontend()->getValue($_product);

?>



Regards
Michael
robohaus
 
Posts: 1
Joined: Fri Nov 03, 2017 12:16 pm


Return to Product Tabs Slider

Who is online

Users browsing this forum: No registered users and 1 guest

cron