-1

I have $product->setData('phone_features', $avidee); Now i want to check whether phone_feature value set or not.How can i check in magento 2.

2 Answers 2

1

If you have $product object already you can check your value by using this code:

$product->getPhoneFeatures();

or

$product->getData('phone_features');
0

In block :

public function getCatalogSession()
{
    return $this->catalogSession;
}

Then set attribute value in template :

$this->getCatalogSession()->setPhoneFeatures('hello');
$phoneFeature = $this->getCatalogSession()->getPhoneFeatures();

echo $phoneFeature; // hello

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.