Results 1 to 2 of 2

Hybrid View

  1. #1

    Default How to reference a browser cookie variable in custom code from classes/order.php

    Hello Folks:

    I am struggling with a minor customization to my Zencart implementation, that I was hoping someone might have an answer to.

    I have customized classes/order.php to be able to do some custom order processing for each sold product (there are comments in the 1.39h version showing easily where to add such custom code.)

    All is working very well, but now I would like to add one more thing. I would like to be able to reference a browser cookie in this custom code location and use it. This is a browser cookie set for my domain, the same domain the store is hosted on.

    I am trying to reference it as follows: $_COOKIE["DeepNetRefID"]

    The problem is that $_COOKIE is actually not set at all (sending along print_r( $_COOKIE ) generates nothing), at this point in the code. Hunting through the code for $_COOKIE references, it might be that the browser cookies are explicitly unset in includes/init_includes/init_sanitize.php. I tried commenting out the cookie clearing code here, but that did not help.

    I also tried grabbing the cookie in includes/application_top.php, saving it in a global, and referencing it in must order.php custom code... no luck.

    Any ideas, or reason why the $_COOKIE global has been nuked at this point in the code?

    Thanks in advance,

    Dan Pronovost
    [email protected]

  2. #2

    Default Re: How to reference a browser cookie variable in custom code from classes/order.php

    After exploring this more, and trying out a different browser (IE, instead of Firefox), I noticed that the bug did not occur!

    On closer examination, the problem was that the cookie I was setting was for the domain 'www.deepnettech.com', and Zencart often uses default path 'http:deepnettech.com/estore...'. These are different cookie settings.

    So, I changed where I set the cookies up in the first place, to set the domain as '.deepnettech.com', so that they work generically!

    So, init_sanitize.php was a red herring! Sorry folks.

 

 

Similar Threads

  1. access a custom static class variable in tpl_checkout_stacked.php?
    By tcarden in forum Addon Shipping Modules
    Replies: 0
    Last Post: 4 Jul 2013, 01:16 AM
  2. Replies: 1
    Last Post: 8 Feb 2011, 02:07 AM
  3. Problem with Carryover of Cookie with custom code
    By Ampboy in forum General Questions
    Replies: 0
    Last Post: 6 Sep 2010, 10:25 PM
  4. Pass variable from link to Discount Coupon Code
    By MrForce in forum General Questions
    Replies: 0
    Last Post: 17 Apr 2008, 06:07 AM
  5. PhP question about a line of code in includes/classes/order.php
    By dbrewster in forum Managing Customers and Orders
    Replies: 12
    Last Post: 1 Feb 2007, 03:30 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR