sackling Posted May 31, 2006 Share Posted May 31, 2006 Hello, I'm looking for a way to be able to redirect the links to the products listed on a search results page. The way i have my store set up is that i have a custom page for all my items i.e i did not use the oscommerce catalog. When you click on the links in the search it redirect you to the oscommerce catalog. is there anyway i can change the links? It would be best if i could enter the right links in the oscommerce admin, under Products URL and have the page automatically redirect to the "For more information, please visit this products webpage." page. any ideas on how to do this? thanks, Robert Link to comment Share on other sites More sharing options...
Guest Posted May 31, 2006 Share Posted May 31, 2006 Change the catalog\product_info.php Move the query code for the product near the beginning of the file so you should end up with something like this: $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, 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_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); if( tep_db_num_rows($product_info_query) ) { $product_info = tep_db_fetch_array($product_info_query); if(tep_not_null($product_info['products_url')) { header('Location: ' . $product_info['products_url'); tep_exit(); } } Once the visitor clicks details for a product he should be redirected to the products url site/page. Link to comment Share on other sites More sharing options...
sackling Posted May 31, 2006 Author Share Posted May 31, 2006 Change the catalog\product_info.php Move the query code for the product near the beginning of the file so you should end up with something like this: $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, 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_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); if( tep_db_num_rows($product_info_query) ) { $product_info = tep_db_fetch_array($product_info_query); if(tep_not_null($product_info['products_url')) { header('Location: ' . $product_info['products_url'); tep_exit(); } } Once the visitor clicks details for a product he should be redirected to the products url site/page. hmm Im not sure what you mean by "Move the query code for the product near the beginning of the file" but what i took from it is to edit the file and add in what you did which seems to be just if( tep_db_num_rows($product_info_query) ) { $product_info = tep_db_fetch_array($product_info_query); if(tep_not_null($product_info['products_url')) { header('Location: ' . $product_info['products_url'); tep_exit(); } } so i added it in there but i got some errors. first it said there was unexpected ( instead of ] so i changed it around products url both times. then i got a differant error stating: Parse error: parse error, unexpected T_STRING which i dont know what to do with. am i going about this wrong? Link to comment Share on other sites More sharing options...
Guest Posted May 31, 2006 Share Posted May 31, 2006 I missed the square brackets from the url field of the array. And I said to move the code at the beginning of the file. That includes the entire block of code and not to modify stuff after the html headers are sent because it's useless. So after these lines require('includes/application_top.php'); you add $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, 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_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); if( tep_db_num_rows($product_info_query) ) { $product_info = tep_db_fetch_array($product_info_query); if( tep_not_null($product_info['products_url']) ) { header('Location: ' . $product_info['products_url']); tep_exit(); } } Link to comment Share on other sites More sharing options...
sackling Posted May 31, 2006 Author Share Posted May 31, 2006 Ok that is working almost perfectly! just one thing, when it redirects me to the link it adds the entire url after the catalog directory so for example it redirects me to this: http://www.mysite/catalog/www.mysite.com/p...veralls/S45.htm how can i get it to replace the url in full? Link to comment Share on other sites More sharing options...
Guest Posted May 31, 2006 Share Posted May 31, 2006 Check the products url on the admin end, try entering there the product url like http://www.products_external_site.com and test it. Link to comment Share on other sites More sharing options...
sackling Posted May 31, 2006 Author Share Posted May 31, 2006 Check the products url on the admin end, try entering there the product url like http://www.products_external_site.com and test it. I just got it working by adding ../ in front of the URL worked perfectly thanks for your help! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.