Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do you redirect one product to another product?


Guest

Recommended Posts

Posted

Anyone know how to redirect a product in the catalog to another product in the catalog?

Posted
Anyone know how to redirect a product in the catalog to another product in the catalog?

 

 

Redirect as in an HTTP redirect? Why would you want to do this?

 

I can only think that maybe you have a product you'd like listed in multiple categories. In which case, you may create them as linked products. One product, multiple "locations."

 

If not, describe what it is you want to do.

Contributions

 

Discount Coupon Codes

Donations

Posted
Redirect as in an HTTP redirect? Why would you want to do this?

 

I can only think that maybe you have a product you'd like listed in multiple categories. In which case, you may create them as linked products. One product, multiple "locations."

 

If not, describe what it is you want to do.

 

Hi, HTTP redirect, its for Google, I dont want to delete the product from the catalog (well there are a few that need deleted) becuase I done that before and got punished (my site dropped out of Googles index).

My site just got indexed again by Google so I dont want to take any chances and delete any products or change urls so redirecting the products I dont want to new products is the way to go I think but I dont know how to do it? I have a redirect option in my control panel from my host but it does not work with scripts, so I need something that will work with the http:......php....script if that makes sence?

Posted

Anybody know how to do it, must be something simple?

Posted

You hosting package usually gives you the means to do it. For example, if you are using cPanel, then you just have to click on the "redirects" button and then set it up. Otherwise, try asking your hosting provider.

 

--Peter

CE PHOENIX SUPPORTER

Support the Project, go PRO and get access to certified add ons

Full-time I am a C-suite executive of a large retail company in Australia. In my spare time, I enjoying learning about web-design.

Download the latest version of CE Phoenix from gitHub here

Posted
You hosting package usually gives you the means to do it. For example, if you are using cPanel, then you just have to click on the "redirects" button and then set it up. Otherwise, try asking your hosting provider.

 

--Peter

 

The redirects button in my cPanel will only redirect php files it wont redirect scripts, how would you redirect a script (ie the product url)?

Posted

No need to redirect.

 

product_info.php at the very top

// array: 'old' => 'new'
$redirect_ids = array( '3' => '12', '53' => '45' );

if( isset( $redirect_ids[ $HTTP_GET_VARS['products_id'] ] ) ) {
 $products_id = $redirect_ids[ $HTTP_GET_VARS['products_id'] ];
}

 

Then replace all other occurances of $HTTP_GET_VARS['products_id'] with $products_id.

 

(this is untested, but I think it should work)

Contributions

 

Discount Coupon Codes

Donations

Posted
No need to redirect.

 

product_info.php at the very top

// array: 'old' => 'new'
$redirect_ids = array( '3' => '12', '53' => '45' );

if( isset( $redirect_ids[ $HTTP_GET_VARS['products_id'] ] ) ) {
 $products_id = $redirect_ids[ $HTTP_GET_VARS['products_id'] ];
}

 

Then replace all other occurances of $HTTP_GET_VARS['products_id'] with $products_id.

 

(this is untested, but I think it should work)

 

kgt thanks alot for your help could you advise on one more thing please, where would I put the url's in the code? To redirect www.mywebsite.com/catalog/product_info.php?pName=regulator to www.mywebsite.com/catalog/product_info.php?pName=fpr could you add those two urls into your code please? And for more than one redirect I would just add the code again but with different urls?

Posted

The code I gave you should work, though you will obviously need to change some things. If you don't understand how it works, you can ask for clarification.

 

// array: 'old' => 'new'
$redirect_ids = array( 'regulator' => 'fpr', 'product1' => 'product2' );

if( isset( $redirect_ids[ $HTTP_GET_VARS['pName'] ] ) ) {
$pName = $redirect_ids[ $HTTP_GET_VARS['pName'] ];
}

Contributions

 

Discount Coupon Codes

Donations

Posted
The code I gave you should work, though you will obviously need to change some things. If you don't understand how it works, you can ask for clarification.

 

// array: 'old' => 'new'
$redirect_ids = array( 'regulator' => 'fpr', 'product1' => 'product2' );

if( isset( $redirect_ids[ $HTTP_GET_VARS['pName'] ] ) ) {
$pName = $redirect_ids[ $HTTP_GET_VARS['pName'] ];
}

 

Hi it didnt work, 9 $HTTP_GET_VARS['products_id'] need chaned to $products_id in the product_info.php page but the 8 and 9th near the bottom cause sytax errors, i tried changing the code and omiting the brakets but that just caused different errors. Any ideas?

Posted
Hi it didnt work, 9 $HTTP_GET_VARS['products_id'] need chaned to $products_id in the product_info.php page but the 8 and 9th near the bottom cause sytax errors, i tried changing the code and omiting the brakets but that just caused different errors. Any ideas?

 

No. You need to show your code and the exact syntax error.

Contributions

 

Discount Coupon Codes

Donations

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...