Contributions

Other (Category Index)
Search: 

Add info via the URL

Adding information via the URL
====================================
Author: Craig Morton

History

v1.0: Original release

====================================
What does it do?
====================================
I wanted to be able to add information about a generic product via a hyperlink from a separate page.

In my case, I have a separate page outside OSCommerce with a list of courses and what days they are running. I didn't want to have to add every course on every date to my shop as that would be an administration nightmare. What I wanted was to be able to do was have a generic product that I can link to, and add the date information via the URL to the generic page.
====================================
How does it works?
====================================
Simply add the variable 'sinfo' (short for some info) to the end of your URL.

ie: A typical link directly to a product may look like this:

http://www.mywebsite.com/product_info.php?products_id=548&osCsid=281ad8f40dad47277a789ec279656fd8

Everything after the ? is a variable and is separated by & so simply add the variable sinfo with the required text. In my case the date of the course. Remember to use %20 for spaces.

http://www.mywebsite.com/product_info.php?products_id=548&osCsid=281ad8f40dad47277a789ec279656fd8&sinfo=Saturday%205th%20September%202005

The text will display at the top of your product info page as "Selected Date: Saturday 5th September 2005"

The info will also appear in the comments for the order after checkout (not during, and not on the invoice) as "product name - sinfo"

====================================
WOW, was crappy, messy, buggy code and a dumb way of doing it!!
====================================
I agree 100%

I am not a coder and I really fumbled my way through this. This is not the best way to do it as it uses a cookie to store the information. I would have prefered to link the information directly to the product and store it in the shopping cart, by hey.... I'm not that smart!!

This will lead to plenty of bugs, and infact I already know of several scenarios where this will fall apart.

Hopefully there is someone out there who is a lot smarter then me and can take my buggy code and fix it. If you want to....feel free!!

====================================
Special Thanks!!
====================================
Special thanks goes to Matti Ressler who pointed me in the direction of the comments variable. A simpy thing, but had me stumped for weeks. Thanks mate :)

====================================

Expand All / Collapse All

Add info via the URL spdive 13 Aug 2005

Adding information via the URL
====================================
Author: Craig Morton

History

v1.0: Original release

====================================
What does it do?
====================================
I wanted to be able to add information about a generic product via a hyperlink from a separate page.

In my case, I have a separate page outside OSCommerce with a list of courses and what days they are running. I didn't want to have to add every course on every date to my shop as that would be an administration nightmare. What I wanted was to be able to do was have a generic product that I can link to, and add the date information via the URL to the generic page.
====================================
How does it works?
====================================
Simply add the variable 'sinfo' (short for some info) to the end of your URL.

ie: A typical link directly to a product may look like this:

http://www.mywebsite.com/product_info.php?products_id=548&osCsid=281ad8f40dad47277a789ec279656fd8

Everything after the ? is a variable and is separated by & so simply add the variable sinfo with the required text. In my case the date of the course. Remember to use %20 for spaces.

http://www.mywebsite.com/product_info.php?products_id=548&osCsid=281ad8f40dad47277a789ec279656fd8&sinfo=Saturday%205th%20September%202005

The text will display at the top of your product info page as "Selected Date: Saturday 5th September 2005"

The info will also appear in the comments for the order after checkout (not during, and not on the invoice) as "product name - sinfo"

====================================
WOW, was crappy, messy, buggy code and a dumb way of doing it!!
====================================
I agree 100%

I am not a coder and I really fumbled my way through this. This is not the best way to do it as it uses a cookie to store the information. I would have prefered to link the information directly to the product and store it in the shopping cart, by hey.... I'm not that smart!!

This will lead to plenty of bugs, and infact I already know of several scenarios where this will fall apart.

Hopefully there is someone out there who is a lot smarter then me and can take my buggy code and fix it. If you want to....feel free!!

====================================
Special Thanks!!
====================================
Special thanks goes to Matti Ressler who pointed me in the direction of the comments variable. A simpy thing, but had me stumped for weeks. Thanks mate :)

====================================

Note: Contributions are used at own risk.