Hi All,
Firstly I just want to say that I think this forum is amazing, I am currently in the process of changing our current website over to opencart and have found endless support using this forum and think that opencart itself is brilliant.
Anyway, I have checked this forum for the last hour or so and cant see any posts that tell me how I can change the colour of the "Out Of Stock" text on the products page, I would like to have the text in red, but only if the product is out of stock?? i.e " In Stock" = Black "Out Of Stock" = Red...... Is this possible, my current test store is located at http://www.pandorasjewellerybox.co.uk/store/ version 1.4.9
Any help is much appreciated.
Thanks,
Phil
Firstly I just want to say that I think this forum is amazing, I am currently in the process of changing our current website over to opencart and have found endless support using this forum and think that opencart itself is brilliant.
Anyway, I have checked this forum for the last hour or so and cant see any posts that tell me how I can change the colour of the "Out Of Stock" text on the products page, I would like to have the text in red, but only if the product is out of stock?? i.e " In Stock" = Black "Out Of Stock" = Red...... Is this possible, my current test store is located at http://www.pandorasjewellerybox.co.uk/store/ version 1.4.9
Any help is much appreciated.
Thanks,
Phil
You can check the text coming on the product tpl file and change the color to red. We did the same for pre-order. see below.
http://www.opencartaustralia.com/sales/ ... duct_id=30
http://www.opencartaustralia.com/sales/ ... duct_id=30
Thanks, for the quick response.
I have just looked at your pre-order as suggested and that is exactly what I would like to do, I'm just not sure how to do it??
I have looked in the product.tpl file and can't see what I am supposed to change.....
I'm assuming that this is the control for the stock status displayed but I'm not sure what I am meant to add so that only "out of stock" shows up in red?
Thanks again for your help.
Phil
I have just looked at your pre-order as suggested and that is exactly what I would like to do, I'm just not sure how to do it??
I have looked in the product.tpl file and can't see what I am supposed to change.....
Code: Select all
<tr>
<td><b><?php echo $text_availability; ?></b></td>
<td><?php echo $stock; ?></td>
</tr>
Thanks again for your help.
Phil
Very simple if the coming value is equal to PRE-ORDER change the color jazz it up with red if not follow the usual logic. You just need to add a if condition and then color the text. Thats all.
I register simply because I was actually searching for more info on items in carts, search, and some other functions and came across this post.
Is great Phil found the solution, and Kedgetech point him on the path to solve his problem. The only thing I saw is that other people with this issue might not be coders, maybe they are just the designer, also taking in consideration the new coders. I just simply give them a view of what the code should do.
Here my fellow OpenCarters:
Enjoy.
Is great Phil found the solution, and Kedgetech point him on the path to solve his problem. The only thing I saw is that other people with this issue might not be coders, maybe they are just the designer, also taking in consideration the new coders. I just simply give them a view of what the code should do.
Here my fellow OpenCarters:
Code: Select all
<td><b><?php echo $text_availability; ?></b></td>
<?php if($stock >= 11){
$wcd_color_stock = '#006633';
} elseif($stock <= 10 && $stock >= 5){
$wcd_color_stock = '#FF9900';
} elseif($stock <= 4 || $stock == 'SOLD OUT'){
$wcd_color_stock = '#990033';
}
?>
<td><span style="font-size:12px;font-weight:bolder;color:<?php echo $wcd_color_stock; ?>;"><?php echo $stock; ?></span></td>
hi. that is very usfull thanks. but also where would i find the tpl to be able to edit this?Erunix wrote:I register simply because I was actually searching for more info on items in carts, search, and some other functions and came across this post.
Is great Phil found the solution, and Kedgetech point him on the path to solve his problem. The only thing I saw is that other people with this issue might not be coders, maybe they are just the designer, also taking in consideration the new coders. I just simply give them a view of what the code should do.
Here my fellow OpenCarters:Enjoy.Code: Select all
<td><b><?php echo $text_availability; ?></b></td> <?php if($stock >= 11){ $wcd_color_stock = '#006633'; } elseif($stock <= 10 && $stock >= 5){ $wcd_color_stock = '#FF9900'; } elseif($stock <= 4 || $stock == 'SOLD OUT'){ $wcd_color_stock = '#990033'; } ?> <td><span style="font-size:12px;font-weight:bolder;color:<?php echo $wcd_color_stock; ?>;"><?php echo $stock; ?></span></td>
You find it in /catalog/view/theme/YOU THEME/template/product
Got a question tho:
The code works perfecly if you use stock levels as numbers, but how do i make it work with text instead? I have choosen to not show stock level from admin so it just show "in stock" instead, but then the color is not working.
/Spharx
Got a question tho:
The code works perfecly if you use stock levels as numbers, but how do i make it work with text instead? I have choosen to not show stock level from admin so it just show "in stock" instead, but then the color is not working.
/Spharx
This is a simple version that works for me, it is only red when something is out of stock.
In /catalog/view/theme/default/template/product/product.tpl, find:
And replace it with:
I also have the code if you're using the Shoppica theme, so let me know if you need/want it.
In /catalog/view/theme/default/template/product/product.tpl, find:
Code: Select all
<span><?php echo $text_stock; ?></span> <?php echo $stock; ?></div>
Code: Select all
<span><?php echo $text_stock; ?></span>
<?php if($stock >= 1) {
$my_color_stock = '#000';
} elseif($stock < 1) {
$my_color_stock = 'red';
}
?>
<span style="color: <?php echo $my_color_stock ?>;"><?php echo $stock; ?></span></div>
Can this code be modified to replace the text for images?markisonfire wrote:This is a simple version that works for me, it is only red when something is out of stock.
In /catalog/view/theme/default/template/product/product.tpl, find:
And replace it with:Code: Select all
<span><?php echo $text_stock; ?></span> <?php echo $stock; ?></div>
I also have the code if you're using the Shoppica theme, so let me know if you need/want it.Code: Select all
<span><?php echo $text_stock; ?></span> <?php if($stock >= 1) { $my_color_stock = '#000'; } elseif($stock < 1) { $my_color_stock = 'red'; } ?> <span style="color: <?php echo $my_color_stock ?>;"><?php echo $stock; ?></span></div>
I'm not sure what you mean, please elaborate?temptious wrote:Can this code be modified to replace the text for images?markisonfire wrote:This is a simple version that works for me, it is only red when something is out of stock.
In /catalog/view/theme/default/template/product/product.tpl, find:
And replace it with:Code: Select all
<span><?php echo $text_stock; ?></span> <?php echo $stock; ?></div>
I also have the code if you're using the Shoppica theme, so let me know if you need/want it.Code: Select all
<span><?php echo $text_stock; ?></span> <?php if($stock >= 1) { $my_color_stock = '#000'; } elseif($stock < 1) { $my_color_stock = 'red'; } ?> <span style="color: <?php echo $my_color_stock ?>;"><?php echo $stock; ?></span></div>
Hello,
I'm also interested in changing the out of stock text in red colour and I tried the markisonfire's solution but didn't worked
My original code is:
<tr>
<td><b><?php echo $text_availability; ?></b></td>
<td><?php echo $stock; ?></td>
</tr>
Any help please? Thanks!
PS: OC v. 1.4.9.6
I'm also interested in changing the out of stock text in red colour and I tried the markisonfire's solution but didn't worked
My original code is:
<tr>
<td><b><?php echo $text_availability; ?></b></td>
<td><?php echo $stock; ?></td>
</tr>
Any help please? Thanks!
PS: OC v. 1.4.9.6
v. 1.4.9.6 & v. 2.0.2.0
you use it for 1.4.9.6Joxe wrote:Hello,
I'm also interested in changing the out of stock text in red colour and I tried the markisonfire's solution but didn't worked
My original code is:
<tr>
<td><b><?php echo $text_availability; ?></b></td>
<td><?php echo $stock; ?></td>
</tr>
Any help please? Thanks!
PS: OC v. 1.4.9.6
http://forum.opencart.com/viewtopic.php ... 23#p138711
Thats exactly what I needed. Well this is what I came up with and it is working for me in 1.5.2.1.spharx wrote:You find it in /catalog/view/theme/YOU THEME/template/product
Got a question tho:
The code works perfecly if you use stock levels as numbers, but how do i make it work with text instead? I have choosen to not show stock level from admin so it just show "in stock" instead, but then the color is not working.
/Spharx
Code: Select all
<span><?php echo $text_stock; ?></span>
<?php if($stock == "In Stock") {
$my_color_stock = '#000';
} elseif($stock == "Out of stock") {
$my_color_stock = 'red';
}
?>
<span style="color: <?php echo $my_color_stock ?>;"><?php echo $stock; ?></span></div>
Sorry, I did not understand...eka7a wrote: you use it for 1.4.9.6
http://forum.opencart.com/viewtopic.php ... 23#p138711
v. 1.4.9.6 & v. 2.0.2.0
I tried for 1.5.4.1
The "Out of Stock "color changed as Red but the "in stock" also became Red.
I tried to fix it and changed the part $my_color_stock='#00000'; or just 'black';
but didn't work.
So, on my site, both Out of Stock and In Stock are red color.
Do you have any idea to fix?
The "Out of Stock "color changed as Red but the "in stock" also became Red.
I tried to fix it and changed the part $my_color_stock='#00000'; or just 'black';
but didn't work.
So, on my site, both Out of Stock and In Stock are red color.
Do you have any idea to fix?
Who is online
Users browsing this forum: No registered users and 59 guests