Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lewis Smith 192 posts 577 karma points c-trib
    Jan 23, 2018 @ 16:27
    Lewis Smith
    0

    Web Service to update products.

    Hi,

    I need to create a web service that can update product information in umbraco. For example, the web service would need to hook into the database, and update products such as changing the price / updating the total quantity.

    The website I'm creating sells bespoke items meaning they only sell one at a time. We also sell on other websites, so I basically need the quantity to update based on their sales.

    In how many places is the quantity, price etc defined in the database? Can this be edited directly in the database instead of going through Umbraco?

    Could anyone give me some guidance on the best way of doing this!

    Thanks, Lewis

  • Lewis Smith 192 posts 577 karma points c-trib
    Jan 24, 2018 @ 09:11
    Lewis Smith
    0

    So I have gone through the databases and found out I can update the stock which will take the product off the website. WIN!

    SELECT n.id, n.text, s.stock, c.xml
    FROM cmsContentXml c, umbracoNode n, TeaCommerce_Stock s
    WHERE n.id = s.sku
    AND [xml] LIKE '%product%'
    AND [xml] LIKE '%UniqueReferenceHere%' 
    

    Then I can just return the ID and then update the stock level to 0

    UPDATE TeaCommerce_Stock
    SET stock = 0.000000
    WHERE sku = 1304;
    

    This is a good start and semi achieves what I need, but I need something that waits for changes on another database, then once a change has been made updates this website's database.

    I'm fairly new to SQL so I'm not even sure what to google! Is there anything that anyone knows of that is like an onChangeListener that once a change is made a task can be run?

    Also, for removing the item from the database instead of just setting the stock to 0 which will stop it showing, is there anything wrong with just removing the item from cmsContentXml? I'm assuming that this is referenced in other places, will anything break if I just remove the product from this one table?

    Thanks, Lewis

Please Sign in or register to post replies

Write your reply to:

Draft