0
我正在嘗試學習opencart結構,並嘗試在表product
下創建一個新列。新列是「測試」來自新列的回溯值
然後我嘗試index.php?route=checkout/cart
此頁面下檢索數據(與測試替換列價格)
catalog\controller\checkout\cart.php
...
$this->data['products'][] = array(
'key' => $product['key'],
'thumb' => $image,
'name' => $product['name'],
'model' => $product['model'],
'option' => $option_data,
'quantity' => $product['quantity'],
'stock' => $product['stock'] ? true : !(!$this->config->get('config_stock_checkout') || $this->config->get('config_stock_warning')),
'reward' => ($product['reward'] ? sprintf($this->language->get('text_points'), $product['reward']) : ''),
'price' => $product['test'], //<-- new column
'total' => $total,
'href' => $this->url->link('product/product', 'product_id=' . $product['product_id']),
'remove' => $this->url->link('checkout/cart', 'remove=' . $product['key'])
);
的問題是我沒有得到任何輸出,和我」我不知道如何使用模型。哪個查詢/功能與此頁面相關?
問題在於'cart.php'控制器上可用的'$ products'從它們被存儲在先前設置的結構中的會話中檢索,所以沒有'test'索引。參見'/ system/library/cart.php'和方法'getProducts()'來理解我在說什麼。如果你想在'catalog/controller/product/category.php'或'catalog/controller/product/product.php'控制器上使用它,你正在嘗試的代碼**將會工作。如果您在所有產品清單和產品細節中更換價格,購物車內的最終價格就是您的「測試」價值。 – shadyyx 2013-04-10 13:23:47
@shadyyx是它在category.php和product.php下工作,不幸的是沒有與控制器\ checkout \ cart.php ... – rusly 2013-04-10 13:36:21
@shadyyx感謝您的信息,我現在看到/system/library/cart.php下的代碼我明白它是如何工作的..現在我可以顯示我的自定義字段下cart.php ..再次感謝:) – rusly 2013-04-10 13:39:06