Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Aug 2013
    Location
    California
    Posts
    22
    Plugin Contributions
    0

    Default zen_draw_form() - doesn't do anything?

    I tried hard coding a form into my website but I was greeted with a 404 error. A google search led me to the knowledge that I wasn't passing a security token and I needed to use zen_draw_form()

    I am using zen_draw_form to create an add to cart button for a custom "pack" of items on our site. Searching for zen_draw_form syntax has taken a while. I finally found to look in html_output.php for the syntax and did.

    I have tried:

    Code:
    zen_draw_form(); 
    //hoping for at least a default button? - nothing
    
    zen_draw_form('cart_quantity', 'index.php?main_page=product_info&cPath=24&products_id=876&action=add_product', 'post');
    //nothing again.
    
    zen_draw_form('cart_quantity', 'index.php?main_page=product_info&cPath=24&products_id=876&action=add_product', 'post', 'products_id="876"');
    //nothing again!
    
    zen_draw_form('warranty', zen_href_link(FILENAME_WARRANTY, '', 'NONSSL'), 'post');
    //from zen cart essentials.  Displays nothing.
    What am I doing wrong? What do I need to do? I need the products id to be variable as well. so it needs to be something like...
    Code:
    $products_id = 1 ;
    zen_draw_form('cart_quantity', 'index.php?main_page=product_info&cPath=24&products_id=' . $products_id . '&action=add_product', 'post');
    But of course, that doesn't work either.

    =[

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,873
    Plugin Contributions
    96

    Default Re: zen_draw_form() - doesn't do anything?

    You need to echo the output of the function, e.g.
    Code:
    echo zen_draw_form('warranty', zen_href_link(FILENAME_WARRANTY, '', 'NONSSL'), 'post');

  3. #3
    Join Date
    Aug 2013
    Location
    California
    Posts
    22
    Plugin Contributions
    0

    Default Re: zen_draw_form() - doesn't do anything?

    Quote Originally Posted by lat9 View Post
    You need to echo the output of the function, e.g.
    Code:
    echo zen_draw_form('warranty', zen_href_link(FILENAME_WARRANTY, '', 'NONSSL'), 'post');
    Thank you very much lat9. I swear I was typing post #3 before I saw yours =P

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,873
    Plugin Contributions
    96

    Default Re: zen_draw_form() - doesn't do anything?

    No problem; I figured, based on the timestamps, that that's what happened!

  5. #5
    Join Date
    Aug 2013
    Location
    California
    Posts
    22
    Plugin Contributions
    0

    Default Re: zen_draw_form() - doesn't do anything?

    GOT IT! That only took a couple of hours =\

    the trick is to echo it =P

    Here is how I solved my problem with zen_draw_form or zen_draw_form() not displaying anything or not working. You need to echo it. It doesn't echo by itself.

    Here is the code I ended up using.

    Code:
    <?php
        $products_id = $_POST['products_id'];
        echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($products_id), zen_get_all_get_params(array('action')) . 'action=add_product', $request_type), 'post', 'enctype="multipart/form-data"');
    ?>
    <input type="hidden" name="cart_quantity" value="1" maxlength="6" size="4" />
    <input type="hidden" name="products_id" value="<?php echo $products_id ; ?>" />
    <input type="image" name="image" title=" Add to Cart " src="/includes/templates/CUSTOM_TEMPLATE/buttons/english/button_in_cart.gif" alt="Add to Cart " />
    </form>
    I'm still a little confused about the values actually needed in the function. But they are effectively overwritten in the following hidden fields it looks like. I've tested it and it's working as intended.

    zen_draw_form only draws the opening form tag. Not the rest of the form for you. You need to add submit buttons and some hidden fields if you need to and close the form with </form>.

    Any extra input would be nice!



    P.S. My code has some more security measures than that dispalyed here so dont worry =P

 

 

Similar Threads

  1. v151 How to add ID to zen_draw_form?
    By vermontwoods in forum General Questions
    Replies: 8
    Last Post: 21 Feb 2020, 10:18 PM
  2. zen_draw_form
    By swguy in forum Upgrading to 1.5.x
    Replies: 1
    Last Post: 16 Aug 2011, 09:39 AM
  3. Replies: 2
    Last Post: 31 Oct 2007, 10:00 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