Valor Talk

Welcome to Valor Talk Sign in | Join | Help
in Search
 
 
 
Your Ad Here

VALOR API!!

Last post 08-08-2008, 2:30 AM by questdesign. 34 replies.
Page 2 of 3 (35 items)   < Previous 1 2 3 Next >
Sort Posts: Previous Next
  •  11-21-2006, 12:03 PM 117 in reply to 110

    Re: VALOR API!!

    Ben,

    Can you change the javascript call from document.writeln() to document.write()?  Is there a reason that you're using writeln()?  I believe that the newline added by the writeln() function is causing me problems with pulling the product quantity out to be used for local database queries (i.e, updating a product's quantity locally any time I use your function to retrieve current stock level for that product).

    Rick


     


    --
    Rick
  •  11-21-2006, 12:06 PM 118 in reply to 115

    Re: VALOR API!!

    Wildside,

    It sounds to me like you may want to add a column to your products table for vendor name.  Then you can check the vendor of a given product and if it is 'valor' then execute the update query to update the product quantity.


    --
    Rick
  •  11-21-2006, 12:15 PM 119 in reply to 118

    Re: VALOR API!!

    allingeneral,

     thanks for the tip, I will talk to my coder and see if we can get this in.

     

     

  •  11-21-2006, 1:48 PM 120 in reply to 119

    Re: VALOR API!!

    I changed from document.writeln to document.write.

    I am going to set up a separate forum for the api soon.


    Ben Newton
  •  11-21-2006, 6:56 PM 124 in reply to 120

    Re: VALOR API!!

    Well, I thought that the difference between writeln/write would correct the problem.  I didn't realize that the page source prior to being displayed on the browser still shows the javascript link and it's up to the browser to display the number output by the script.  I guess you could call that my first lesson in javascript.  I still think that document.write is the best thing to use here.

    So, essentially, I am trying to get the value from the javascript to update my products, ie:
    update products set products_quantity = '[output from javascript]' where products_id = '2234567';

    Instead of getting a number from the javascript, when I view the page source, I just get the javascript link which doesn't insert into a mysql integer cell very well :)

    Is it feeble for me to continue to try to get the javascript to give me something useful for this purpose (from the client side, anyway)?  Would I need to write the output of the javascript to a file and then read out the file to update the database?  Just using the javascript to update 25 products on a page already adds quite a lot of overhead to the display of the page, so writing to a file and reading out of it wouldn't be feasible.

    I'm new to javascript, but fairly well versed in php/mysql.  Just trying to provide some feedback here to help things along.

     

     


    --
    Rick
  •  11-21-2006, 8:47 PM 125 in reply to 124

    Re: VALOR API!!

    Your getting the on hand on the client side, so to write that variable back to the server, you would need to post it to a form to go back to the server.  You could get a little crazy with ajax and post it back with out anybody knowing the difference after the api script is called... but that's a lot to go through unless you are only going to do one at a time when the page viewed by a customer.

    Now that this script is available, why do you want to keep our on hands in your database?  I don't mind, I'm just curious. The minuite you put them in your database, they are out of date.   You should read from the api when ever possible.


    Ben Newton
  •  11-22-2006, 6:10 AM 127 in reply to 125

    Re: VALOR API!!

    Some of my checkout processing relies on how many of a certain item are in stock.  For instance, if there are 3 of an item in stock, my checkout won't allow a customer to purchase 7 of that item.  So, when a customer adds an item to their cart, they will have had to view the item, which means that the API would have been called for that item and the database would be up-to-date with the proper quantity of that item for checkout purposes.  I can't rely on an external website during my checkout processing for many reasons that I'm sure you're more than aware of, some of which include SSL security, webpage latency, network problems that may cause inventory to not be fed properly, etc.

    So, the API won't keep me from having to update my database, but it does work nicely for displaying the quantity on product pages.  I have thought about just setting all items to qty 100 in my database and letting the API tell customers the correct quantity.  This would allow anyone to purchase up to 100 of any given item without my shopping cart complaining...but that would be a band-aid in my opinion.


    --
    Rick
  •  11-22-2006, 8:10 AM 129 in reply to 127

    Re: VALOR API!!

    good point.  Don't go with 100 of each.  The minute you do that someone will want 200 of something.  It never fails.  I think your right on by having the script write to your database when an item is viewed.  Then when the item is viewed, then bought, you know they have a realistic on hand.  Even if they wait an hour or two.  Does you shopping cart show the on hand qty?  That may be a good place for the script since it will be the page before checkout every time.
    Ben Newton
  •  11-22-2006, 8:21 AM 131 in reply to 110

    Re: VALOR API!!

    There may have been a problem with the first Key I generated.  I made a new key and inserted it and it works perfectly.

    <> Thanks Ben this will be a nice addition, espically with the holiday shopping coming up.  

    <>Next question.  How up to date is the inventory with the API?  Is it real time or is it updated a couple times a day?

     

    <>Robert
    <>
     

  •  11-22-2006, 8:28 AM 132 in reply to 131

    Re: VALOR API!!

    100% real time.
    Ben Newton
  •  11-22-2006, 9:01 AM 133 in reply to 129

    Re: VALOR API!!

    The problem for me isn't finding where to place the script.  I've already determined where the update to my database needs to occur.  What I'm struggling with is figuring out how to best get the value from your server and into a mysl query for the local db update.  I'll look into the form post method that you mentioned earlier.  I'm open to any other ideas you may have, as well.

     


    --
    Rick
  •  11-22-2006, 9:30 AM 134 in reply to 133

    Re: VALOR API!!

    I'll see if I can't come up with something.  I think you will have to use ajax.


    Ben Newton
  •  11-23-2006, 9:15 AM 138 in reply to 134

    Re: VALOR API!!

    What sort of database are you using to store your inventory?
    If it's linux/mysql then I have some ideas that may help.  If it's windows based, I can't help much.


    --
    Rick
  •  12-13-2006, 9:28 PM 181 in reply to 102

    Re: VALOR API!!

    WesFrost:

    I have been waiting a long time for something like this.  It is simple, but awesome.  I have tested it on my site here:

    http://www.lighterfactory.com/testapi.aspx

    It seems to work pretty good.  I'm looking forward to when the entire product catalog can be accessed through the API...then I could really stop using the xls downloads.

     Thanks for working on this Ben.  I know it will be a great help to a lot of people.

     

    How can I create this form??? Or can I pay you to create it for me? 

  •  12-14-2006, 8:00 AM 182 in reply to 181

    Re: VALOR API!!

    What server side language does your site run on?
    Ben Newton
Page 2 of 3 (35 items)   < Previous 1 2 3 Next >
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems