PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Passing Shopp fields to Gravity Forms

  1. This is more of a 'I don't know PHP that well' issue than a Gravity forms issue, but I've seen others ask this once or twice on the forums at both locations and never saw a definitive answer.

    I have followed the instructions on setting up the hooks in http://www.gravityhelp.com/forums/topic/right-parameter-names-to-pre-populate-the-names-fields#post-14044, instead of getting the first and last names in the fields, it's displaying the fields at the load point of the form, and then putting '1' in each field.

    The functions.php hooks: http://www.pastie.org/2647238

    Results: http://grab.by/b0Re

    Just based on the results I would think it is some simple issue with the create_function echoing the results on execute instead of storing it in the variable, but I just can't see it...

    Posted 12 years ago on Thursday October 6, 2011 | Permalink
  2. Hi Scott,

    It looks the the shopp() function is echoing the values to the page rather than returning them. I suspect the "1" you are seeing is the actual returned value from the shopp() function, indicating a successful call. Is there an option on the shopp() function to return the value instead of echoing it?

    Posted 12 years ago on Monday October 10, 2011 | Permalink
  3. I've spent some time splunking around the Shopp code and have come to the same conclusion.

    The shopp() function would normally create a text field with the variable called pre-populating it, by adding the 'mode-value' argument it echos the variable as plaintext instead of an input field.

    I've been working on some more coding and ways to obtain the info I want - some of it may be useful to other Shopp / Gravity users.

    1) Returns login status of Shopp accounts, or WB / Integrated accounts as shopp_login
    http://www.pastie.org/2673207

    2) Returns the first name of the currently logged in Shopp account holder as shopp_fname
    http://www.pastie.org/2673202

    Code 2 pulls it's info from the current Shopp session, but returns empty fields if the user is not logged in. I am working on code to check login status, pull the customer info from the Shopping data file if they are logged and the WP file if not, and eventually be able to pull transaction numbers for purchases to pre-populate RMA or complaint & review forms.

    Posted 12 years ago on Monday October 10, 2011 | Permalink
  4. OK, played with it a little more after the last post and have what I want out of it. I'm sure it could be cleaned up a bit as I have no knowledge of PHP, but for a monkey playing with powertools it does what I want.

    http://www.pastie.org/2674097

    Shopp has the option of running with WordPress accounts, Separate from WordPress accounts, or with no accounts. So I tried to take into account ether type of user account.

    Will return the Shopp user first, last, and email address, with fallback to WordPress account information, or 'Not Logged In' if neither account is active.

    I've tested:
    Logged Out > "Not Logged In"
    WordPress Only > WP user info
    Shopp Only > Shopp user info
    WordPress and Shopp > Shopp user info

    Posted 12 years ago on Monday October 10, 2011 | Permalink