gpt4 book ai didi

magento2 - Magento 2 : How to get multiple selection attibute as list on list. phtml

转载 作者:行者123 更新时间:2023-12-04 17:51:15 25 4
gpt4 key购买 nike

我已经为我的产品添加了一个多选属性,现在我正试图在“list.phtml”模板上显示结果。 (产品列表)。

我得到的所有值都是这样的:

$attribute = $_product->getResource()->getAttribute('attribute_name')->getFrontend()->getValue($_product);

这将返回一个包含所有值的字符串,但我需要它是一个数组,以便我可以将它转换为包含单独链接的列表。

有什么帮助吗?

谢谢!

最佳答案

最终使用:

$attribute_string = $_product->getResource()->getAttribute('attribute')->getFrontend()->getValue($_product);

$attribute_array = explode(', ', $attribute_string);

关于magento2 - Magento 2 : How to get multiple selection attibute as list on list. phtml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44620789/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com