Page 6 of 9 FirstFirst ... 45678 ... LastLast
Results 51 to 60 of 84
  1. #51
    Join Date
    Nov 2008
    Posts
    18
    Plugin Contributions
    0

    Default Re: Adding Field to Checkout

    That time to bug you for help again

    Ive tried and got no where with trying to make a feild required

    I am also struggling with a seperate javascript fix

    So once again, any help or pointers on making a feild required would be very much appreciated.


    Im sure a donation will be made, for the help in the forums and for the zencart system when my site is up and running
    I have made a fair few mods as well that I'd like to share with others, once the dust has settled.
    Last edited by eddyboy; 11 Feb 2009 at 05:33 PM. Reason: typos

  2. #52
    Join Date
    May 2005
    Location
    Bath, Somerset
    Posts
    1,053
    Plugin Contributions
    3

    Default Re: Adding Field to Checkout

    Ok, from the top!

    The way you add new fields has been shown earlier in this thread.

    To make them required, edit the header_php.php file you are currently working with - there should only be one. It's the one where you have $_SESSION['xxxx'] = $xxxx

    If there is a variable set somewhere in this page called $error, which is either true or false, you need to follow the same protocol.

    If not, then you can use this:

    Code:
      if (!zen_not_null($_POST['my_variable_name'])) {  //perform ALL checks on relevancy here
        $messageStack->add_session($_GET['main_page'], TEXT_ERROR_VARIABLE_MISSING, 'error');
        zen_redirect(zen_href_link($_GET['main_page']));
      }
    It's not the prettiest way of doing it, and if the customer has entered an entire page of data, and then comes across this type of error they will hate you, as none of their data will be re-populated, but as I don't know where you are adding the details, or what other modules you have installed, it is the only fail-safe way of doing it I can think of.

    Absolute
    Back, after a 4 year absence! Did you miss me?
    Absolute Web Solutions Ltd
    Interested in our work? Take a look at one of our sites - The Tech Store

  3. #53
    Join Date
    Nov 2008
    Posts
    18
    Plugin Contributions
    0

    Default Re: Adding Field to Checkout

    Quote Originally Posted by Absolute View Post
    If not, then you can use this:

    Code:
      if (!zen_not_null($_POST['my_variable_name'])) {  //perform ALL checks on relevancy here
        $messageStack->add_session($_GET['main_page'], TEXT_ERROR_VARIABLE_MISSING, 'error');
        zen_redirect(zen_href_link($_GET['main_page']));
      }
    Absolute
    Thanks for the speedy reply.

    I have been editing the checkout_shipping/header_php.php page as i have put the new form on the index.php?main_page=checkout_shipping page. And I have gone through the code a few times but cant find any examples to copy.


    Anyway, I put in the new code so it reads like this
    PHP Code:
    if (zen_not_null($_POST['address'])) {
    $_SESSION['address'] = zen_db_prepare_input($_POST['address']);
    }
    $address $_SESSION['address'];

    if (!
    zen_not_null($_POST['address'])) {  //perform ALL checks on relevancy here
        
    $messageStack->add_session($_GET['main_page'], TEXT_ERROR_VARIABLE_MISSING'error');
        
    zen_redirect(zen_href_link($_GET['main_page']));
      } 
    but i get a redirect loop error-

    Redirect Loop
    Redirection limit for this URL exceeded. Unable to load the requested page
    .

    Im asuming this is because when the page first loads the variables have no value

    Again, thanks for your patiance and help.. I am coming to the end of what hasbeen a very long project, and my brain is starting to fail me All and any help is much appreciated

  4. #54
    Join Date
    Nov 2008
    Posts
    18
    Plugin Contributions
    0

    Default Re: Adding Field to Checkout

    I think i have a work around.

    If I change a form feild to include some defult text

    PHP Code:
    <?php echo zen_draw_textarea_field('address''45''3','required feild'?>
    and tweak your last bit of code to

    PHP Code:
    if (($_POST['address'] =="required feild")) {  //perform ALL checks on relevancy here
        
    $messageStack->add_session($_GET['main_page'], TEXT_ERROR_VARIABLE_MISSING'error');
        
    zen_redirect(zen_href_link($_GET['main_page']));
      } 
    It means unless they change the text for something they enter it will throw an error.

    I think my brain has something left inside it after all

  5. #55
    Join Date
    May 2005
    Location
    Bath, Somerset
    Posts
    1,053
    Plugin Contributions
    3

    Default Re: Adding Field to Checkout

    Firstly, move that code so it comes BEFORE the if (zen_not_null($_POST['address'])) { line.

    And then change it so it reads:

    Code:
    if (isset($_POST['address']) && !zen_not_null($_POST['address'])) {  //perform ALL checks on relevancy here
        $messageStack->add_session($_GET['main_page'], TEXT_ERROR_VARIABLE_MISSING, 'error');
        zen_redirect(zen_href_link($_GET['main_page']));
      }
    Absolute
    Back, after a 4 year absence! Did you miss me?
    Absolute Web Solutions Ltd
    Interested in our work? Take a look at one of our sites - The Tech Store

  6. #56
    Join Date
    Nov 2008
    Posts
    18
    Plugin Contributions
    0

    Default Re: Adding Field to Checkout

    Quote Originally Posted by Absolute View Post
    Firstly, move that code so it comes BEFORE the if (zen_not_null($_POST['address'])) { line.

    And then change it so it reads:

    Code:
    if (isset($_POST['address']) && !zen_not_null($_POST['address'])) {  //perform ALL checks on relevancy here
        $messageStack->add_session($_GET['main_page'], TEXT_ERROR_VARIABLE_MISSING, 'error');
        zen_redirect(zen_href_link($_GET['main_page']));
      }
    Absolute

    Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou


    My way did seem to work, but I dont trust my coding on 0 sleep..
    i have used the new code and it works perfectly

  7. #57
    Join Date
    May 2005
    Location
    Bath, Somerset
    Posts
    1,053
    Plugin Contributions
    3

    Default Re: Adding Field to Checkout

    Glad I could help!

    Absolute
    Back, after a 4 year absence! Did you miss me?
    Absolute Web Solutions Ltd
    Interested in our work? Take a look at one of our sites - The Tech Store

  8. #58
    Join Date
    Nov 2008
    Posts
    18
    Plugin Contributions
    0

    Default Re: Adding Field to Checkout

    I'm at the point of testing my site online now and I have set up paypal website payments pro and express checkout. I have made 2 successfull orders, 1 with a credit card and one through the express checkout. However I have just noticed that the details for the new feilds that I have made have not made it through to the database when using the express checkout, but the info from the new feilds is there for the order that I payed with using a credit card.

    Just wondering if anyone has come across this before or can think why it would be an issue ?

    Thanks in advance

  9. #59
    Join Date
    Nov 2008
    Posts
    18
    Plugin Contributions
    0

    Default Re: Adding Field to Checkout

    Ok so when you checkout with expresscart this page is skiped and you are returned to the next page in the process. Trouble is i need those feilds to be filled out.

    I guess I need to move the feilds or find out how to change the redirect url after using express checkout

  10. #60
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Adding Field to Checkout

    Edit your PayPal Express Checkout module settings and turn off the setting that auto-selects cheapest shipping.
    .

    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.

 

 
Page 6 of 9 FirstFirst ... 45678 ... LastLast

Similar Threads

  1. v151 Adding custom field during checkout
    By hues in forum General Questions
    Replies: 1
    Last Post: 9 Nov 2012, 10:39 PM
  2. Adding Field to Checkout
    By earlygrayte in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 17 Feb 2012, 03:00 PM
  3. Adding select field to checkout
    By ETbyrne in forum Managing Customers and Orders
    Replies: 1
    Last Post: 22 Aug 2008, 02:34 AM
  4. adding a field to checkout and db
    By StevenB in forum General Questions
    Replies: 0
    Last Post: 20 May 2007, 12:57 AM

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