In order to show something different than the
*** do the following:
Open : catalog/controller/checkout/cart.php and find this code:
Code: Select all
$this->data['products'][] = array(
'key' => $product['key'],
'thumb' => $image,
'name' => $product['name'],
'model' => $product['model'],
'option' => $option_data,
'quantity' => $product['quantity'],
'stock' => $product['stock'],
'reward' => ($product['reward'] ? sprintf($this->language->get('text_points'), $product['reward']) : ''),
'price' => $price,
'total' => $total,
'href' => $this->url->link('product/product', 'product_id=' . $product['product_id']),
'remove' => $this->url->link('checkout/cart', 'remove=' . $product['key'])
);
REPLACE it with this:
Code: Select all
$this->language->load('product/product');
$this->load->model('catalog/product');
$product_info = $this->model_catalog_product->getProduct($product['product_id']);
if ($product['stock'] == false) {
$stock = $product_info['stock_status'];
} else {
$stock = $this->language->get('text_instock');
}
$this->data['products'][] = array(
'key' => $product['key'],
'thumb' => $image,
'name' => $product['name'],
'model' => $product['model'],
'option' => $option_data,
'quantity' => $product['quantity'],
'stock' => $stock,
'reward' => ($product['reward'] ? sprintf($this->language->get('text_points'), $product['reward']) : ''),
'price' => $price,
'total' => $total,
'href' => $this->url->link('product/product', 'product_id=' . $product['product_id']),
'remove' => $this->url->link('checkout/cart', 'remove=' . $product['key'])
);
Now open up: catalog/view/theme/default/template/checkout/cart.php and find the following:
Code: Select all
<?php if (!$product['stock']) { ?>
<span class="stock">***</span>
<?php } ?>
Replace that with this:
Code: Select all
<span class="stock"><?php echo $product['stock']; ?></span>
That will work just fine.
Now that you have your fix you may be interested in how the *** actually comes about.
This is taken care of by as simple Boolean TRUE or FALSE from the getProducts() core function.
Code: Select all
$stock = true;
// Stock
if (!$product_query->row['quantity'] || ($product_query->row['quantity'] < $quantity)) {
$stock = false;
}
getProducts() is called from the cart.php control file and the Boolean is placed in this array:
Code: Select all
$this->data['products'][] = array('stock' => $product['stock'],
The red
*** shows up if it returns FALSE, and disappears if returns TRUE here:
Code: Select all
<?php if (!$product['stock']) { ?>
<span class="stock">***</span>
<?php } ?>