AD0-E716 · Question #26
There is the task to create a custom product attribute that controls the display of a message below the product title on the cart page, in order to identify products that might be delivered late…
The correct answer is A. Option A. To allow the is_delayed EAV attribute to be used in the .phtml cart page, the developer needs to create a new file called etc/catalog_attributes.xmi. This file will contain the definition of the is_delayed attribute. The following code shows how to create the…
Question
There is the task to create a custom product attribute that controls the display of a message below the product title on the cart page, in order to identify products that might be delivered late. The new EAV attribute is_delayed has been created as a boolean and is working correctly in the admin panel and product page. What would be the next implementation to allow the is_delayed EAV attribute to be used in the .phtml cart page such as $block->getProduct()->getIsDelayed()? A) Create a new file etc/catalog_attributes.xmi:
B) Create a new file etc/extension attributes.xmi:
C) Create a new file etc/eav attributes.xmi:
Exhibit
Options
- AOption A
- COption C
How the community answered
(58 responses)- A72% (42)
- C28% (16)
Explanation
To allow the is_delayed EAV attribute to be used in the .phtml cart page, the developer needs to create a new file called etc/catalog_attributes.xmi. This file will contain the definition of the is_delayed attribute. The following code shows how to create the etc/catalog_attributes.xmi file: <?xml version="1.0"?> <catalog_attributes> <attribute code="is_delayed" type="int"> <label>Is Delayed</label> <note>This attribute indicates whether the product is delayed.</note> <sort_order>10</sort_order> <required>false</required> </catalog_attributes> Once the etc/catalog_attributes.xmi file has been created, the is_delayed attribute will be available in the .phtml cart page. The attribute can be accessed using the getIsDelayed() method of the $product = $block->getProduct(); $isDelayed = $product->getIsDelayed(); The isDelayed variable will contain the value of the is_delayed attribute. If the value of the attribute is 1, then the product is delayed. If the value of the attribute is 0, then the product is not delayed.
Topics
Community Discussion
No community discussion yet for this question.
