Announcement

Collapse
No announcement yet.

Database isn't open somehow.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ids
    replied
    Initiating this from the warehouse server isn't an option.
    My initial question about the error messages, I don't see an answer coming. I am attacking that issue in a different way.

    So far it seems the only method I can update inventory that consider Basket Inventory is using that Provide XML snippet.

    I'd like to use the JSON snippet method if it can be stacked to handle all (3K+) products and gracefully ignore products that don't exist in Miva any longer:

    Code:
    {
        Edit_Product: 'shirt',
        CustomField_Values:
        {
            baskinv:
            {
                total_inv: 500
           }
       }
    }
    But, I am not seeing a way to submit this without using MvCall to call the store I am on.
    What about MvDo for json.mvc? And how does the JSON payload get passed so json.mvc will process the object as if it's s.json_data? And what function needs to be called to process this JSON string?

    Scott

    Leave a comment:


  • ILoveHostasaurus
    replied
    Can the server in the warehouse do an API call when inventory on a given product changes? Even better is it tracks what is in need of updating, or a script running on that server does, and sends batches of updates using the API multicall functionality for more efficiency by bundling the update deltas into one or a few API hits instead of one per product. Doing it that way:
    • Eliminates the security risk of opening the warehouse computer to an outside hit,
    • If you try to solve the above problem via firewall rules, it will possibly still break at some point if the source IP of the outbound requests from the site change, or end up load balanced, which may occur.
    • If the above stops working, it's not likely someone will notice until out of stock products are sold, but monitoring could go on the warehouse server side to alert if an outbound request has failed.
    • It sounds like the proposed way is going to be subjecting the store to updates of large quantities of data that often will have not changed, which creates performance and scalability issues
    • It's using a method of updating that David pointed out is a risk, as well as subject to not being supported in the future because of risks like that, which means this could break without warning for a second reason.

    Leave a comment:


  • ids
    replied
    Here are the steps in the scheduled task or clicked button in Utils:
    - MvCall grabs the inventory data from a server in the warehouse (In Utils I need to use MvAnync)
    - decode the JSON response -- contains all the products (3k) into a structured array (not a Miva product friendly array to remap)
    - running a ForEach loop to populate the XML tags
    - run the XML to update the inventory.

    The XML I'm running looks like this:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <Provision>
       <Store code="ids">
          <Product_CustomField module="baskinv" field="total_inv" product="XX001-20">1</Product_CustomField>
          <Product_CustomField module="baskinv" field="total_inv" product="XX001-40">2</Product_CustomField>
       </Store>
    </Provision>
    This should work IMO.

    Scott

    Leave a comment:


  • dcarver
    replied
    We don't recommend using PRV_Action_ProvisionStringData because it requires adding additional top-level tags, such as the Store tag and if you ever use it for user inputted data and are not careful, they could break out of the Store tag and run unauthenticated Domain level tags. Basically it's a security risk and we may end up deprecating it in the future.

    You don't have to use an SDK, I was unaware you are doing this in a Scheduled task. All JSON API functions will process s.json_data.

    What exactly are you trying to do? You talk about 3k products but what are you doing? How is this stuff needing to be updated? The JSON API supports multi requests where you could send multiple requests to be processed at once.

    Leave a comment:


  • ids
    replied
    So, I have this module done until I ran into this DB not open issue. The Provide XML tags should work. I'm using as documented. And they work in another part of the module. I don't know why I shouldn't use the PRV_Action_ProvisionStringData function. What is the issue with this?

    Also confused why I need to use an SDK to run a function that is in a scheduled task as well as running the function manually in a Utils screen tab. OR, That means using mvcall to call a system screen or mystore.com/json.mvc to be able to process s.json_data? Your suggestion would be to submit that JSON snippet above? What JSON API function will process the s.json_data?

    I have to pre-follow-through here. kinda looking ahead I guess. Your sample snippet has one product. I'm looking at over 3K products per on this project. Is there a different structure to the object or will it be your sample JSON string repeated 3k+ times? The other part of this, if the product doesn't exist what happens? Is it ignored and moves on to the next one? Or, will the process STOP processing the string?

    Leave a comment:


  • dcarver
    replied
    You could use one of the API SDKs, such as PHP, Python, NodeJS, etc... where you could build such a request and send it. But yes, that example above sends the data as a JSON object.

    Leave a comment:


  • ids
    replied
    How does this request, the JSON string(?), get passed?

    Scott

    Leave a comment:


  • dcarver
    replied
    You could use the Product_Update API function and pass a request such as
    PHP Code:
    {
        
    Edit_Product'shirt',
        
    CustomField_Values:
        {
            
    baskinv:
            {
                
    total_inv500
           
    }
       }

    Leave a comment:


  • ids
    replied
    Sorry, forgot to post the XML update needed:

    Code:
    <Product_CustomField module="baskinv" field="total_inv" product="shirt">500</Product_CustomField>
    If you've assumed that's what I meant, is that because the Product_Update function has finally been enhanced to take basket counts into consideration. It's been a while since I've looked at this function in the LSK. Looking at 10.06 Product_Update, I don't see where it handles the potential counts in a basket.

    Scott

    Leave a comment:


  • dcarver
    replied
    The Product_Update API function takes Product_Inventory as an input parameter

    Leave a comment:


  • ids
    replied
    ???

    I don't think there is a JSON API equivalent to this is there?

    Scott

    Leave a comment:


  • dcarver
    replied
    You should try avoid using PRV_Action_ProvisionStringData. If you are updating product inventory you should look into using the JSON API.

    Leave a comment:


  • ids
    replied
    Okay, this is strange stuff. The TUI error message and IMP-RND seem to be random errors thrown at me. They are related to any sort of XML Import function. Make me wonder if there is something screwy with the dev store I'm working from.

    The TUI error is found in a Branch ID function. And I have no recollection of what function or feature the RND refers to. I can't find that in the 10.06 LSK. Any guesses as to what maybe going on?

    Scott

    Leave a comment:


  • ids
    replied
    This module is running completely in the Admin ==> Utils. There are no template functions being called in my module.

    More Info: When I write the var containing the XML to a file and import to the XML import module in Data Management, I see this issue:

    Import of wildcard_admin_xmloutput.xml failed: MER-IMP-RND-00001: The import operation terminated unexpectedly.
    So, two different errors.

    Note: The XML had been validated.

    Scott
    Last edited by ids; 04-17-23, 07:11 AM.

    Leave a comment:


  • Kent Multer
    replied
    Sometimes a look in the LSK will provide some helpful clues. But sometimes Merchant seems to throw error codes that are misleading.

    The -TUI- in your error indicates a problem detected in the template UI. The -DTB- tells us it will probably be in the file features/tui/tyi_db.mv. I don't know why an XML inventory update would need to manipulate templates ... maybe your code is operating in the shopping-page world, when you meant for it to run on the admin side?

    Leave a comment:

Working...
X