Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 7 of 7

Thread: can you do this wsi updatE?

  1. #1
    tytyguy is offline Senior Member
    Join Date
    Nov 2007
    Posts
    307

    Default can you do this wsi updatE?

    CAn you update your products by SKU instead of product/variant ID?

    <AspDotNetStorefrontImport Verbose="false">

    <Transaction>

    <Product Action="Update" SKU="1">

    <Variants>

    <Variant Action="Update" SKU="143">

    <Inventory>100</Inventory>

    </Variant>

    </Variants>

    </Product>


    </Transaction>

    </AspDotNetStorefrontImport>

  2. #2
    swheeler is offline Junior Member
    Join Date
    Oct 2008
    Posts
    17

    Default

    No. Product/Variant are the unique keys in the database.

  3. #3
    George the Great is offline Senior Member
    Join Date
    Nov 2006
    Location
    Cleveland, OH
    Posts
    1,792

    Default

    SKUs aren't guaranteed to be unique, but if you know yours are you could do something like
    Code:
    <AspDotNetStorefrontImport>
    <Query>
    <SQL>
    <![CDATA[
    update dbo.ProductVariant set Inventory=100 where SKUSuffix='143' and ProductID=(select p.ProductID from dbo.Product p where p.SKU='1')
    ]]>
    </SQL>
    </Query>
    </AspDotNetStorefrontImport>
    <a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>

  4. #4
    swheeler is offline Junior Member
    Join Date
    Oct 2008
    Posts
    17

    Default

    Now, that's powerful! Passing in an SQL UPDATE via the web service. I like it!

  5. #5
    ssgumby is offline Senior Member
    Join Date
    Feb 2009
    Posts
    683

    Default

    Quote Originally Posted by swheeler View Post
    Now, that's powerful! Passing in an SQL UPDATE via the web service. I like it!
    Powerful, yes ... dangerous, probably

    Just be careful and make sure you know what your sql WILL do.

  6. #6
    swheeler is offline Junior Member
    Join Date
    Oct 2008
    Posts
    17

    Default

    George,

    Can I pass in mulitple updates in one transaction, such as:

    <Query>
    <SQL>
    <![CDATA[
    update dbo.ProductVariant set Inventory=100 where SKUSuffix='123' and ProductID=(select p.ProductID from dbo.Product p where p.SKU='1')
    ]]>
    </SQL>
    </Query>
    <Query>
    <SQL>
    <![CDATA[
    update dbo.ProductVariant set Inventory=100 where SKUSuffix='456' and ProductID=(select p.ProductID from dbo.Product p where p.SKU='1')
    ]]>
    </SQL>
    </Query>

    Thanks,

    Scott

  7. #7
    George the Great is offline Senior Member
    Join Date
    Nov 2006
    Location
    Cleveland, OH
    Posts
    1,792

    Default

    Yeah absolutely...just as you've done
    <a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>