Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8046373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:46:02+00:00 2026-06-05T05:46:02+00:00

Im using WordPress as a CMS for this website. Basically the site has products

  • 0

Im using WordPress as a CMS for this website. Basically the site has products that are amongst different categories. The products are stored as a custom post type called ‘product’

On the front-end, there’s going to be an order form. What I’m trying to figure out is this: The client wants to have the ‘order totals’ updated on the fly. So if a user types in ‘5’ for a particular product, it’ll update that total after the keystroke.

Furthermore, a product/service could potentially be in different categories, which would effect the price. For example

Product: Wash & Wax

Categories: Full Service | Once Over

So if the product ‘Wash & Wax’ has an text <input>, and below it are those categories with corresponding radio buttons, and a user chooses ‘Full Service’ which might be $10 for THAT product, or ‘Once Over’ which might be $7 for THAT product, I’m trying to figure out:

what the best way is to pull the data from the back-end,

store it in some sort of JQuery accessible Object / Array,

and have the Product inputs access their corresponding prices from that data set

Currently, prices are stored on a PER PRODUCT basis in the database. So the product ‘Wash & Wax (full service) is one row in the DB with its own price, and ‘Wash & Wax’ (once over) is a separate product in the DB with its own price.

EDIT:

If the question is too specific, really what Im asking is: Whats the best way to pull MySQL data, for use in a dynamic context (like updating price totals with JQuery) and whats the best way to link up the HTML inputs with the fetched data?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:46:03+00:00Added an answer on June 5, 2026 at 5:46 am

    I decided to make everything simpler. I got rid of the Categories being part of the front end equation. I just pulled all Products from the database along with their unique Slug and Price. The array is setup simply as:

    $products = array(
         'the-unique-slug' => array(
              'id' => $id,
              'price' => $price,
         'next-unique-slug' => array(
         etc......
    

    This way, even if the categories change, the Slug will always be the same and unique.

    Next, I decided to display ALL separate text <inputs> for tall the variations on a certain product. I hide all of them except using jQuery. I then put the Categories in classes:

    <input type='text' class='raw standard product-input' name='photo-prints-1' />
    <input type='text' class='direct standard product-input' name='photo-prints-2' />
    etc..
    

    So when a user changes to the ‘standard’ radio button and ‘raw’ radio button, JQuery simply show() those <inputs> possessing those classes, and hide() anything that doesn’t

    And lastly, to get the array in to jQuery, I just Json_encoded() it:

    <script type="text/javascript"> var products = <?php echo json_encode($products) ?>;</script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am planning a new website with codeigniter using wordpress. this site will contain
I am using wordpress as my cms and building a website. I use Graphene
I just started out using wordpress as a CMS. On the site I have
I am using a plugin for wordpress called CMS its a plugin that makes
I am almost done with my humble attempt at a custom CMS using Wordpress.
I'm working on a simple custom cms - this is for a school that
I will be using Wordpress as a CMS with custom post types. Each post
I'm implementing our school's website using WordPress as CMS. So far, it works well
I am using wordpress for my website like a CMS, also have installed ALL
I am using a wordpress theme for a website. Problem is that when I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.