Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2007
    Posts
    17
    Plugin Contributions
    0

    help question Help with Cookie Setting Mod Problem

    Hi there,

    So, my company is wanting to do target "sell pages" on other sites and have them link directly to the shopping cart and add the item at the same time. OK I found out how to do that thanks to this thread: http://www.zen-cart.com/forum/showthread.php?t=61008

    Then I needed to find a way to hide some things on the page if the user is coming from a "sell page" because my boss doesn't want them to be able to navigate out of the "buying" path.

    So here's what I did. The form that submits directly to the shopping cart is coded like so:

    PHP Code:
    <h2>CLICK TO BUY</h2>
    <
    form name="cart_quantity" action="http://www.mysite.com/store/index.php?main_page=product_info&amp;products_id=2&amp;action=add_product" method="post" enctype="multipart/form-data">
    <
    input type="hidden" name="cart_quantity" value="1" />
    <
    input type="hidden" name="products_id" value="2" />
    <
    input type="hidden" name="sell_page" value="1" />
    <
    input type="submit" value="BUY NOW!" /> 

    That works great to put the item directly in to the cart. Then I made a change to html_header.php so that it looks for the "sell_page" variable in the request and if it's there sets a cookie like so:
    PHP Code:
    // MOD IF THIS PERSON CAME FROM A SELL PAGE SET A COOKIE FOR THAT
    if (!empty($_REQUEST['sell_page'])) {
        
    setCookie("sell_page""1");


    Then I proceed to show/not show things on the page based on this cookie.

    But here's the problem... It doesn't want to work in IE! It's been working fine in Firefox but in IE it's like I'm not sending the parameter at all. I use HTTPWatch so I can SEE that it's being sent in the POST but somehow the PHP in header_html is just missing it!

    Is it related to the redirect that happens? Does anyone have any pointers for why this might be happening? PLEASE help!



  2. #2
    Join Date
    Jan 2007
    Posts
    17
    Plugin Contributions
    0

    Default Re: Help with Cookie Setting Mod Problem

    Actually I think I got this sorted out and it definitely had to do with the redirect. Instead of passing my value in the form I added it to the action tag and it's working in both browsers now. My new form tag looks like so:

    <form name="cart_quantity" action="http://www.mysite.com/store/index.php?main_page=product_info&amp;products_id=2&amp;action=add_product&amp;sell_page=1" method="post" enctype="multipart/form-data">

 

 

Similar Threads

  1. Setting age verification and cookie question, plase advise! ? :)
    By bruceallen in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 9 May 2014, 06:02 PM
  2. v150 Setting a cookie to work on two domains?
    By retched in forum Contribution-Writing Guidelines
    Replies: 0
    Last Post: 7 May 2012, 12:12 PM
  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. Problem with setting up Attributes
    By Nindak in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 6 Sep 2010, 07:43 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