Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

HTTP_GET_VARS


Guest

Recommended Posts

Hi guys,

 

In the search friedly mode the variables are written like:

www.domainname/catalog/product_info.php/products_id/516 ( with / )

 

which is to sustitute the usual:

www.domainname/catalog/product_info.php?products_id=516 (with ? and = )

 

How can I call a variable from the search friedly mode

www.domainname/catalog/product_info.php/products_id/516

 

I tried: $HTTP_GET_VARS['products_id'] but it deosn't work

 

I am not talking to call it in existing oscommerce files but in brand new .php file I create.

There seems to be some extra code which interprets the / instead of ? and =

 

I hope I make myself clear.

 

Many Thanks

Link to comment
Share on other sites

Hi guys,

 

In the search friedly mode the variables are written like:

www.domainname/catalog/product_info.php/products_id/516 ( with / )

 

which is to sustitute the usual:

www.domainname/catalog/product_info.php?products_id=516 (with ? and = )

 

How can I call a variable from the search friedly mode

www.domainname/catalog/product_info.php/products_id/516

 

I tried: $HTTP_GET_VARS['products_id'] but it deosn't work

 

I am not talking to call it in existing oscommerce files but in brand new .php file I create.

There seems to be some extra code which interprets the / instead of ? and =

 

I hope I make myself clear.

 

Many Thanks

One is not related to the other. Switch user friendly mode off and check if you than get the products_id. As you are talking about a new file the problem is probably the products_id is simply not known anymore when you call that page. You have to pass it on to any new pages you are calling from the product info.

Link to comment
Share on other sites

One is not related to the other. Switch user friendly mode off and check if you than get the products_id. As you are talking about a new file the problem is probably the products_id is simply not known anymore when you call that page. You have to pass it on to any new pages you are calling from the product info.

 

Thanks but if I don't want to switch the search engine friendly mode. The reason I need to do that is because I have some products indexed by google belonging to a certain directory.

I have moved the files from that directory.

So by the time google updates the index i'd like to redirect the users to the right directory. As it happens the products are indexed by google with search friendly mode.

 

If the file product_info.php can read the variable from a string like

www.domainname/catalog/product_info.php/products_id/516

surely there must a piece of scipt which interprets it.

 

Simply I pass the value 516 of a variable called products_id

but just by writing $HTTP_GET_VARS['products_id']

it doesn't do the trick.

 

Hope it's clearer now.

Link to comment
Share on other sites

Thanks but if I don't want to switch the search engine friendly mode. The reason I need to do that is because I have some products indexed by google belonging to a certain directory.

I have moved the files from that directory.

So by the time google updates the index i'd like to redirect the users to the right directory. As it happens the products are indexed by google with search friendly mode.

 

If the file product_info.php can read the variable from a string like

www.domainname/catalog/product_info.php/products_id/516

surely there must a piece of scipt which interprets it.

 

Simply I pass the value 516 of a variable called products_id

but just by writing $HTTP_GET_VARS['products_id']

it doesn't do the trick.

 

Hope it's clearer now.

I didn't mean to tell to switch it of permanently, just shortly to see it doesn't make a difference for your problem as it is not related to that. What I wanted to say is that the var products_id is not known on all pages in your shop. If you are going to use it elsewhere you have to pass it specifically from the product info page where it is known.

Link to comment
Share on other sites

Howard, thank you again for the reply. let me try to explain again.

 

The reference comes from a page on Google and it looks like this:

www.domainname/catalog/product_info.php/products_id/516

 

now I have renamed the 'catalog' directory to something more relevant, like 'wine'

I still keep the 'catalog' directory but I want to place a file called product_info.php (like the original)

which will gather the variable products_id and redirect the user to

www.domainname/wine/product_info.php/products_id/516

where the actual product info can be viewed.

 

My problem is that I don't know how to call that reference if it string uses / instead of ? and =

 

do you see what I mean now?

Link to comment
Share on other sites

Howard, thank you again for the reply. let me try to explain again.

 

The reference comes from a page on Google and it looks like this:

www.domainname/catalog/product_info.php/products_id/516

 

now I have renamed the 'catalog' directory to something more relevant, like 'wine'

I still keep the 'catalog' directory but I want to place a file called product_info.php (like the original)

which will gather the variable products_id and redirect the user to

www.domainname/wine/product_info.php/products_id/516

where the actual product info can be viewed.

 

My problem is that I don't know how to call that reference if it string uses / instead of ? and =

 

do you see what I mean now?

yep, I understand what you want to achieve now but my answer for the whole http_get_vars story still applies. Even more now because there is no var from the shop at all. What you have is an url and you have to cut it in pieces yourself to fetch the productid. Shouldn't be difficult as you take the last occurence of / and everything behind is your productid.

Link to comment
Share on other sites

aha, that's the explanation then.

how do I chop it is the question though? I am not very proficient with php.

 

Your help would be much appreciated. Thanks again.

Link to comment
Share on other sites

aha, that's the explanation then.

how do I chop it is the question though? I am not very proficient with php.

 

Your help would be much appreciated. Thanks again.

Use something like this to get the last part of the url:

		  <?php
	  $url_string = 'www.domainname/catalog/product_info.php/products_id/516';
	  $product_id = substr(strrchr($url_string, '/'), 1 );
//		  echo $product_id;
	  ?>

This assumes the url is always ending with a product number and by no means fool proof !!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...