How to read Magento product custom options correctly?

Magento product custom options 的存储结构比较“绕”,我绕了好长时间才解开。 假设 $product 有两个 custom options,一个是 textarea input type,另一个是 multiple select input type: 先用 $product->getOptions(),得到是包含两个 custom options 的集合; 然后 foreach 一下,得到每个 $option。对第一个 textarea 类型的,处理起来相对简单,用 $option->getData(‘title’) 查看 title,以此类推。对第二个 multiple select 类型的,用 $option->getData() 只能查看概况,对于 select 里的每个 option (对应 <select><option>…</option></select>),还得用 $option->getValues(),然后再次 foreach 才能得到 select option。 够复杂吧。