Get is comparable attribute list programmatically in magento 2.

Magento 2 Compare product is one of the native features available with Out of the box. You can compare multiple products from listing and product pages with a click on compare link.

If you want to know about get all the is_comparable attribute lists using programmatically you need to use Magento\Eav\Api\AttributeRepositoryInterface Interface. Continue reading “Get is comparable attribute list programmatically in magento 2.”

How to generate random string or number in Magento 2?

In Magento 2, You can generate a random number or random string using core Magento\Framework\Math\Random class.

Using Random.php class you can generate a random string and random number with Magento Best Coding Practice and you don’t need to depend on PHP core function. Continue reading “How to generate random string or number in Magento 2?”

How to generate unique hash token in Magento 2?

In Magento 2, You can generate a unique hash token for your custom functionality where you need to pass id or variable as encrypted.

Magento uses this functionality, generate a unique hash token for reset password confirmation link.

If you want to do a generate unique token you need to use Core Magento\Framework\Math\Random class to accomplish your requirement. Continue reading “How to generate unique hash token in Magento 2?”