Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Stock status in product listing


warrenerjm

Recommended Posts

Posted

Hi

I am looking at the contribution:

http://www.oscommerce.com/community/contri...stock+status+in

& am confused by the following:

 

!!!!!!!  First install David Allen?s ?Stock Status in Product Listing v1.1? see enclosed readme1.txt file !!!!!



Then find David?s Code in product_info.php

<!--bof stock announcement-->
<?php
 if ((STOCK_CHECK == 'true')&&($product_info['products_quantity'] < 1)) {
?>
 <tr>
<td><span class="markProductOutOfStock"><b><?php echo TEXT_OUT_OF_STOCK; ?></b></span></td>
 </tr>
 <tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 </tr> 
<?php
 } elseif ((STOCK_CHECK == 'true')&&($product_info['products_quantity'] > 0)) {
?>
 <tr>
<td><span class="markProductOutOfStock"><b><?php echo TEXT_IN_STOCK; ?></b></span></td>
 </tr> 
 <tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 </tr> 
<?php
} 
?>	 
<!--eof stock announcement-->


Add the line

<?php  include(DIR_WS_BOXES . 'product_notifications.php'); ?>  

directly under the line:

<td><span class="markProductOutOfStock"><b><?php echo TEXT_OUT_OF_STOCK; ?></b></span></td> 


So the whole thing would look like this:


<!--bof stock announcement-->
<?php
 if ((STOCK_CHECK == 'true')&&($product_info['products_quantity'] < 1)) { 
?>
 <tr>
<td><span class="markProductOutOfStock"><b><?php echo TEXT_OUT_OF_STOCK; ?></b></span></td>
  <?php  include(DIR_WS_BOXES . 'product_notifications.php'); ?>  
 </tr>
 <tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 </tr> 
<?php
} 
?>	 
<!--eof stock announcement-->

 

This is not included in the "so the whole thing would look like this:" code?

 

<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 </tr> 
<?php
 } elseif ((STOCK_CHECK == 'true')&&($product_info['products_quantity'] > 0)) {
?>
 <tr>
<td><span class="markProductOutOfStock"><b><?php echo TEXT_IN_STOCK; ?></b></span></td>
 </tr> 
 <tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 </tr>

Do I just add the line or do I have to delete this bit from the code too? Sorry but I do as I'm told & I don't understand php codes fully yet.

 

I hope this contrib is OK to use, by the way. Any comments please.

 

Thanks for your help

 

Julie

Posted

If you only want to display the info box when an item is out of stock, then you would only need the the code:

 

<!--bof stock announcement-->
<?php
if ((STOCK_CHECK == 'true')&&($product_info['products_quantity'] < 1)) {
?>
<tr>
<td><span class="markProductOutOfStock"><b><?php echo TEXT_OUT_OF_STOCK; ?></b></span></td>
<?php include(DIR_WS_BOXES . 'product_notifications.php'); ?>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
}
?>
<!--eof stock announcement-->

 

The bit that you noticed was missing, displays the message for In Stock also. Of course if you want that as well, then you don't need to touch the original code.

 

Always back-up your files before using a contribution. That way, if it goes wrong or you don't like it, you can reinstate the original backed-up file.

Posted

Thanks Peter

 

I only want the Notification box to be displayed when it is "Out of Stock", but I do want it to say "In Stock" too without the notification box. I guess that means I need the whole code with the line added after the "Out of stock" code.

 

I do back up, but sometimes things still don't work. Then you find from the forum you shouldn't have used that contribution in the first place! Thought it prudent to just ask first, should anyone out there have done this on their site.

 

Thanks for your reply. I think I understand the code now.

 

Julie :thumbsup:

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...