cancel
Showing results for 
Search instead for 
Did you mean: 

Get product attibute data

Get product attibute data

Gents
 
I need to replace the field "name" of the product that is showed in the Owl_List.phtml, by a new attribute that I created called "reputacion".
 
Actually this code shows the name:
<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name'); ?>
 
I created a field, under product attributes, called "reputacion".
I created this function inside the file magento/module-catalog/model/product.php 
 
public function getReputacion()
{
return $this->_getData(self::REPUTACION)
}
 
And add this code into Owl_list.php
<?php echo $_helper->productAttribute($_product, $_product->geReputacion(), 'name'); ?>
 
But is not working. Any idea of how to call that field?
1 REPLY

Re: Get product attibute data

As I can suggest from the "Owl_list" name, you load your product among a product collection.

See the instruction: «Used in Product Listing»: a way to force a product attribute to be loaded to the product collections by default: https://mage2.pro/t/1064

 

Another way is to explicitly specify your attribute while building the collection.