Announcement

Collapse
No announcement yet.

Changing product price according to period

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

  • Changing product price according to period

    Hello is possible to change price of product according to date ?
    ex
    a product 15€
    between 12 august 12 septmbre 10€
    between 13 septmbre 15 october 20€
    regards

  • #2
    Hi yberges,

    Such logic can be easily implemented by Formula:
    Code:
    $a = '2022-08-12';
    $b = '2022-09-12';
    ifThen(datetime\today() >= $a && datetime\today() <= $b, costPrice = 10);
    
    $c = '2022-09-13';
    $d = '2022-10-15';
    ifThen(datetime\today() >= $c && datetime\today() <= $d, costPrice = 20);
    Create a Workflow for Product entity with `After record saved (created or updated)` Trigger Type, add `Execute Formula Script` action and paste the formula inside.
    Also, if you don't have an Advanced Pack, you can insert the formula into Administration -> Entity Manager -> Product -> Formula.

    Documentation:

    Last edited by Vadym; 07-21-2022, 02:35 PM.

    Comment


    • #3
      oki cool i will try !!!
      the first goal is
      before 1er sept : 200€
      to 2 au 29 sept : 220€
      after 29 sept : 260€
      Attached Files
      Last edited by yberges; 07-22-2022, 12:17 PM.

      Comment


      • lazovic
        lazovic commented
        Editing a comment
        Please, in lines 9, 10 and 11, replace the letters “c” and “d” with “e” and “f”, for example.
        Otherwise, the whole third part of the formula will not work correctly.

    • #4
      Hi yberges,

      As noted by the lazovic above, you need to change the c, d variables in the third part of the code to unique ones.
      Also, please note that Formula is required to put in Actions -> Execute Formula Script scope, instead Conditions scope.

      Click image for larger version

Name:	image.png
Views:	346
Size:	35.1 KB
ID:	81705

      Comment


      • #5
        hello cool i will test it thanks

        Comment


        • #6
          juste a question how i can assign this formula to one product ?

          Comment


          • lazovic
            lazovic commented
            Editing a comment
            Since you specified a Condition with a specific name, the formula will only work for that product anyway.

        • #7
          use the code in formula of the Product Entity
          Rabii
          Web Dev

          Comment


          • #8
            thanks !

            Comment

            Working...
            X