Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2012
    Posts
    9
    Plugin Contributions
    0

    Default Recommended method to capture GET parameters?

    All,

    What's the best way to capture a GET parameter passed when the main page is invoked similarly to http://site.here/index.php?main_page=index&a_parameter=some_value

    One way is to add a section to application_top.php, like this:

    if ( isset($_GET["a_parameter"]) )
    {
    $_SESSION["a_parameter"] = $_GET["a_parameter"];
    setcookie("a_parameter", $_GET["a_parameter"], time() + 60*60*24*3, "/");

    }


    While this works, it makes upgrades more complicated. Is there a better way, maybe in the form of attaching to a notification message? If I can keep the code outside of the standard application_top.php, upgrade would be simpler.

    Thanks!
    Last edited by lsb57; 17 Jan 2013 at 10:05 PM.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Recommended method to capture GET parameters?

    Lets back up WAY BACK TO THE BEGINNING.

    What are these GET parameters for anyway? What's the bigger picture business issue you're trying to address?
    What code are these GET parameters coming from?
    What exactly do yo mean by "method to capture"? Why are you trying to "capture"? What are you doing with this information? Why are you putting it into a session variable?
    It sounds like you're trying to alter custom code ... but haven't said what this custom code does.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Oct 2012
    Posts
    9
    Plugin Contributions
    0

    Default Re: Recommended method to capture GET parameters?

    It's affiliate related. I want to know which site referred my store. So the referring site will use a parameter in their link to my site - I need to capture that so I can track what orders are associated with the referral.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Recommended method to capture GET parameters?

    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Oct 2012
    Posts
    9
    Plugin Contributions
    0

    Default Re: Recommended method to capture GET parameters?

    Which indirectly will point to http://www.zen-cart.com/wiki/index.p...als#InitSystem.
    Perfect, exactly what I was looking for! Thanks a lot!

  6. #6
    Join Date
    Oct 2012
    Posts
    9
    Plugin Contributions
    0

    Default Re: Recommended method to capture GET parameters?

    On a second thought - is the global $db available at this stage? Say I want to have a configuration group for the autoloader?

  7. #7
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Recommended method to capture GET parameters?

    No .
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Replies: 1
    Last Post: 29 Aug 2013, 04:46 AM
  2. Products.php - Inserting data from get method?
    By Solarpitch in forum General Questions
    Replies: 3
    Last Post: 25 Aug 2008, 04:02 AM
  3. form get method?
    By redxiii in forum Addon Payment Modules
    Replies: 1
    Last Post: 10 Jan 2007, 09:31 AM
  4. Custom Dynamic Extra Pages with URL parameters, GET, POST - for Define and EZ Pages
    By bjoly in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 24 Jul 2006, 04:04 AM
  5. Can't get shipping to work (zone method)
    By therealex in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 18 Jun 2006, 08:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg