Guest Posted January 30, 2003 Share Posted January 30, 2003 I was looking through a Dell catalogue I received in the mail today and came across something that I haven't seen implemented on an oscommerce site. Next to each product in the printed catalogue they have a unique id, you go to their web site and enter the unique id in to a form box, click go and it takes you directly to the product. I am in Australia so the above may not be relevant to you. Does anyone here see a possible use for this type of arrangement as a contribution, it could work as either an infobox or as a separate oscommerce page you send them to. The unique id you would put next to your product in the printed catalogue (or email?) would simply be the products id within your oscommerce catalogue. Of course linking directly to the product_info.php page in this way won't include the directory hierarchy navigation stuff, but it is a nice way to give your customers direct access to a product using a supplied product number. Let me know if you would be interested in a contribution such as this. Quote Link to comment Share on other sites More sharing options...
gdfwilliams Posted January 30, 2003 Share Posted January 30, 2003 I've tested this to a degree, and it seems to work: This is the search box that your user will enter a Product Model # into: <form name="quick_find" method="get" action="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, '', 'NONSSL', false);?>"><input type="text" name="product_id" size="18" maxlength="40" value="<?php echo htmlspecialchars(StripSlashes(@$HTTP_GET_VARS["product_id"]));?>"> <?php echo tep_image_submit('go_button.gif', BOX_HEADING_SEARCH);?> </form> That passes a products_model variable to product_info.php, which will have to be modified to display an item based on products_model (by default it only displays based on product_id). Make these changes to product_info.php: Find(somewhere around line 60): <?php if ($HTTP_GET_VARS['products_id']){ $product_info = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_mediumimage, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.language_id = '" . $languages_id . "'"); } if (!tep_db_num_rows($product_info)) { // product not found in database ?> and replace with: <?php if ($HTTP_GET_VARS['products_id']){ $product_info = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_mediumimage, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.language_id = '" . $languages_id . "'"); } if ($HTTP_GET_VARS['products_model']){ $href_product_query = tep_db_query("select products_id as href_id from " . TABLE_PRODUCTS . " where products_model = '" . $HTTP_GET_VARS['products_model'] . "'"); $href_product = tep_db_fetch_array($href_product_query); define('HREF_PRODUCT_ID', $href_product['href_id']); $product_info = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_mediumimage, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_model = '" . $HTTP_GET_VARS['products_model'] . "' and pd.products_id = '" . HREF_PRODUCT_ID . "' and pd.language_id = '" . $languages_id . "'"); } if (!tep_db_num_rows($product_info)) { // product not found in database ?> Now, your product_info.php will display a product based when either product_id or products_model is passed in the URL. It's a start, anyway. Hope that helps. Good luck, Greg Quote Link to comment Share on other sites More sharing options...
gdfwilliams Posted January 30, 2003 Share Posted January 30, 2003 sorry, in the above, use this as your product_model entry form: <form method="get" action="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, '', 'NONSSL', false);?>"><input type="text" name="products_model" size="18" maxlength="40" value="<?php echo htmlspecialchars(StripSlashes(@$HTTP_GET_VARS["products_model"]));?>"> <?php echo tep_image_submit('go_button.gif', BOX_HEADING_SEARCH);?> </form> </brainfart> - Greg Quote Link to comment Share on other sites More sharing options...
gdfwilliams Posted January 30, 2003 Share Posted January 30, 2003 down-and-dirty prototype can be seen here: http://www.tibetcollection.com/prod_id_test.php Quote Link to comment Share on other sites More sharing options...
gdfwilliams Posted January 30, 2003 Share Posted January 30, 2003 finally, if all you're looking to do is redirect based on product_id, simply use this input form and make NONE of the product_info.php changes described above: <form method="get" action="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, '', 'NONSSL', false);?>"><input type="text" name="products_id" size="18" maxlength="40" value="<?php echo htmlspecialchars(StripSlashes(@$HTTP_GET_VARS["product_id"]));?>"></td> <td> <?php echo tep_image_submit('go_button.gif', BOX_HEADING_SEARCH);?> </form> 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.
Note: Your post will require moderator approval before it will be visible.