Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Show 'In Stock: Yes/No' on product_info.php


Acheron

Recommended Posts

Posted

Just a little mod to add a stock label to product_info.php which can be turned on/off via Admin CP.

 

Run the SQL:

 

INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('216', 'Show stock', 'SHOW_PRODSTOCK', 'True', 'Show stock status on product info page', 9, 6, '2004-06-30 07:10:52', '2004-06-30 07:10:52', NULL, 'tep_cfg_select_option(array(\'True\', \'False\'),');

 

 

Modify product_info.php

 

FIND:

 

    if (tep_not_null($product_info['products_model'])) {
     $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
   } else {
     $products_name = $product_info['products_name'];
   }

 

 

ADD BELOW:

 

    if ($product_info['products_quantity'] > 0) {
     $showstock = "In Stock: Yes";
   } else {
     $showstock = "In Stock: No";
   }

 

 

Then place the code below wherever you want it displayed:

 

<?php if (SHOW_PRODSTOCK=='True') {echo $showstock;} ?>

 

I can't really offer any suggestions on where you should put it since my product_info.php has been completely rewritten and reorganized. ;)

Posted
Just a little mod to add a stock label to product_info.php which can be turned on/off via Admin CP.

 

Run the SQL:

 

INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('216', 'Show stock', 'SHOW_PRODSTOCK', 'True', 'Show stock status on product info page', 9, 6, '2004-06-30 07:10:52', '2004-06-30 07:10:52', NULL, 'tep_cfg_select_option(array(\'True\', \'False\'),');

 

 

Modify product_info.php

 

FIND:

 

 ? ?if (tep_not_null($product_info['products_model'])) {
? ? ?$products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
? ?} else {
? ? ?$products_name = $product_info['products_name'];
? ?}

 

 

ADD BELOW:

 

 ? ?if ($product_info['products_quantity'] > 0) {
? ? ?$showstock = "In Stock: Yes";
? ?} else {
? ? ?$showstock = "In Stock: No";
? ?}

 

 

Then place the code below wherever you want it displayed:

 

<?php if (SHOW_PRODSTOCK=='True') {echo $showstock;} ?>

 

I can't really offer any suggestions on where you should put it since my product_info.php has been completely rewritten and reorganized.  ;)

And if you want to let the user see this message in a language specified in your shop, then put in the following code, instead of the one above.

 

if ($product_info['products_quantity'] > 0) {
$showstock = "<?php echo INSTOCK_YES; ?>";
} else {
$showstock = "<?php echo INSTOCK_NO; ?>";
}

 

And then define INSTOCK_YES and INSTOCK_NO in your desired language file.

 

Masterblaster B)

  • 3 weeks later...
  • 9 months later...
Posted

Will someone who has done this mod post their url I can see what it looks like.

 

Thanks

 

Mark

Lifes a bitch, then you marry one, then you die!

Archived

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

×
×
  • Create New...