Skip navigation
raspberryh@gmail.com
Currently Being Moderated

Using data from the db in my webpage

Aug 9, 2012 11:09 AM

Hi,

 

This is probably a super simple question, so I apologize in advance. I've looked through a lot info on BC and I just can't seem to find the answer to my question (although a lot of it seems to go over my head as I am a complete n00b at BC and I feel like my hands are tied without being able to just whip something up in Python or PHP!).

 

I am trying to create a webpage which will display a single product (the entire website exists just for this 1 product), and the user can click on different color swatches to customize it. I would like my client (website owner) to easily be able to add new colors (using the hex code) for the different parts of the product.

 

So I basically just need a place where the client can enter in these values, and then I can write them to my page in JavaScript format, and build the dynamic page using JavaScript.

 

It seemed like the way to do this would be to create a new "Web App" inside of BC. I did that, and I created a "Web App Item" called "Data". Under "Data", I added an "Item Field" called "Color", which is just a multi-line text area. I entered in a few different hex codes like this:

000000

ffffff

003366

 

(I figured I can parse out the lines with JS)

 

The problem I am coming across though, is how to get this data into my source code on my webpage? I created a webpage and I put the code in it:

{module_webapps,6042,a,}

 

but this displays a list of links, with a link to "Data", and then if you click on "Data" you go to a separate web page that just says "Data" on it. Very strange.

 

Is there any possible way I can get the data entered here into the source of my webpage? (Or is there a much better way to do this?)

 

As a more general question... It's basically just how to use BC as a CMS and have custom fields that you can then access in your web page. Kind of like WordPress' Advanced Custom Fields plugin, if you are familiar with that. (I know this isn't WordPress, but just SOME way that I can access some values that my client has entered in)

 

Thanks in advance!

Heather

 
Replies
  • Currently Being Moderated
    Aug 9, 2012 4:27 PM   in reply to raspberryh@gmail.com

    You may be better off to use the eCommerce and assign different attributes for your colors?

     
    |
    Mark as:
  • Liam Dilley
    4,233 posts
    Feb 28, 2012
    Currently Being Moderated
    Aug 9, 2012 5:09 PM   in reply to Brad Lawryk

    Totally agree with Brad.

    Why are you not using eComemrece, it does that and more

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 13, 2012 12:17 AM   in reply to raspberryh@gmail.com

    In answer to your more general question..  You essentially get 3 views of each webapp - detail, list and list backup. You can edit the way BC renders each of these views and you could use one of them to insert data from a webapp onto a page.  So you could do something like this in the layout of the list backup view.

     

    <div id="data" class="hidden">{tag_my custom field}</div>

     

    and then insert the webapp module on the page/template {module_webapps,1234,i,123456,,,true,10,,1}

     
    |
    Mark as:
  • Liam Dilley
    4,233 posts
    Feb 28, 2012
    Currently Being Moderated
    Aug 13, 2012 2:03 AM   in reply to Pat | OMC

    Does not really apply though since he wont be able to achieve what he wants with web apps, that is why we both suggested the eCommerce

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 13, 2012 4:18 PM   in reply to Liam Dilley

    I agree with your ecommerce suggestion, I was just answering the second part of Heather's question

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points