Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

Collect Customer Input – Extracting the input by creating a View in the database

by

Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Tweaks › Collect Customer Input – Extracting the input by creating a View in the database

  • This topic has 1 reply, 2 voices, and was last updated 10 years, 11 months ago by admin.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • May 21, 2014 at 3:56 pm #10875
    icm
    Spectator

    This is less of an eStore Tweak than a database tweak, but it does solve a problem I was having. I just wanted to share a solution.

    To do this, you will need to have access to your database via phpMyAdmin or something else where you can enter a query. I’m really new to working with MySQL, so it took a while to figure out what I needed to do.

    My situation is that I wanted the purchaser of the product to be able to enter a username for another another person to give them access to another site. The other site can use external databases to authenticate users.

    I used the “Collect Customer Input” field in order to collect the new username, but that data is not stored in a separate field, it is stored in the product name within parentheses (i.e. “Product Name(Collected Customer Input)”) in the wp_wp_eStore_customer_tbl table int he database. That would make for a long username. :)

    In order to get around that I learned that I could make a “View” of the eStore Customer table, rename the fields and, for the product name, remove everything except what is inside the parenthesis.

    Basically, you go to where you enter mySQL queries and enter something like: (without the “<” or “>” and the back tick mark where [backtick] is… and possibly around each field and table name)

    Code:
    CREATE ALGORITHM=UNDEFINED DEFINER=<databaseName>@ [backtick]%[backtick] SQL SECURITY DEFINER VIEW <newTableYouWantToCreate>
    AS SELECT
    wp_wp_eStore_customer_tbl.id AS id,
    wp_wp_eStore_customer_tbl.email_address AS email_address,
    wp_wp_eStore_customer_tbl.first_name AS first_name,
    wp_wp_eStore_customer_tbl.last_name AS last_name,
    wp_wp_eStore_customer_tbl.purchased_product_id AS course_id,
    wp_wp_eStore_customer_tbl.txn_id AS password,
    wp_wp_eStore_customer_tbl.date AS date,
    substring_index(substr(wp_wp_eStore_customer_tbl.product_name,(locate(‘(‘,wp_wp_eStore_customer_tbl.product_name) + 1)),’)’,1) AS username,
    wp_wp_eStore_customer_tbl.serial_number AS serial_number

    FROM wp_wp_eStore_customer_tbl

    This creates a new table in the database that just shows some of fields from the customer table, relabels some of them, and, in the case of the product_name field, removes the product name and the parentheses leaving only the data the customer put in. There are some limitations that may need to be addressed by limiting what the customer can enter, but that’s a case for another thread.

    Oh, and by adding “where (wp_wp_eStore_customer_tbl.date between (now() – interval 30 day) and now());” at the end you can limit the number of records shown to those of purchases made within the last 30 days.

    May 22, 2014 at 12:51 am #63134
    admin
    Keymaster

    Thank you for sharing this.

    I just wanted to mention that there is an “Export to CSV” button in the manage customers menu. If you export the customer data, it will also output the custom variations and customer input in a different column in that exported CSV file.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

Forum Related

  • Forum Home
  • Forum Search
  • Forum Registration
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2025 | Tips and Tricks HQ