Currently via below code I can get in list.phtml
From this I get brand name dropdown value in list.phtml correct:
<div class="brand-name"> <?php
$optionText = '';
$attr = $_product->getResource()->getAttribute('brand');
if ($attr->usesSource()) {
$optionText = $attr->getSource()->getOptionText($_product->getBrand());
}
?>
<?php if($optionText){ ?>
<?php echo "" . $optionText . "<br>"; ?>
<?php } ?></div>
via this code I get text subname in list.phtml
<div class="subname">
<?php /* @escapeNotVerified */ echo $_product->getResource()->getAttribute('subname')->getFrontend()->getValue($_product); ?><?php /* @escapeNotVerified */ echo __('<br /><br />') ?></div>
Now I try also display this attributes in custom slider:
app/code/Mageplaza/Productslider/view/frontend/templates/productslider.phtml
But When I put this code then sliders dissapper. I try add variable to this file:
<?php
$_productCollection = $block->getLoadedProductCollection();
$_helper = $this->helper('Magento\Catalog\Helper\Output');
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$productModel = $objectManager->get('Magento\Catalog\Model\Product');
?>
But still no work. Can anyone help me?
This file mageplaza slider file: https://github.com/mageplaza/magento-2-product-slider/blob/2.4/view/frontend/templates/productslider.phtml