0
我對每個產品的選項名稱進行動態更改。 問題是我正在寫表格更改。 Oc_product_option在cart.php中的Opencart getProductOptions
通過去system/library/cart.php> public function getProducts(){}那裏只加載了product_option_value。 我要加載在系統中,這代碼/庫/ cart.php>公共函數的getProducts(){}
然後調用它的產品目錄/控制器/通用> 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']
);
}
我想這樣做是因爲當我添加產品時,它不會保留更改後的名稱,並且它取決於選項的名稱,所以dynamicname不會檢測到它。