我对每个产品的选项名称进行了动态更改。问题是我正在写表更改。oc_product_option
通过转到 system/library/cart.php > public function getProducts() { },那里只加载了 product_option_value。我想在 system/library/cart.php > public function getProducts() { } 中加载此代码
然后在目录/controller/common>cart.php中调用
$data['options'] = array();
foreach ($this->model_catalog_product->getProductOptions($this->request->get['product_id']) as $option) {
$product_option_value_data = array();
foreach ($option['product_option_value'] as $option_value) {
if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) {
if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) {
$price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax') ? 'P' : false), $this->session->data['currency']);
} else {
$price = false;
}
$product_option_value_data[] = array(
'product_option_value_id' => $option_value['product_option_value_id'],
'option_value_id' => $option_value['option_value_id'],
'name' => $option_value['name'],
'ob_info' => $option_value['ob_info'],
'image' => $this->model_tool_image->onesize($option_value['image'], 100, 100),
'price' => $price,
'price_prefix' => $option_value['price_prefix']
);
}
}
$data['options'][] = array(
'product_option_id' => $option['product_option_id'],
'product_option_value' => $product_option_value_data,
'option_id' => $option['option_id'],
'name' => $option['name'],
'type' => $option['type'],
'value' => $option['value'],
'required' => $option['required']
);
}
表img:http: //imgur.com/a/A9Ibw
我想这样做是因为当我添加产品时,它不会保留更改后的名称,而是使用选项的名称,因此动态名称不会检测到它。