Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Not getting products_quantity for my script


jswan

Recommended Posts

Hi folks:

 

I'm really stumped on this one. I am working on a cart that has the "Loginviewprice" and the "No Stock No Checkout" contributions installed. After I got them installed I ran into a problem with the list of products that comes up when there are multiple products in a category. All products, whether they are in stock or not show the "Product out of stock" message. After tweaking the code in catalog/includes/modules/product_listing.php for several hours, I still cannot see where the problem is coming from. Here is the code that handles the "Buy It Now" column:

 

 
case 'PRODUCT_LIST_BUY_NOW':
 $lc_align = 'center';
 if ($listing['products_quantity'] == 0) {
   $buy_now_button = tep_image_button('button_buy_now_na.gif', IMAGE_BUTTON_BUY_NOW_NA) . ' ';
 } else {
   $buy_now_button = '<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> ';
 }
?	
 if (PRICES_LOGGED_IN == 'false') {
   $buy_now_button_d = $buy_now_button;
 }
?	
 if ( (PRICES_LOGGED_IN == 'true') && (!tep_session_is_registered('customer_id'))) {
   $buy_now_button_d = '<a href="' . tep_href_link(FILENAME_LOGIN, '','SSL') . '">' ?. PRICES_LOGGED_IN_BUY_TEXT . '</a> ';
 } ?else {
   $buy_now_button_d = $buy_now_button;
 }
 $lc_text = $buy_now_button_d;
 break;

 

Now, I did have to modify the standard "No Stock..." contribution code a bit to work around the code I installed for the "Login to see prices" contribution. But, the logic seem OK to me. What I want the code to do is check products_quantity in the DB. If that number is "0" then I want it to assign the "Out of stock" graphic to the $buy_now_button variable. If the product_quantity value is not "0" then I want it to assign the regular "Buy It Now" code to the variable $buy_now_button. Ultimately, the $buy_now_button variable is used to determine the outbut ($lc_text).

 

Now, the wierd thing is that when I change the code so that

$lc_text = $listing[products_quantity];

nothing is displayed in the browser. The table cells that would normally be drawn to hold that input are not there in the final code. Wierd!

 

Anyway, please let me know if there is something obvious that I am missing. The contributions work well, otherwise.

 

Thanks!

 

Jason

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...