I wondered if it is possible to display a message on the basket page if there is less than 5 left of a product?
Ideally this would be listed next to each product in the basket that it applies too.
Any ideas on how I might do this would be greatly appreciated.
Many thanks in advance
The following modifications would be on a core file so I would suggest to make a backup before applying this.
In your system/library/cart.php file,
find:
Code: Select all
'quantity' => $quantity,
Code: Select all
'product_quantity' => (int)$product_query->row['quantity'],
find:
Code: Select all
$this->data['column_quantity'] = $this->language->get('column_quantity');
Code: Select all
$this->data['column_product_quantity'] = $this->language->get('column_product_quantity');
Code: Select all
'quantity' => $product['quantity'],
Code: Select all
'product_quantity' => $product['product_quantity'],
find:
Code: Select all
$_['column_quantity'] = 'Quantity';
Code: Select all
$_['column_product_quantity'] = 'Left In Stock';
find:
Code: Select all
<td class="quantity"><?php echo $column_quantity; ?></td>
Code: Select all
<td class="quantity"><?php echo $column_product_quantity; ?></td>
Code: Select all
<td class="quantity"><input type="text" name="quantity[<?php echo $product['key']; ?>]" value="<?php echo $product['quantity']; ?>" size="3" /></td>
Code: Select all
<td class="quantity">(<?php echo $product['product_quantity']; ?>)</td>
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I won't bore you with the reasons why
Thank you again for the quick reply.
find:
Code: Select all
<td class="quantity">(<?php echo $column_product_quantity; ?>: <?php echo $product['product_quantity']; ?>)</td>
Code: Select all
<?php if ($product['quantity'] > 0 && $product['quantity'] <= 5) { ?>
<td class="quantity">(<?php echo $column_product_quantity; ?>: <?php echo $product['product_quantity']; ?>)</td>
<?php } ?>
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Will this work on OC 2.3.0.2 as well or just on 1.XXstraightlight wrote: ↑Wed Dec 07, 2011 5:40 amI don't know why only the cart quantity was added but not the product quantity in stock while it has been used only within the cart library to compare the results. This topic should be moved to the feature requests section since this is a pretty good one.
The following modifications would be on a core file so I would suggest to make a backup before applying this.
In your system/library/cart.php file,
find:
add right below:Code: Select all
'quantity' => $quantity,
Then, in your catalog/controller/checkout/cart.php file,Code: Select all
'product_quantity' => (int)$product_query->row['quantity'],
find:
add below:Code: Select all
$this->data['column_quantity'] = $this->language->get('column_quantity');
Then, find:Code: Select all
$this->data['column_product_quantity'] = $this->language->get('column_product_quantity');
add below:Code: Select all
'quantity' => $product['quantity'],
Then, in your language/english/checkout/cart.php file,Code: Select all
'product_quantity' => $product['product_quantity'],
find:
add after:Code: Select all
$_['column_quantity'] = 'Quantity';
Then, in your catalog/view/theme/x/template/checkout/cart.tpl file,Code: Select all
$_['column_product_quantity'] = 'Left In Stock';
find:
add below:Code: Select all
<td class="quantity"><?php echo $column_quantity; ?></td>
find:Code: Select all
<td class="quantity"><?php echo $column_product_quantity; ?></td>
add below:Code: Select all
<td class="quantity"><input type="text" name="quantity[<?php echo $product['key']; ?>]" value="<?php echo $product['quantity']; ?>" size="3" /></td>
This should do it.Code: Select all
<td class="quantity">(<?php echo $product['product_quantity']; ?>)</td>
Urgent Questions shoot here: khnaz35@gmail.com
Enjoy nature
Users browsing this forum: No registered users and 17 guests