Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Jan 2012
    Posts
    89
    Plugin Contributions
    0

    Default Accessing Product Prices From A Remote Hosted Database....

    Hi All,

    We are in precious metals business, selling coins etc. the metals prices are dynamic and changes by the minute, We have a company that will be hosting our product database with real-time price updates. We want to modify our zencart website so that when a page loads the product prices are fetched from the remote database and not from zencart database.

    Could anyone tell me which files need to be changed in Zencart, we will be using an API to accress the remote database.

    Right now I use easy populate to do this but it's a hassle to update 10-20 times a day.

    Basically we will be bypassing the price look up.

    Thank you

  2. #2
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,021
    Plugin Contributions
    3

    Default Re: Accessing Product Prices From A Remote Hosted Database....

    Might be some ideas here:

    http://www.zen-cart.com/downloads.php?do=file&id=761

    I haven't used it.

  3. #3
    Join Date
    Jan 2012
    Posts
    89
    Plugin Contributions
    0

    Default Re: Accessing Product Prices From A Remote Hosted Database....

    I appreciate that link but I really need the zencart core file that gets the price info from the zencart database, we will bypass that step and go to the remote database.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Accessing Product Prices From A Remote Hosted Database....

    Answer: every file that runs a query against TABLE_PRODUCTS

    Yes, that's unweildy. There may be ways to minimize some of that, but prices are handled in TONS of different places, for many different reasons

    It would be much simpler to write a script that does the retrieval and applies the updates for you on an automated schedule.
    .
    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Jan 2012
    Posts
    89
    Plugin Contributions
    0

    Default Re: Accessing Product Prices From A Remote Hosted Database....

    Quote Originally Posted by DrByte View Post
    Answer: every file that runs a query against TABLE_PRODUCTS

    Yes, that's unweildy. There may be ways to minimize some of that, but prices are handled in TONS of different places, for many different reasons

    It would be much simpler to write a script that does the retrieval and applies the updates for you on an automated schedule.
    Wow, that's not what I expected and was afraid of that, originally my developer was going to update the database on a regular interval like you mentioned but now they want to use an API to access our product prices remotely as a hosted service.

    Any idea how many files are involved?

  6. #6
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Accessing Product Prices From A Remote Hosted Database....

    Are you sure that you REALLY want to use an API to load prices IN REAL TIME?

    EVERY price that is displayed in Zen Cart will have to be requested separately for EVERY place ANY price is displayed on the screen, OR used in a calculation to come up with EVERY number displayed on the screen.

    If you've got a very busy site, then you'll be brokering thousands of inquiries per second, effectively blasting their API server. That's very inefficient and will likely result in a very slow experience for your customer. Not to mention the technical problems it'll create for the people who run the API server.

    It's much more efficient for you to run an API call, even if it's every 10 minutes, to request all the updated prices for all the products, ideally in one request if possible, and update all your store's prices accordingly. That's way more friendly to the folks who run the API server, and it's a much better experience for your customers.
    .
    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Jan 2012
    Posts
    89
    Plugin Contributions
    0

    Default Re: Accessing Product Prices From A Remote Hosted Database....

    Quote Originally Posted by DrByte View Post
    Are you sure that you REALLY want to use an API to load prices IN REAL TIME?

    EVERY price that is displayed in Zen Cart will have to be requested separately for EVERY place ANY price is displayed on the screen, OR used in a calculation to come up with EVERY number displayed on the screen.

    If you've got a very busy site, then you'll be brokering thousands of inquiries per second, effectively blasting their API server. That's very inefficient and will likely result in a very slow experience for your customer. Not to mention the technical problems it'll create for the people who run the API server.

    It's much more efficient for you to run an API call, even if it's every 10 minutes, to request all the updated prices for all the products, ideally in one request if possible, and update all your store's prices accordingly. That's way more friendly to the folks who run the API server, and it's a much better experience for your customers.
    The original idea was to use a cronjob and hosted database that would have all our products, the pricing would be updates every 2-5 minutes using xignite metals data feed, our hosted service would take the price of metals and calculate product prices and then the software would push the product prices to zencart database every 2-5 minutes,

    Now, the developer is changing the way they like to impalement this, the hosted service is their product but now need to hook it up to zencart, I was also surprised of the change because I talked to few other people and everyone was agreed that a cronjob would be used and a hosted database with updating zencart database at a scheduled interval.

    I don't think they are familiar the way zencart works, they think it's a simple few line of code.


    I appreciate your input,

  8. #8
    Join Date
    Jan 2012
    Posts
    89
    Plugin Contributions
    0

    Default Re: Accessing Product Prices From A Remote Hosted Database....

    HiDrByte,

    "It's much more efficient for you to run an API call, even if it's every 10 minutes, to request all the updated prices for all the products, ideally in one request if possible, and update all your store's prices accordingly. That's way more friendly to the folks who run the API server, and it's a much better experience for your customers."
    How would you implement the above statement, I like this idea, getting all product prices via API and I assume we will be updating the database correct?

    Thank you

  9. #9
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Accessing Product Prices From A Remote Hosted Database....

    While Zen Cart does have some shared functions which handle pricing, there are exceptions that are handled differently, and unless your developers are prepared to do deep code studies and extensive testing, it's most efficient to simply update the data in the place where Zen Cart expects it: the products table in the database.

    Pushing updated prices every 2-5 minutes would definitely be far better in the end. Not only for customer experience, but also to minimize the amount of recoding you'll need to do in Zen Cart.
    It's really quick to do:
    a) fetch your updated prices via your API/feed
    b) update your Zen Cart products table:
    - i) read each record from the table,
    - ii) look up its price in the data you got back from your API feed
    - iii) update the record
    - iv) repeat until finished
    .
    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  10. #10
    Join Date
    Jan 2012
    Posts
    89
    Plugin Contributions
    0

    Default Re: Accessing Product Prices From A Remote Hosted Database....

    Quote Originally Posted by DrByte View Post
    While Zen Cart does have some shared functions which handle pricing, there are exceptions that are handled differently, and unless your developers are prepared to do deep code studies and extensive testing, it's most efficient to simply update the data in the place where Zen Cart expects it: the products table in the database.

    Pushing updated prices every 2-5 minutes would definitely be far better in the end. Not only for customer experience, but also to minimize the amount of recoding you'll need to do in Zen Cart.
    It's really quick to do:
    a) fetch your updated prices via your API/feed
    b) update your Zen Cart products table:
    - i) read each record from the table,
    - ii) look up its price in the data you got back from your API feed
    - iii) update the record
    - iv) repeat until finished
    ok, that's great but where would you do this in Zencart, where would you put the code to do this.

    Thank you

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Remote MySQL database
    By arcticbit in forum Installing on a Linux/Unix Server
    Replies: 1
    Last Post: 2 Nov 2010, 02:18 PM
  2. accessing existing product database with zencart
    By grossd in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 9 Feb 2009, 03:26 AM
  3. Blank page accessing store front on GoDaddy hosted site
    By alicia1234 in forum General Questions
    Replies: 4
    Last Post: 14 Nov 2008, 08:16 PM
  4. How can I change prices from within the database (not controlpannel) v1.2.7
    By ovdjajoh in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 5
    Last Post: 20 Sep 2008, 08:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg