Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Show Sold Out Items.


enigmabunny

Recommended Posts

hey guys, i installed this contribution months ago, but have only just noticed that it is not working correctly. basically when you view a product, it does what its meant to and the buy now button changes to soldout and cant let the customer add to basket, but when viewing items in their categories it still says buy now and lets the user add it to basket, im sure it wasnt doing this before so not sure if its something to do when i restored the database recently. any one have any idea how to fix this??

Link to comment
Share on other sites

Reapply the contribution.

 

If you restored the db it should have no impact on the code.

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

  • 5 months later...
hey guys, i installed this contribution months ago, but have only just noticed that it is not working correctly. basically when you view a product, it does what its meant to and the buy now button changes to soldout and cant let the customer add to basket, but when viewing items in their categories it still says buy now and lets the user add it to basket, im sure it wasnt doing this before so not sure if its something to do when i restored the database recently. any one have any idea how to fix this??

 

 

I have a similar issue... only I didn't alter my database at all. The "buy now" button is still visible in the product listing view. Has anyone found a fix for this or have any suggestions?

 

Thanks

Link to comment
Share on other sites

Ok, I figured out why this wasn't working for me. I have combined my "buy now" button with the product price so they show in the same column so the changes this contribution calls for are not possible from this angle.

 

The code that combines my "buy now" button and the product price into the same column is this:

case 'PRODUCT_LIST_PRICE':
           $lc_align = 'center';
           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"><br>' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> <br><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>';
           } else {
             $lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' <br><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>';
           }
           break;

 

 

Now, for this contribution to work for me I need to figure out how to add this to it:

if($listing['products_quantity'] <= 0 || $listing['products_status']==0)
$lc_text = tep_image_button('button_sold_out.gif', IMAGE_BUTTON_SOLD_OUT) . ' ';
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> ';

 

Does anyone have any suggestions on how I can merge these two bits of code together? Any help would be appreciated. Thanks again.

 

Edit: Sorry, I didn't mean to have the code box show up like that. I'm afraid I don't know how to make the code boxes shorter.

Edited by DimeNote
Link to comment
Share on other sites

I think I got it. This is what I ended up with....

 

 

case 'PRODUCT_LIST_PRICE':
           $lc_align = 'center';
           if (tep_not_null($listing['specials_new_products_price']) and ($listing['products_quantity'] >= 1)) {
             $lc_text = ' <s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s> <span class="productSpecialPrice"><br>' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> <br><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>';

        } elseif (tep_not_null($listing['specials_new_products_price']) and ($listing['products_quantity'] <= 0 || $listing['products_status']==0)) {
             $lc_text = ' <s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s> <span class="productSpecialPrice"><br>' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> <br>' . tep_image_button('button_sold_out.gif', IMAGE_BUTTON_SOLD_OUT) . ' ';

           } elseif ($listing['products_quantity'] <= 0) {
$lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' <br> ' . tep_image_button('button_sold_out.gif', IMAGE_BUTTON_SOLD_OUT) . ' ';

           } else {
             $lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' <br><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>';
           }

 

Does this look PHP friendly? It seems to work perfectly on my shop... Thanks again.

Link to comment
Share on other sites

  • 2 months later...

Nice to see there is support for this contrib.

Wonder if this can be tagged as the support thread for it, as it seems to be making a lazurus...

 

Here is where I am at, and maybe someone can shed some light on completing my update...

 

In the Show sold out items contrib:

http://addons.oscommerce.com/info/4884

 

I have merged the core Sold out items contrib, & out of stock/notify me when available function, to work with the QPBPP contrib:

http://addons.oscommerce.com/info/1242

 

I see there is a new addition since I started my work...so I will also merge the SSO in reviews component when I get a chance.

 

One thing I noticed, was when an item was in a category breakout page, it still showed as sold out, where I think showing out of stock/notify me when available is a better option (we go thru a lot of hot melt glue this time of year).

 

I have the image working and you can select it.

But it is added to, and the customer is taken to the cart...which it should not do.

Additionally it is NOT added to the notifications page.

 

Please note the change at lines 131-136

Here is the code as I have it:

<?php
/*
$Id: product_listing.php,v 1.44 2003/06/09 22:49:59 hpdl Exp $
adapted for QPBPP v1.2.0 2006/12/23

osCommerce, Open Source E-Commerce Solutions
[url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

Copyright © 2003 osCommerce

Released under the GNU General Public License
*/

$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
</tr>
</table>
<?php
}

$list_box_contents = array();

for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
switch ($column_list[$col]) {
case 'PRODUCT_LIST_MODEL':
$lc_text = TABLE_HEADING_MODEL;
$lc_align = '';
break;
case 'PRODUCT_LIST_NAME':
$lc_text = TABLE_HEADING_PRODUCTS;
$lc_align = '';
break;
case 'PRODUCT_LIST_MANUFACTURER':
$lc_text = TABLE_HEADING_MANUFACTURER;
$lc_align = '';
break;
case 'PRODUCT_LIST_PRICE':
$lc_text = TABLE_HEADING_PRICE;
$lc_align = 'right';
break;
case 'PRODUCT_LIST_QUANTITY':
$lc_text = TABLE_HEADING_QUANTITY;
$lc_align = 'right';
break;
case 'PRODUCT_LIST_WEIGHT':
$lc_text = TABLE_HEADING_WEIGHT;
$lc_align = 'right';
break;
case 'PRODUCT_LIST_IMAGE':
$lc_text = TABLE_HEADING_IMAGE;
$lc_align = 'center';
break;
case 'PRODUCT_LIST_BUY_NOW':
$lc_text = TABLE_HEADING_BUY_NOW;
$lc_align = 'center';
break;
}

if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {
$lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);
}

$list_box_contents[0][] = array('align' => $lc_align,
'params' => 'class="productListing-heading"',
'text' => ' ' . $lc_text . ' ');
}

if ($listing_split->number_of_rows > 0) {
$rows = 0;
$listing_query = tep_db_query($listing_split->sql_query);
while ($listing = tep_db_fetch_array($listing_query)) {
$rows++;

if (($rows/2) == floor($rows/2)) {
$list_box_contents[] = array('params' => 'class="productListing-even"');
} else {
$list_box_contents[] = array('params' => 'class="productListing-odd"');
}

$cur_row = sizeof($list_box_contents) - 1;

for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
$lc_align = '';

switch ($column_list[$col]) {
case 'PRODUCT_LIST_MODEL':
$lc_align = '';
$lc_text = ' ' . $listing['products_model'] . ' ';
break;
case 'PRODUCT_LIST_NAME':
$lc_align = '';
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';
} else {
$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> ';
}
break;
case 'PRODUCT_LIST_MANUFACTURER':
$lc_align = '';
$lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> ';
break;
case 'PRODUCT_LIST_PRICE':
$lc_align = 'right';
$pf->parse($listing);
$lc_text = $pf->getPriceStringShort();
break;
case 'PRODUCT_LIST_QUANTITY':
$lc_align = 'right';
$lc_text = ' ' . $listing['products_quantity'] . ' ';
break;
case 'PRODUCT_LIST_WEIGHT':
$lc_align = 'right';
$lc_text = ' ' . $listing['products_weight'] . ' ';
break;
case 'PRODUCT_LIST_IMAGE':
$lc_align = 'center';
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
} else {
$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
}
break;
case 'PRODUCT_LIST_BUY_NOW':
$lc_align = 'center';
// Merged Out of Stock/Notify
if ($listing['products_quantity'] > 0 )
$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> ';
else
$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=notify, $request_type') . '">' . tep_image_button('button_out_notify.gif', BOX_HEADING_NOTIFICATIONS) . '</a> ';
// END Merged Out of Stock/Notify
break;
}

$list_box_contents[$cur_row][] = array('align' => $lc_align,
'params' => 'class="productListing-data"',
'text' => $lc_text);
}
}

new productListingBox($list_box_contents);
} else {
$list_box_contents = array();

$list_box_contents[0] = array('params' => 'class="productListing-odd"');
$list_box_contents[0][] = array('params' => 'class="productListing-data"',
'text' => TEXT_NO_PRODUCTS);

new productListingBox($list_box_contents);
}

if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
</tr>
</table>
<?php
}
?>

 

I thought adding this . $listing['products_id']

in line 135

$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=notify, $request_type' HERE) . '">' . tep_image_button('button_out_notify.gif', BOX_HEADING_NOTIFICATIONS) . '</a> ';

 

but it makes no difference.

 

Category breakout Notify me does not work here

An example of it in the category break out:

http://www.minionsweb.com/osStore/index.php?cPath=1_16_37_64

 

 

Stand alone IS working to add the notify me.

An example of it in its standalone listing -

http://www.minionsweb.com/osStore/product_...products_id=165

 

 

 

Any help would be appreciated.

Link to comment
Share on other sites

  • 3 months later...

I do not have the option in admin -> config to include or not to include sold out items.

 

In product listing, all products, regardless what category, displays the sold out button. I've checked and rechecked product_listing.php and it is the same as instructions.

 

Thanks for any help.

 

blr044

Link to comment
Share on other sites

Is there not a fix for this? Have tried all contributions for showing products when out.

 

I do not see in admin -> config for option of including or not including sold out items. Still for product listing all items show the sold out button.

 

This is something I been working on for over a week. At present time the code for modules/product_listing.php is comment out for now.

 

Really hope ther is an answer out there.

 

Thanks.

Link to comment
Share on other sites

Is there not a fix for this? Have tried all contributions for showing products when out.

 

I do not see in admin -> config for option of including or not including sold out items. Still for product listing all items show the sold out button.

 

This is something I been working on for over a week. At present time the code for modules/product_listing.php is comment out for now.

 

Really hope ther is an answer out there.

 

Thanks.

 

DUMP

 

Working fine now. Problem was it did not work with a SPPC addon. So i guess I will retry installing SPPC later and if it continues, I will post with SPPC thread.

Link to comment
Share on other sites

  • 11 months later...

hi team,

 

i'm posting with a request for help to get All-Products (http://addons.oscommerce.com/info/6216)

working with Sold Out. i posted on the all-products forum, but was

straight up denied (http://www.oscommerce.com/forums/topic/314262-all-products-seo/page__st__80)

 

here is the page i need help with...

 

http://www.nicholasbivins.com/store/all-products.php

 

for some reason all-products.php displays everything as already sold, when in fact, they are in-stock. all the other pages on the site display things correctly, its just this one page.

 

i am not a programmer by any stretch of the imagination, but i did notice that many of the $listing_sql commands are changed in the index.php, and the all-products file uses similar commands. i just have no idea where to begin or what to change.

thanks for any help you can give me, i really appreciate it. :rolleyes:

Link to comment
Share on other sites

  • 7 months later...

Hello,

 

My question is: shall we do somethink with database? As I could not find any instruction to amend it and I am getting this error:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' p.products_status from products p, products_description pd where p.products_id ' at line 1

 

select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_image_med, p.products_image_pop, p.products_image_description, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from, p.products_status from products p, products_description pd where p.products_id = '174' and pd.products_id = p.products_id and pd.language_id = '1'

 

[TEP STOP]

 

when I want to display detailed informations about any product.

 

Any ideas what is wrong? I will be appreciated if anyone could help me with it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...