3
在产品保存上创建自定义选项
每当创建产品时,我都在为我的产品自动创建自定义选项。到目前为止,我所得到的是一个在catalog_product_save_before事件上触发并运行以下代码的观察者: //check that we haven't made the option already $options = $product->getProductOptions(); foreach ($options as $option) { if ($option['title'] == 'Auto Date & Time' && $option['type'] == 'date_time' && !$option['is_delete']) { //we've already added the option return; } } $options[] = array( 'title' => $product->getDateLabel(), 'type' => 'date_time', 'is_require' => …