Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2010
    Location
    oxford, ms
    Posts
    3
    Plugin Contributions
    0

    application error Adding item with attributes from link

    Ok, so I read the forums and came up with this php page to take the info from previous pages and submit it to the cart. The php page before it asks the last questions and sends all the data to this page which is not seen by the user. It seemed to work perfectly the first time; there was a slight delay as it ran the scripts, then it come to the correct product page saying "successfully added to cart!" I think I'm awesome. Then I click view cart. It's empty. I would appreciate any help other than, "send user to product page and have them choose attributes and add to cart from there." They need to be able to use the graphical site with full instructions on customization before it's added to the cart. Also, I realize some users don't have javascript to begin with. Here's my code.

    <?php
    $font=$_GET['font'];
    $thread=$_GET['thread'];
    $text=$_GET['text'];
    $instructions=$_GET['instructions'];
    switch ($font)
    {
    case AKAFrivolity:
    $f="16";
    break;
    case BoyzRGross:
    $f="10";
    break;
    case CurlzMT:
    $f="11";
    break;
    case GirlsAreWeird:
    $f="12";
    break;
    case KristenITC:
    $f="13";
    break;
    case PoorRichard:
    $f="14";
    break;
    case TinkerToy:
    $f="15";
    break;
    case Zachary:
    $f="17";
    break;
    default:
    header( 'Location: cart/' );
    }
    switch ($thread)
    {
    case red:
    $t="2";
    break;
    case black:
    $t="3";
    break;
    case babyblue:
    $t="4";
    break;
    case babypink:
    $t="5";
    break;
    case brown:
    $t="6";
    break;
    case bubblegumpink:
    $t="7";
    break;
    case white:
    $t="8";
    break;
    case blue:
    $t="1";
    break;
    case limegreen:
    $t="9";
    break;
    default:
    header( 'Location: cart/' );
    }
    ?>
    <form id="form_1" action="cart/index.php?main_page=product_info&amp;cPath=7&amp;products_id=1&amp;number_of_upl oads=0&amp;action=add_product" method="POST">
    <input type="hidden" name="id[1]" value="<? echo $f; ?>" id="attrib-1" />
    <input type="hidden" name="id[2]" value="<? echo $t; ?>" id="attrib-2" />
    <input type="hidden" name="id[txt_3]" value="<? echo $text; ?>" id="attrib-3-0" />
    <input type="hidden" name="id[txt_4]" value="<? echo $instructions; ?>" id="attrib-4-0" />
    </form>
    <script type="text/JavaScript">
    function Submit(form){
    document.getElementById(form).submit();
    }
    Submit('form_1');
    </script>

  2. #2
    Join Date
    Jun 2010
    Location
    oxford, ms
    Posts
    3
    Plugin Contributions
    0

    Default Re: Adding item with attributes from link

    Bump. Anyone?

  3. #3
    Join Date
    Jun 2010
    Location
    oxford, ms
    Posts
    3
    Plugin Contributions
    0

    Default Re: Adding item with attributes from link

    I figured it out myself. The quantity was not being set, so it was zero. This works:

    <?php
    $font=$_GET['font'];
    $thread=$_GET['thread'];
    $text=$_GET['text'];
    $instructions=$_GET['instructions'];
    switch ($font)
    {
    case AKAFrivolity:
    $f="16";
    break;
    case BoyzRGross:
    $f="10";
    break;
    case CurlzMT:
    $f="11";
    break;
    case GirlsAreWeird:
    $f="12";
    break;
    case KristenITC:
    $f="13";
    break;
    case PoorRichard:
    $f="14";
    break;
    case TinkerToy:
    $f="15";
    break;
    case Zachary:
    $f="17";
    break;
    default:
    header( 'Location: cart/' );
    }
    switch ($thread)
    {
    case red:
    $t="2";
    break;
    case black:
    $t="3";
    break;
    case babyblue:
    $t="4";
    break;
    case babypink:
    $t="5";
    break;
    case brown:
    $t="6";
    break;
    case bubblegumpink:
    $t="7";
    break;
    case white:
    $t="8";
    break;
    case blue:
    $t="1";
    break;
    case limegreen:
    $t="9";
    break;
    default:
    header( 'Location: cart/' );
    }
    ?>
    <form id="cart_quantity" action="cart/index.php?main_page=product_info&amp;cPath=7&amp;products_id=1&amp;number_of_upl oads=0&amp;action=add_product" method="POST" enctype="multipart/form-data">
    <input type="hidden" name="id[1]" value="<? echo $f; ?>" id="attrib-1" />
    <input type="hidden" name="id[2]" value="<? echo $t; ?>" id="attrib-2" />
    <input type="hidden" name="id[txt_3]" value="<? echo $text; ?>" id="attrib-3-0" />
    <input type="hidden" name="id[txt_4]" value="<? echo $instructions; ?>" id="attrib-4-0" />
    <input type="hidden" name="cart_quantity" value="1" />
    <input type="hidden" name="products_id" value="1" />

    </form>
    <script type="text/JavaScript">
    function Submit(form){
    document.getElementById(form).submit();
    }
    Submit('cart_quantity');
    </script>

 

 

Similar Threads

  1. v139h How to add new menu item with submenu in sidebox with static link..
    By snk060 in forum General Questions
    Replies: 9
    Last Post: 25 Nov 2013, 02:47 PM
  2. Adding item to cart from a button outside of the store.
    By dwolfe in forum General Questions
    Replies: 1
    Last Post: 27 Jan 2011, 02:38 PM
  3. Replies: 1
    Last Post: 28 Jan 2008, 01:08 PM
  4. Item Price with attributes.
    By computerphysicians in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 5 Sep 2007, 10:52 PM
  5. adding a remove item button from checkout sidebox
    By buuurrb in forum Basic Configuration
    Replies: 6
    Last Post: 16 Aug 2007, 07:11 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