Guest Posted July 25, 2006 Share Posted July 25, 2006 I want to be able to redirect a page to another domain if the product is sold out. But it won't always be the same domain. I'm selling articles about different subjects. So if someone buys my article about printing pictures, I want to be able to redirect the search engine traffic to wherever the customer publishes the article. I had thought I would be able to do this with a simploe redirect, but it looks like I can't redirect dynamic pages, so now I'm trying to figure out how to do it via PHP. Any suggestions on where to start? I couldn't find any contributions that would do it. Link to comment Share on other sites More sharing options...
Guest Posted July 26, 2006 Share Posted July 26, 2006 I think I'm getting somewhere with it. I've finally gotten it to redirect somewhere by using an if statement in the product header....almost the same if statement used in the body to display "no products here". The problem is, I'm a total newbie with sql. So i create a field in the table - product_descriptions and call it red_url Now, I have to figure out how to get product_info.php to look at that field and if it's NOT empty, then redirect to the url listed there. ANY help would be appreciated. I'll contribute it once I get it all straight. Here's what I have, and it's not looking up the information: $product_red_query = tep_db_query("select red_url from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); if ($product_red_query != "") { Header( "Location: $product_red_query" ); Link to comment Share on other sites More sharing options...
cannuck1964 Posted July 26, 2006 Share Posted July 26, 2006 well you do not need to use both tables in the query. The red_url is in one or the other, so just query the one table to optimize it. if you are using different urls for different languages, then this info should be in the products_description table, else it should be in the products table if only one url is associated with the product. Next, you need to use: $product_red = tep_db_fetch_array($product_red_query) and Header( "Location: " . $product_red['red_url'] ); you need to make sure that the http:// is added to the url either in the DB or after.... I have not tested this, but it looks good ;) cheers, Peter M Peter McGrath ----------------------------- See my Profile (click here) for more information and to contact me for professional osCommerce support that includes SEO development, custom development and security implementation Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.