Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Aug 2012
    Posts
    2
    Plugin Contributions
    0

    Default Is it possible to "read" stock availability from a separate store?

    I assume not, but thought I would ask anyway.

    A client wants his site to mirror the stock availability of another website, which runs Zen cart (as he is a re-seller of products from the other site). Is that possible? I assume not, on security grounds, but I don't know anything about Zen Cart, so you never know... ;)

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Is it possible to "read" stock availability from a separate store?

    For security and technical reasons, the short answer is no. Especially if you're talking about real-time information, since the remote queries would slow things to a crawl.

    But you could write a timed script to periodically go out and get the information (assuming you also build the appropriate security/authorization logic to allow it) and then use that info to update data in your own site with the changes, say every 15 minutes or so.

    There are performance/caching caveats with doing regular mass updates, so I wouldn't do it more often than 10-15 minutes apart. Better to make it even longer if that suits your business.

    So the long answer is yes, if you're prepared to roll up your sleeves to make it work.
    .

    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.

  3. #3
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,826
    Plugin Contributions
    31

    Default Re: Is it possible to "read" stock availability from a separate store?

    How about the source site creates a csv of product stock regularly and the destination site imports it regularly?
    No need for access control or synchronisation?
    Steve
    github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

  4. #4
    Join Date
    Aug 2012
    Posts
    2
    Plugin Contributions
    0

    Default Re: Is it possible to "read" stock availability from a separate store?

    Many thanks for the replies folks.

    My assumption is that a timed script would only work if one had the appropriate permissions to look at the database? The problem being that the owners of the source site are unwilling to allow access to their database (ie passwords etc). The client thinks that, as it is possible to look at stock levels by viewing each individual shop item one at a time, it should be possible to "trawl" the site for stock data... using an appropriate script. Something tells me that it is unlikely to be that easy though... what do you think?

  5. #5
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Is it possible to "read" stock availability from a separate store?

    Trawling or scraping the data is a poor practice.
    If there's a relationship whereby the site trusts you with having up-to-date stock info, then there are various ways for them to share the data with you.

    What I wrote earlier was intentionally very generic. I said "have your script go out and get the data" ... that "go out and get" could be in various forms (direct database access, a REST query, a CSV file produced by their end and stuffed into a URL that your script can read, etc).

    torvista suggested one approach ... have them set up a timed script on their end to export a CSV file of product ids and inventory counts. Then have your script read and process that info.

    If they will write a script that extracts the data and puts the CSV file into a folder on their server (a folder not advertised to anyone but you, and maybe security-restricted to only the IP address of your webserver), then your script could check to see whether the file exists, and process it.

    I also wrote generically in how to process the script, mentioning that it should only apply updates where a change is needed. ie: if there is no info for a particular product ID, skip it. And if the quantity they say they have *matches* what you have, then skip it. This minimizes the amount of changes pushed into your database, thus minimizing performance problems.

    Of course if you're asking for more info than just product ID and available stock for that ID, then things get more complicated.

    But there are lots of ways to tackle your situation as you described it.
    .

    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.

 

 

Similar Threads

  1. Replies: 0
    Last Post: 27 Nov 2011, 06:04 PM
  2. Upgrading 1.3.7.1 to 1.3.9d, and the "Attributes Separate Stock" module
    By ESBertrand in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 3 Aug 2010, 04:22 AM
  3. how to remove "units in stock" from store??
    By pglenn in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 9 Jan 2008, 11:36 PM

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