Jump to content
Sign in to follow this  
sosidge

Stock Status in Product Listing

Recommended Posts

Hi there.. I have just installed this contrib and *think* I installed it correctly... Only one prob:

On the page that lists everything in the category

 

Product Name+ | Price | Buy Now | Quantity

Beloved | $60.49 | | Out of Stock

Courage Under Fire |$32.99 | | Out of Stock

Red Corner | $35.20 | | Out of Stock

 

it is listing everything as 'out of stock' (which is not the case, each product has a stock>0). However, when I click on a praticular item and look at it's details, it is definetly in stock, and is able to be brought.

 

Any ideas?

 

Thanks, Barbara

Does anyone have this contribution working properly? Can anyone help me out?

Share this post


Link to post
Share on other sites
Hi there.. I have just installed this contrib and *think* I installed it correctly... Only one prob:

On the page that lists everything in the category

 

Product Name+ | Price | Buy Now | Quantity

Beloved | $60.49 | | Out of Stock

Courage Under Fire |$32.99 | | Out of Stock

Red Corner | $35.20 | | Out of Stock

 

it is listing everything as 'out of stock' (which is not the case, each product has a stock>0). However, when I click on a praticular item and look at it's details, it is definetly in stock, and is able to be brought.

 

Any ideas?

 

Thanks, Barbara

 

I have exactly the same problem. This occurs when I do the editing to the products_info.php file. However, when I edited the products_new.php file it worked just fine. I too think I followed the instructions correctly. Can you guys help?

Share this post


Link to post
Share on other sites

Out of Stock instead of Price and maybe solution to some other problems

found a simple solution for a little addon:

 

i wanted the stock status messages to appear instead of the price (don?t want an extra colum just to show the status of the product).

so when a product is sold out (stock <0) the price is replaced by the "Out of Stock" text.

 

 

the problem to do this with this fine contribution is, that the contribution only works when the "Display Product Quantity" option in "Product Listing" in the Admin tool is switched on. This is, because the $listing['products_price'] returns NULL when it is switched off.

 

but if you change that to tep_get_products_stock($listing['products_id']) - you get the quantity anyway.

And it gets possible to use this fine contribution even if you do not switch on "Display Product Quantity"

here is how the code would like to display "Sold out" instead of the price in the product listing.

 

case 'PRODUCT_LIST_PRICE':
		$lc_align = 'right';
//conte: price will only be displayed if stock >0, else out of Stock will be displayed
		if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($listing['products_id']) < 1)) {
			$lc_text = '<span class="markProductOutOfStock"><b>Sold out</b></span>';
			  } elseif ((STOCK_CHECK == 'true')&&($listing['products_quantity'] > 0 )) {
			if (tep_not_null($listing['specials_new_products_price'])) {
					  $lc_text = '?<s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>??<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>?';
			} else {
				  $lc_text = '?' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '?';
			}
		}else{
			if (tep_not_null($listing['specials_new_products_price'])) {
					  $lc_text = '?<s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>??<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>?';
			} else {
				  $lc_text = '?' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '?';
			}
		}
		break;

 

feel free to use this for a next version.

Share this post


Link to post
Share on other sites

Hello,

 

Thanks for this contribution. As you can see on www.janssen-militaria.com I have installed some of your features.

 

Only thing is that I want to change 2 things and since I am not a php programmer I could need some help.

 

I don't want the numbers or your "in stock" and "out of stock" to show in the product listings. I have managed to ged rid of the text "Quantities" above them. Please note that I have not installed part 2 of your contrib. And I suggest that I have to change something in the lines below from product_listing.php?

 

case 'PRODUCT_LIST_QUANTITY':

$lc_align = 'right';

$lc_text = '?' . $listing['products_quantity'] . '?';

break;

 

Other thing is that I would like to make a .gif with SOLD with the same dimentions as the button_in_cart.gif and button_buy_now.gif which should appear when stock is 0. I presume I should modify the lines below from your contribution?

 

} else {

echo tep_draw_separator('pixel_trans.gif', '1', '22');

}

 

and

 

if ((STOCK_CHECK == 'true')&&($listing['products_quantity'] < 1)) {

$lc_text = '?';

 

Greetings from the Netherlands,

Peter Janssen

Janssen-Militaria

Share this post


Link to post
Share on other sites

Peter,

 

I'm not familiar w/this contribution but for your question

 

I don't want the numbers or your "in stock" and "out of stock" to show in the product listings. I have managed to ged rid of the text "Quantities" above them. Please note that I have not installed part 2 of your contrib. And I suggest that I have to change something in the lines below from product_listing.php?

 

If I understood the question...you can turn that column off in admin>configuration>product listing>Display product quantity...it will disappear :)

