0

Please excuse my ignorance as PHP 7 is completely new to me.

The more and more I work with Magento 2 the more I'm understanding objects. But my question is:

You have objects the their contents such as:

$block->getFramePages()

or

$_product->getProductUrl()

as examples.

If I was to create a new attribute for a product say "Ready to go" answers "Yes"/"No"

How would I know how to pull it through to the page. What would be its equivilant to getFramesPages() for example?

2

The attribute names are in snake case: ready_to_go. To use the magic getter and setter methods, convert to camel case: $model->getReadyToGo. This is shorthand for $model->getData('ready_to_go'). This feature is implemented by Magento, it's not related to php7.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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