Had a bit of a different way of doing it, using 1.5.3.1, I don't count down my stock (endless supply...hahaha, just not that high of a turnover to worry about it). Anyway, this is what I did:
Could probably get away with this, but I haven't tried it yet:
Code: Select all
<?php echo $text_stock; ?>
<?php if ($stock == "In Stock") { ?>
<span><?php echo $stock; ?></span> <?php }
elseif ($stock != "In Stock") { ?>
<span style="color: red;"><?php echo $stock; ?></span><?php } ?>
Code: Select all
<?php if ($stock != "In Stock") { ?>
<span style="color: red;"><?php echo $stock; ?></span><?php }
else { ?>
<span><?php echo $stock; ?></span>
<?php }?>
HI, we are trying to do the same thing in v1.5.5.1 so In Stock shown as bold blue and Out Of Stock shown as bold red
this code makes all red:
and this code makes black and red and inserts a scroll bar under the description container:
Any one????
this code makes all red:
Code: Select all
<span><?php echo $text_stock; ?></span>
<?php if($stock >= 1) {
$my_color_stock = 'blue';
} elseif($stock < 1) {
$my_color_stock = 'red';
}
?>
<span style="color: <?php echo $my_color_stock ?>;"><?php echo $stock; ?></span></div>
Code: Select all
<span><?php echo $text_stock; ?></span>
<?php if ($stock == "In Stock") { ?>
<span><?php echo $stock; ?></span> <?php }
elseif ($stock != "In Stock") { ?>
<span style="font-size:14px;font-weight:bolder;color: #FF0000;"><?php echo $stock; ?></span><?php } ?>
Done IT!
Code: Select all
<span><?php echo $text_stock; ?></span>
<?php if($stock == "In Stock") {
$my_color_stock = '#0000FF';
} elseif($stock != "In Stock") {
$my_color_stock = '#FF0000';
}
?>
<span style="font-size:14px;font-weight:bolder;color:<?php echo $my_color_stock; ?>;"><?php echo $stock; ?></span></div>
Hello there,
I am running a multi-lingual shop (1.5.5.1) and I would like to implement the functionality discussed here (text colour change, based on stock status). However, I understand the solution presented here is based on the verification of a text string - if($stock == "In Stock"). I rather would like to check the amount (numerical value) rather than the stock status, i.e. use the numerical value of $stock. Note that I do not want to display the stock amount in the frontend.
Can someone help?
Thank you!!!
I am running a multi-lingual shop (1.5.5.1) and I would like to implement the functionality discussed here (text colour change, based on stock status). However, I understand the solution presented here is based on the verification of a text string - if($stock == "In Stock"). I rather would like to check the amount (numerical value) rather than the stock status, i.e. use the numerical value of $stock. Note that I do not want to display the stock amount in the frontend.
Can someone help?
Thank you!!!
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! im using shoppica theme, I hope you can help me! i would really appreciate you help! =)
...by this script "Out In stock" does become RED but In stock also becomes RED and not BLUE.James_K wrote:Done IT!Code: Select all
<span><?php echo $text_stock; ?></span> <?php if($stock == "In Stock") { $my_color_stock = '#0000FF'; (to get blue color) } elseif($stock != "In Stock") { $my_color_stock = '#FF0000'; (to get red color) } ?> <span style="font-size:14px;font-weight:bolder;color:<?php echo $my_color_stock; ?>;"><?php echo $stock; ?></span></div>
So I have combined the 2 scripts as given by you and achived the RED and BLUE change in BOLD, please find the changed script below. I have checked its working in OC-1.5.6.4 and it works fine:James_K wrote:HI, we are trying to do the same thing in v1.5.5.1 so In Stock shown as bold blue and Out Of Stock shown as bold red
this code makes all red:Code: Select all
<span><?php echo $text_stock; ?></span> <?php if($stock >= 1) { $my_color_stock = 'blue'; } elseif($stock < 1) { $my_color_stock = 'red'; } ?> <span style="color: <?php echo $my_color_stock ?>;"><?php echo $stock; ?></span></div>
Code: Select all
<span><?php echo $text_stock; ?></span>
<?php if($stock >= 1) {
$my_color_stock = 'blue';
} elseif($stock < 1) {
$my_color_stock = 'red';
}
?>
<span style="font-size:14px;font-weight:bolder;color:<?php echo $my_color_stock; ?>;"><?php echo $stock; ?></span></div>
...TY
Regards,
Sun Systems
Industrial Electronics and Instrumentation
Here's a quick vQmod to avoid editing the system files if anyone needs it.
Thank you, works well, but only in English; doesn't works in my language, Danish?Concept211 wrote:Here's a quick vQmod to avoid editing the system files if anyone needs it.
Just change the language path in the file to your danish file.webheartpro wrote:Thank you, works well, but only in English; doesn't works in my language, Danish?Concept211 wrote:Here's a quick vQmod to avoid editing the system files if anyone needs it.
Who is online
Users browsing this forum: No registered users and 18 guests