ToyStore Posted September 18, 2007 Share Posted September 18, 2007 Hi all, I have this installed on my test site, and it is working on the catalog side of things. If anyone wants to see this contrib in action: http://www.gofuntoys.com/svns/test-shop/pr...ane-desk-2.html I wanted to post some code from my admin/categories.php file. I am not completely sure if this fix will work well in osC 2.2, but I was having issues where my admin screen was out of whack. The code for this section on my site is: <tr> <td class="maincol"><?php echo TEXT_PRODUCTS_QUANTITY; ?></td> <td class="maincol"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_quantity', $pInfo->products_quantity); ?></td> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <?php // BOF: Availability $availability_query = tep_db_query("select * from availability where language_id = '" . $languages_id . "'"); $availability_array = array(); while ($availability_tmp = tep_db_fetch_array($availability_query)) { $availability_array[] = array( 'id' => $availability_tmp['availability_id'], 'text' => $availability_tmp['availability_name']); }?> <td class="main"><?php echo TEXT_AVAIL1;?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('availability_id_in_stock', $availability_array, (!empty($pInfo->availability_id_in_stock)?$pInfo->availability_id_in_stock:1)); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_AVAIL2;?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('availability_id_out_of_stock', $availability_array, (!empty($pInfo->availability_id_out_of_stock)?$pInfo->availability_id_out_of_stock:2)) . ' <a href="' . tep_href_link(FILENAME_AVAILABILITY_OPTIONS) . '">'.TEXT_MANAGE_AVAIL_OPTIONS.'</a>'; ?></td> // EOF: Availability </td> </tr> I added the TEXT_AVAIL defines to my product_info.php english file. Not sure if this is useful to anyone since I have not tried this on my osC 2 test site, just my ecjc site which is a modified osC 2.2 RC1 for Joomla. Also to the original author, thanks for writing this bit of code. Do you think it would be hard to add images instead of text? I think I might try to go that route with this in the next few weeks. Also, I needed to install the sql manually, will I miss anything by not running the installer? Everything seems fine so I am sure it is, but I just wanted to touch base on it. Quote Link to comment Share on other sites More sharing options...
ToyStore Posted September 18, 2007 Share Posted September 18, 2007 Sorry you may not have class="maincol" so just change the first two to class="main" Quote Link to comment Share on other sites More sharing options...
Sohiab Posted November 7, 2007 Share Posted November 7, 2007 How Can I use this with the products Tab Item? It doesnt appear on the page Quote Link to comment Share on other sites More sharing options...
dawnmariegifts Posted December 8, 2007 Share Posted December 8, 2007 Hi, great contribution......Thanks! Would it be possible to show the product when it is marked out of stock by the admin and have the add to cart button grayed out and the availabillity option to say out of stock. As it is, if I mark the item out of stock, it shows product not found on the catalog side. Thank you. Quote DawnMarieGifts Link to comment Share on other sites More sharing options...
schlegk Posted January 4, 2008 Share Posted January 4, 2008 I have a problem that was mentioned several times, but I still haven't found a fix for it. The contribution works great in English: English: Availability: 1 in-stock But in both German and French I only see this: Availability: No quantities appear. Any ideas please? K works fine for me. have you inserted the other languages in the admin? show me a screen-shot of your Availability admin screen with all your languages added and a link to a misfunctioning product. Quote Link to comment Share on other sites More sharing options...
nafri Posted January 26, 2008 Share Posted January 26, 2008 i am using 2.2 rc1.. if i have two options ,, like %s in stock ..---- set to id 1 available for back order ...set to id 2 Now if i have a product with 10 items .. all i get is available for back order..Even though on the admin side i set it to use %s in stock for items in stock. if 1 remove available for back order then it does use the first id.. ..Cant seem to figure out whats wrong with it,, Kind regards nafri Quote Link to comment Share on other sites More sharing options...
candleman Posted February 8, 2008 Share Posted February 8, 2008 I'm having the same issue as the poster above me. I have this contrib installed and working nicely in my current store which is using the osCommerce version just prior to RC1. I'm redoing my store and I'm using RC2. That is the only difference besides a few less contributions in the new store. I have been over the install directions several times and everything seems in order. On the product info page it displays the out of stock message no matter what. I'm no coder, but I'm guessing maybe something having to do with the later version of osC is messing things up. Anyone have any suggestions? Quote Currently running 76 contibutions. Link to comment Share on other sites More sharing options...
partsace Posted April 7, 2008 Share Posted April 7, 2008 (edited) I want to add the availability to shopping_cart.php Is there any way to do this? The image is hard coded and not a working item. I need to do this so if someone uses the "Buy Now" button, they will see the availability before finding out later that it is not in-stock. Thanks, Scott Edited April 7, 2008 by partsace Quote Link to comment Share on other sites More sharing options...
surfalot Posted April 7, 2008 Author Share Posted April 7, 2008 (edited) I want to add the availability to shopping_cart.php Is there any way to do this? The image is hard coded and not a working item. I need to do this so if someone uses the "Buy Now" button, they will see the availability before finding out later that it is not in-stock. in catalog/shopping_cart.php find: $products_name .= ' </td>' . ' </tr>' . '</table>'; Just before it add: // BOF: Availability: Added: , availability_id_in_stock, availability_id_out_of_stock $avail_product_info_query = tep_db_query("select availability_id_in_stock, availability_id_out_of_stock, products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products[$i]['id'] . "'"); $avail_product_info = tep_db_fetch_array($avail_product_info_query); $availability_query = tep_db_query("select * from ".TABLE_AVAILABILITY." where language_id = " . $languages_id . " order by availability_id"); $availability_array = array(); while ($availability_tmp = tep_db_fetch_array($availability_query)) { $availability_array[$availability_tmp['availability_id']] = $availability_tmp['availability_name']; } $prod_quantity = tep_get_products_stock($products_id); if ($prod_quantity < 1) { $products_name .= "<p>".TABLE_HEADING_AVAILABILITY." ".sprintf($availability_array[$avail_product_info['availability_id_out_of_stock']],$avail_product_info['products_quantity'])."</p>"; } else { $products_name .= "<p>".TABLE_HEADING_AVAILABILITY." ".sprintf($availability_array[$avail_product_info['availability_id_in_stock']],$avail_product_info['products_quantity'])."</p>"; } // EOF: Availability in catalog/includes/languages/english/shopping_cart.php add: // BOF: Availability define('TABLE_HEADING_AVAILABILITY', 'Availability:'); // EOF: Availability before the closing ?> php tag. that will put it under the text. If you want it under the image you need to squeeze it in to this area as another row of this table, good luck! $products_name .= ' </td>' . ' </tr>' . '</table>'; Edited April 7, 2008 by surfalot Quote Link to comment Share on other sites More sharing options...
partsace Posted April 12, 2008 Share Posted April 12, 2008 (edited) 1146 - Table 'XXXXXX_db.TABLE_AVAILABILITY' doesn't exist select * from TABLE_AVAILABILITY where language_id = 1 order by availability_id [TEP STOP] I got this error when I tried the above. Scott Edited April 12, 2008 by partsace Quote Link to comment Share on other sites More sharing options...
surfalot Posted April 13, 2008 Author Share Posted April 13, 2008 I got this error when I tried the above. Scott you missed an entry in the includes/database_tables.php file. Quote Link to comment Share on other sites More sharing options...
schlegk Posted April 13, 2008 Share Posted April 13, 2008 you missed an entry in the includes/database_tables.php file. I'm getting the same error. It worked fine until I added the above code (putting the availability in the shopping cart). I'd love to get this section to work! Thanks, Karim Quote Link to comment Share on other sites More sharing options...
surfalot Posted April 13, 2008 Author Share Posted April 13, 2008 you missed an entry in the includes/database_tables.php file. add to includes/database_tables.php // BOF: Availability define('TABLE_AVAILABILITY', 'availability'); // EOF: Availability Quote Link to comment Share on other sites More sharing options...
confusedcart Posted July 7, 2008 Share Posted July 7, 2008 :angry:Hi Everyone... this contrib. is killing me!!!! I successfully installed it on my store on a localhost (for testing) -- It works PERFECTLY.. I then went live with everything (and checked everything 10x over - its exactly as on my local host) but for all stock levels it keeps giving me the 'OUT OF STOCK' message even when a product has 25pcs in stock.. It is working on the localhost, but not when I go live.. I checked the product_info page.. I cant see anything wrong.. Every product displays as out of stock.. And this is a great contrib.. I DONT KNOW WHAT TO DO PLEASE HELP!!!!!!!!!! ANYONE???? Quote Link to comment Share on other sites More sharing options...
surfalot Posted July 9, 2008 Author Share Posted July 9, 2008 :angry:Hi Everyone... this contrib. is killing me!!!! I successfully installed it on my store on a localhost (for testing) -- It works PERFECTLY.. I then went live with everything (and checked everything 10x over - its exactly as on my local host) but for all stock levels it keeps giving me the 'OUT OF STOCK' message even when a product has 25pcs in stock.. It is working on the localhost, but not when I go live.. I checked the product_info page.. I cant see anything wrong.. Every product displays as out of stock.. And this is a great contrib.. I DONT KNOW WHAT TO DO PLEASE HELP!!!!!!!!!! ANYONE???? osCommerce version? PHP version? MySQL version? any additional contributions that may conflict with? (for localhost and the production environments) Quote Link to comment Share on other sites More sharing options...
confusedcart Posted July 9, 2008 Share Posted July 9, 2008 osCommerce version?PHP version? MySQL version? any additional contributions that may conflict with? (for localhost and the production environments) Hi Todd, thanks for the reply.. I got it sorted already.. I changed that line of code to a STOCK_CHECK etc. It works!!! Great contrib!! Quote Link to comment Share on other sites More sharing options...
surfalot Posted July 9, 2008 Author Share Posted July 9, 2008 Hi Todd, thanks for the reply.. I got it sorted already.. I changed that line of code to a STOCK_CHECK etc. It works!!! Great contrib!! so... was it a problem with the contribution or your implementation? Quote Link to comment Share on other sites More sharing options...
BapeClothing Posted August 22, 2008 Share Posted August 22, 2008 Hello. I successfully installed this Contrib. I am using STS 4 and I am wanting to display the Quantity and "in stock" or "out of stock" on my STS template product_info page. What is the command to do this? Please help. Thanks. Quote Link to comment Share on other sites More sharing options...
BapeClothing Posted August 24, 2008 Share Posted August 24, 2008 Any one help me please? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
pedro.antunes Posted October 18, 2008 Share Posted October 18, 2008 (edited) Hi all, The contribution stopped working for me when I disabled REGISTER_GLOBALS in PHP. But here's the fix: Find: $prod_quantity = tep_get_products_stock($products_id); Replace by: $prod_quantity = tep_get_products_stock($product_info[products_id]); It seems that $products_id was comming from somewhere else, but without register_globals it's an unkown variable, so changing for $product_info[products_id] does the trick. Hope it helps... Edited October 18, 2008 by pedro.antunes Quote Link to comment Share on other sites More sharing options...
surfalot Posted October 30, 2008 Author Share Posted October 30, 2008 Hi all, The contribution stopped working for me when I disabled REGISTER_GLOBALS in PHP. But here's the fix: Find: $prod_quantity = tep_get_products_stock($products_id); Replace by: $prod_quantity = tep_get_products_stock($product_info[products_id]); It seems that $products_id was comming from somewhere else, but without register_globals it's an unkown variable, so changing for $product_info[products_id] does the trick. Hope it helps... thanks for that. Turns out this is a problem on both product_info.php and shopping_cart.php. Don't know what I was thinking there. v1.0.1 has been uploaded with the correct changes. Quote Link to comment Share on other sites More sharing options...
mrshadow924 Posted November 13, 2008 Share Posted November 13, 2008 Hi all, Thanks the great contribution, but I experienced an error code as below: 1146 - Table 'xxxxx.availability' doesn't exist select count(*) as total from availability And I have already checked the entry as Todd Holforty mentioned in includes/database_tables.php and the admin/availability_configurer.php didn't worked when I clicked Run Configuration Utility button. Could someone support the MySQL code to allow me to built "TABLE avavailability" and "Column availability_id_in_stock、availability_id_out_of_stock in Table products" manually? Thanks in advance :) Quote Link to comment Share on other sites More sharing options...
surfalot Posted November 13, 2008 Author Share Posted November 13, 2008 did you get an error with the configurer? CREATE TABLE availability ( availability_id int(11) NOT NULL default '1', language_id int(11) NOT NULL default '1', availability_name varchar(84) NOT NULL default '', PRIMARY KEY (availability_id,language_id) ); INSERT INTO `availability` VALUES (1, 1, '%s in stock.'); INSERT INTO `availability` VALUES (2, 1, 'Temporarily out of stock.'); INSERT INTO `availability` VALUES (3, 1, 'In stock, usually ships within 1 to 3 days.'); INSERT INTO `availability` VALUES (4, 1, 'In stock, usually ships within 4 to 7 days.'); INSERT INTO `availability` VALUES (5, 1, 'Temporarily out of stock, restocking is expected shortly.'); INSERT INTO `availability` VALUES (6, 1, 'Special order, arrival dates may vary.'); INSERT INTO `availability` VALUES (7, 1, 'Made to order.'); INSERT INTO `availability` VALUES (8, 1, 'Made to order, usually ships within 3 to 7 days.'); INSERT INTO `availability` VALUES (9, 1, 'Made to order, usually ships within 7 to 14 days.'); ALTER TABLE products ADD availability_id_in_stock int(11) default '1' AFTER products_quantity; ALTER TABLE products ADD availability_id_out_of_stock int(11) default '2' AFTER availability_id_in_stock; Quote Link to comment Share on other sites More sharing options...
mrshadow924 Posted November 14, 2008 Share Posted November 14, 2008 Thanks for the quick reply :P When I clicked the "Run Configuration Utility" button and then the admin panel just showing the initial "Login" page. I guess the contribution "Admin Login" is not compatible with "Availability". Anyway it seemed working well after I added the codes to my database. regards, Quote Link to comment Share on other sites More sharing options...
mrshadow924 Posted November 19, 2008 Share Posted November 19, 2008 Dear Todd Holforty, Sorry for bothering you again. Referring to your source code stated below, would you please help me to modify the code only for the line marked in red to the status " if purchasing quantity > in stock quantity". I have tried all my best but failed. Appreciate your help and hope it would also benefit to others who have same need. if ($avail_product_info['products_quantity'] < 1) { $products_name .= "<p>".TABLE_HEADING_AVAILABILITY." ".sprintf($availability_array[$avail_product_info['availability_id_out_of_stock']],$avail_product_info['products_quantity'])."</p>"; } else { $products_name .= "<p>".TABLE_HEADING_AVAILABILITY." ".sprintf($availability_array[$avail_product_info['availability_id_in_stock']],$avail_product_info['products_quantity'])."</p>"; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.