Share this post


Link to post
Share on other sites

I have installed this contrubution and it has been working great, But I would like it to display the

"Out Of Stock" button_out_of_stock.gif

Button in the listing as well.

Now being a newbie, I'm unsure how to change the following to display the button.

 

case 'PRODUCT_LIST_BUY_NOW':
		$lc_align = 'center';
		if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($listing['products_id']) < 1)) {
		  $lc_text = ' ';
		} else {
		  $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
		}

 

I'm sure somehow you can get it to display the button here instead of the empty text

 

 if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($listing['products_id']) < 1)) {
		  $lc_text = ' ';

 

Any help would be greatfull recieved.

Share this post


Link to post
Share on other sites
If I understood the question...you can turn that column off in admin>configuration>product listing>Display product quantity...it will disappear

 

Thank you for your reply, but this is exactly the problem that I have. I had it switched off, but when I installed the contrib I had to switch it on because the contrib does need this information and does not work when it is switched off.

 

Kind regards,

Peter

Share this post


Link to post
Share on other sites
if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($listing['products_id']) < 1)) {

$lc_text = ' ';

 

I have changed this to display SOLD (text no image) in several languages by changing the line like

 

if ((STOCK_CHECK == 'true')&&($listing['products_quantity'] < 1)) {

$lc_text = TEXT_SOLD;

 

And off course add TEXT_SOLD in the language module. But this was not your question, but I presume you should alter it something like this.

 

if ((STOCK_CHECK == 'true')&&($listing['products_quantity'] < 1)) {

$lc_text = tep_image_button('button_out_of_stock.gif', IMAGE_BUTTON_OUT_OF_STOCK);

 

Please backup because I am not a programmer and haven't tried this.

 

Kind regards,

Peter

Share this post


Link to post
Share on other sites

I have been using this contrib for nearly a year.

 

It is a great contribution. Thank you.

 

I am hoping to expand its usefulness. I would like to expand on the IN STOCK and OUT OF STOCK messages.

 

For example, I would like it to say LOW STOCK when less than 5 items are in stock.

 

Also, I would like to create custom stock messages based on specific stock levels, for example:

 

If stock is between 300 and 400, I would like to have CALL FOR INFO

 

If stock is between 401 and 500, I would like to have ARRIVING IN DECEMBER

 

ETC.

 

There is a contribution called Quantity availability image and text Unlimited that does this, but it is not as conprehensive as this one.

 

Has anyone done anything like this?

 

Can someone give me a hint on how to do this?

 

Best Regards, Ted :-"

Share this post


Link to post
Share on other sites

I may have answered my own question.

 

However, perhaps it could be done more elegantly.

 

Here's what I did in product_info.php (actually, in my case, using BTS, the file was catalog/templates/content/product_info.tpl.php):

 

<!--bof stock announcement-->
<?php
if ((STOCK_CHECK == 'true')&&($product_info['products_quantity'] == 0)) {
?>
<tr>
  <td><span class="markProductOutOfStock"><b>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'] >= 2)&&($product_info['products_quantity'] < 400)) {
?>
<tr>
  <td><span class="markProductOutOfStock"><b>In 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'] < -400)&&($product_info['products_quantity'] > -500)) {
?>
<tr>
  <td><span class="markProductOutOfStock"><b>Custom Message Here</b></span></td>
</tr>
<tr>
  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
}
?>
<!--eof stock announcement-->

 

In this case, items that have a quantity of less than -400 and greater than -500 will display a custom message.

 

I plan on using this to create several different custom messages.

 

Is there any reason why I should NOT do it this way?

 

Best Regards, Ted :thumbsup:

Share this post


Link to post
Share on other sites
Thank you for your reply, but this is exactly the problem that I have. I had it switched off, but when I installed the contrib I had to switch it on because the contrib does need this information and does not work when it is switched off.

 

Kind regards,

Peter

 

 

 

It's in the install instructions -

 

 

7. - OPTIONAL: In you dont want to display the stock quantity in
		   product linting, do this:

---------------------------------------------------------------

In the same file catalog/includes/modules/product_listing.php

7.1 FIND this:

	$lc_text = TABLE_HEADING_QUANTITY;

REPLACE WITH:

//		$lc_text = TABLE_HEADING_QUANTITY;  //this change hidden the quantity heading title - star
	$lc_text = ''; //this change hidden the quantity heading title - end

7.2 FIND this:

		$lc_text = ' ' . $listing['products_quantity'] . ' ';

REPLACE WITH:

//			$lc_text = ' ' . $listing['products_quantity'] . ' '; // this hidden stock quantity of product - star
		$lc_text = ' '; // this hidden stock quantity of product - end

Share this post


Link to post
Share on other sites

Hi

 

I'm trying to add this module but am experiencing some problem when trying to change catalog/includes/modules/product_listing.php

 

As soon as i replace

 

case 'PRODUCT_LIST_QUANTITY':

$lc_align = 'right';

$lc_text = ' ' . $listing['products_quantity'] . ' ';

break;

 

with

 

//bof stock announcement

case 'PRODUCT_LIST_QUANTITY':

$lc_align = 'right';

if ((STOCK_CHECK == 'true')&&($listing['products_quantity'] < 1)) {

$lc_text = '<span class="markProductOutOfStock"><b>Out of Stock</b></span>';

} elseif ((STOCK_CHECK == 'true')&&($listing['products_quantity'] > 0 )) {

$lc_text = '<span class="markProductOutofStock"><b>In Stock</b></span>';

} else {

$lc_text = ' ' . $listing['products_quantity'] . ' ';

}

break;

//eof stock announcement

 

I get the following error message on my site

 

Parse error: syntax error, unexpected T_VARIABLE in /home/2953/gambit/www.m0jon.co.uk/public_html/catalog/includes/modules/product_listing.php on line 117

 

Any help would be great

(warning adult site)

Share this post


Link to post
Share on other sites

Hello,

 

Thanks for the contribution, but I am running into some issues and have installed it three times (v1.22). I have set configuration to settings of manual, and all items have stock. When I click on the item from "Whats New In August" it brings up the product, shows correct status, "In Stock". But anywhere else this product is viewed from, directly from categories, doing a search, speicals ect it shows "Out Of Stock", and buy it now button is removed? Any help would be greatly appreciated. I am using this on the newest version, OSC MS2.2 RC1.

 

Thanks JR

Share this post


Link to post
Share on other sites

Hello,

 

Sorry, also forgot, in New Products View, date added: (but no info), and manufacture: (but no info)?

 

Thanks JR

Share this post


Link to post
Share on other sites

Does this contrib allow you to put a Out of Stock/In Stock image or message underneath the category picture to tell you if there are any items for sale in the category without having to click on it?

 

TIA

Share this post


Link to post
Share on other sites

Hi! Thank you for this great contribution. I've installed it smoothly on my website, but I have noticed a "bug".

 

It's true that this contrib prevents customers to buy any out of stock product. But if for example one customer wants to buy 5 items of product A (of wich I only have 3 items left in stock), there's nothing to prevent this >_< . So customers may complain that the osCommerce shop was showing "In stock" for that product, but they'll have to wait for reorder to have their order completed.

 

Could anyone help me adding a feature that alerts customers when they're adding to their chart more products than actually in stock?

 

Thanks a lot!

Share this post


Link to post
Share on other sites

I jut installed the latest version of this great contribution, however having a slight problem.

 

I am using Easy Populate and when I set the quantity for an item in Easy Populate to 0, and upload, the item's "product status" in admin shows as "out of stock". So after each upload, I have to goto admin, find those products with zero quantity and change the "Product Status" to "In stock" for this contribution to work.

 

In Easy Populate there is a v_status column, and I tried both "Active" and "Inactive" in this column with no luck; i.e. still I have to goto admin and change the "products status" to "In Stock" for this contribution to work.......would appreciate any resolution to this......many thanks

Share this post


Link to post
Share on other sites

Having a slight problem with the "Sold Out (but displayed)" contribution.

 

I am using Easy Populate and when I set the quantity for an item in Easy Populate to 0, and upload, the item's "product status" in admin shows as "out of stock". So after each upload, I have to goto admin, find those products with zero quantity and change the "Product Status" to "In stock" for this contribution to work.

 

In Easy Populate there is a v_status column, and I tried both "Active" and "Inactive" in this column with no luck; i.e. still I have to goto admin and change the "products status" to "In Stock" for this contribution to work.......would appreciate any resolution to this......many thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×