We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2759
    • 21 Posts
    Hello,

    I need a sollution for the following scenario.

    My modX website has a listing of widgets for sale. There are 20 available. A user fills out a simple form and buys 2 widgets. The form is just e-mailed to the operator of the site.

    How do I decrement the number available so that the next person that visits the widgets page sees the correct number of widgets available, which would be 18 in this case?

    I know that full blown ecommerce apps such as oscommerce handles such but, I really don’t want to try incorporating an ecommerce sollution for just this one variable.

    How would something like this be handled? Is it possible?

    Any help is appreciated.

    Thanks
    ___________
    Banta
      • 34162
      • 1 Posts
      Interesting question! The amount of widgets could be stored in a chunk. And the required calculation could be done using a snippet.
      However, the snippet must be triggered by a form-element, providing the parameter of how many items do decrement.
      Is it possible to link a snippet to a form/submit()? I don’t know it - but I would like to know it! laugh
      Anyone?
        • 2759
        • 21 Posts
        No Ideas on this?

        Is there an existing module that I can pick apart that might handle it?

        Thanks
          • 34162
          • 1 Posts
          In the meantime I posted my version of your question here:
          http://modxcms.com/forums/index.php/topic,5971.msg42317.html#msg42317
          I think if you read the replies you’ll get an idea of how to do the decrement using a form/snippet combo.