Announcement

Collapse
No announcement yet.

SQL To Raise Permutation Prices by a Percentage?

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

    SQL To Raise Permutation Prices by a Percentage?

    A site has products that are all permutations of hidden products.

    Instead of the hidden products carrying the respective prices, the prices are set in permutations.

    Prices for permutations are in the database table Product Properties (https://community.sellerdeck.com/for...068#post104068)

    Is anyone kindly able to help me write an SQL query to do something like this?

    Code:
    Table [Product Properties]
    
    If [nType] = 8
    
    Then [nValue1]*1.1
    Thank you, SQLs are not my strong point!
    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk

    #2
    I have a solution thanks to Gustav: https://stackoverflow.com/users/3527297/gustav
    at Stack Overflow: https://stackoverflow.com/questions/...y-a-percentage

    Close Sellerdeck taking a snapshot..

    In the Sites Folder select the site in question.

    Right click on Actinic.Catalog.mdb to copy then click in while space to paste so you have a backup.

    In Access at the top click 'Create' then 'Query Design'.

    Close the 'Show Table' dialogue box that has appeared.

    Top left, Click 'View' then 'SQL View'

    In the 'Query1' Box now visible delete 'SELECT;'

    Put the cursor where 'Select' was and paste the following:

    Code:
    Update [ProductProperties]
    Set [nValue1] = [nValue1] * 1.1
    Where [nType] = 8
    Top Left click 'Run' under the red exclamation mark!

    After a few (maybe several) moments a dialogue box opens:
    You are about to update 12345 row(s).
    Once you click Yes you can't use the Undo command to reverse the changes.
    Are you sure you want to update these records?


    Click 'Yes'

    Click the 'Save' icon top left and you are offered a dialogue box to save the query, Click 'Yes' if you wish.

    Close the query and exit Access.

    Open Sellerdeck

    Your Permutation prices are now all increased by 10%

    To increase by a different amount edit
    Code:
    [nValue1] * 1.1
    in the above expression.

    So for example, a 5% increase would be:
    Code:
    [nValue1] * 1.05
    Click image for larger version  Name:	prices-permutations-after-SQL-before-and-after-SD.jpg Views:	0 Size:	115.0 KB ID:	555612

    Thank you.
    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk

    Comment


      #3
      SellerDeck usually stores prices in integer pennies so will store £0.63 as 63. But 63 * 1.1 is 69.3 which is non-integer so may be problematic. E.g. customer buys 10 off that 0.69 item but is billed 6.93.

      Code:
      Set [nValue1] = Round([nValue1] * 1.1)
      Would keep the value as an integer.
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #4
        Of course. Thank you so much Norman
        Jonathan Chappell
        Website Designer
        SellerDeck Website Designer
        Actinic to SellerDeck upgrades
        Graphicz Limited - www.graphicz.co.uk

        Comment


          #5
          I had a look at the SD database and the nValue1 field is of type Long Integer. This means that Access (tested using Office 2010) will automatically round the calculated value to the nearest integer before storing it. So my bit of code above works but is unnecessary.
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


            #6
            Very much appreciated Norman, thank you.

            Best wishes
            Jonathan Chappell
            Website Designer
            SellerDeck Website Designer
            Actinic to SellerDeck upgrades
            Graphicz Limited - www.graphicz.co.uk

            Comment

            Working...
            X