Instead of showing ***, I would like to display the actual availability status e.g. Pre-order or In-stock.
I figured should be using php echo $stock somehow, but I got undefined variable: stock error.
Any help appreciated.
In order to show something different than the *** do the following:
Open : catalog/controller/checkout/cart.php and find this code:
REPLACE it with this:
Now open up: catalog/view/theme/default/template/checkout/cart.php and find the following:
Replace that with this:
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.
getProducts() is called from the cart.php control file and the Boolean is placed in this array:
The red *** shows up if it returns FALSE, and disappears if returns TRUE here:
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'])
);
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'])
);
Code: Select all
<?php if (!$product['stock']) { ?>
<span class="stock">***</span>
<?php } ?>
Code: Select all
<span class="stock"><?php echo $product['stock']; ?></span>
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;
}
Code: Select all
$this->data['products'][] = array('stock' => $product['stock'],
Code: Select all
<?php if (!$product['stock']) { ?>
<span class="stock">***</span>
<?php } ?>
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 112 guests