jamyers79 Posted August 16, 2005 Posted August 16, 2005 :blink: What I am trying to do is have it where if a customer searches for a bundle product I've created, that it gets redirected from the product_info.php page to a different page. I've been successful in getting it to do that with the code below. However, for any other product that is selected, it says that it can't be found and I'm fairly certain I need some kind of 'else statement' to make that happen. Can anyone help me with this? I'm not sure how to go about the 'else statement' part. require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO); $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, p.products_bundle 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 . "'"); $product_info = tep_db_fetch_array($product_info_query); if ($HTTP_GET_VARS['products_id'] == '598') { tep_redirect(tep_href_link(FILENAME_GAME_BUNDLE)); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" Please help! lol... I appreciate it. Thanks so much. :thumbsup:
♥Monika in Germany Posted August 16, 2005 Posted August 16, 2005 :blink: What I am trying to do is have it where if a customer searches for a bundle product I've created, that it gets redirected from the product_info.php page to a different page. I've been successful in getting it to do that with the code below. However, for any other product that is selected, it says that it can't be found and I'm fairly certain I need some kind of 'else statement' to make that happen. Can anyone help me with this? I'm not sure how to go about the 'else statement' part. require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO); $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, p.products_bundle 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 . "'"); ? $product_info = tep_db_fetch_array($product_info_query); if ($HTTP_GET_VARS['products_id'] == '598') { tep_redirect(tep_href_link(FILENAME_GAME_BUNDLE)); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" Please help! lol... I appreciate it. Thanks so much. :thumbsup: <{POST_SNAPBACK}> Hi Jamie, your code looks ok to me. I use the same ... this is from a file I have... if (isset($HTTP_GET_VARS['manufacturers_id'])) { if ($HTTP_GET_VARS['manufacturers_id'] == "-1") { tep_redirect(tep_href_link(FILENAME_DEFAULT)); } elseif ($HTTP_GET_VARS['manufacturers_id'] == "0") { tep_redirect(tep_href_link(FILENAME_ALL_BRANDS)); } } I put it right under the language file request though, no need to do the query if we are redirecting anyway ... can you show us the url where the error happens? :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
jamyers79 Posted August 16, 2005 Author Posted August 16, 2005 Hi Jamie, your code looks ok to me. I use the same ... this is from a file I have... if (isset($HTTP_GET_VARS['manufacturers_id'])) { if ($HTTP_GET_VARS['manufacturers_id'] == "-1") { tep_redirect(tep_href_link(FILENAME_DEFAULT)); } elseif ($HTTP_GET_VARS['manufacturers_id'] == "0") { tep_redirect(tep_href_link(FILENAME_ALL_BRANDS)); } } I put it right under the language file request though, no need to do the query if we are redirecting anyway ... can you show us the url where the error happens? <{POST_SNAPBACK}> Hello Monika. Thank you for responding. /product_info.php?products_id=598 That is the url I'm doing the redirect from... it's just that if the product ID = 598, it goes to a different page and otherwise it just goes to the regular product_info.php?products_id="#" So you are suggesting that I can accomplish this by putting something like your code into the language file?
♥Monika in Germany Posted August 16, 2005 Posted August 16, 2005 Hello Monika. Thank you for responding. /product_info.php?products_id=598 That is the url I'm doing the redirect from... it's just that if the product ID = 598, it goes to a different page and otherwise it just goes to the regular product_info.php?products_id="#" So you are suggesting that I can accomplish this by putting something like your code into the language file? <{POST_SNAPBACK}> nono, you misunderstood me ... put it at the very top of your page product_info.php before all other code starts, right under require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO); why did you modify the products_query? :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
jamyers79 Posted August 16, 2005 Author Posted August 16, 2005 nono, you misunderstood me ... put it at the very top of your page product_info.php before all other code starts, right under require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO); why did you modify the products_query? <{POST_SNAPBACK}> it was modified thru the Attributes Suite Contribution that I installed. And actually, that is right where the code is... require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO); $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, p.products_bundle 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 . "'"); $product_info = tep_db_fetch_array($product_info_query); if ($HTTP_GET_VARS['products_id'] == '598') { tep_redirect(tep_href_link(FILENAME_GAME_BUNDLE)); } elseif ($HTTP_GET_VARS['products_id'] == '') ?>
♥Monika in Germany Posted August 16, 2005 Posted August 16, 2005 it was modified thru the Attributes Suite Contribution that I installed. And actually, that is right where the code is... ?require('includes/application_top.php'); ?require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO); $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, p.products_bundle 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 . "'"); ? ?$product_info = tep_db_fetch_array($product_info_query); if ($HTTP_GET_VARS['products_id'] == '598') { tep_redirect(tep_href_link(FILENAME_GAME_BUNDLE)); } elseif ($HTTP_GET_VARS['products_id'] == '') ?> <{POST_SNAPBACK}> like I said tehre is no need for an else/elseif statement for you. Just place the redirect link before the query for performance. If you do not want to post your url here, pm it to me. :-) Monika addicted to writing code ... can't get enough of databases either, LOL! my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum Interactive Media Award July 2007 ~ category E-Commerce my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.