Order Callback

Entity Value
Attribute(s) None
Type javascript function
Relation moreinfo; stock;

You may want to know when a product is placed in the shoppingbasket from the moreinfo screen. You may even want to know the new current Stock value for the product that has been put in the shoppingbasket (and is being shown to the user). This can be done with a special Order Callback function. This is a javascript function which you implement in your template page, this function will be called in the event of a product being placed in the shoppingbasket.

This function has to be called event_stockChanged and needs to accept the parameters stock and productId. productId will be filled with the productnumber of the product that was placed in the shoppingbasket. stock contains the new stock value for the product.

The return value of this function has to be either true or false. From this value the system determines if it should further process the altered stock value or not. When false the system will not process the altered stock value.


                <title>Moreinfo example</title>
                <script type="text/javascript">

                        function event_stockChanged(stock,productId){

                                // This is the part where we do something with the information we got
                                // In this case we will update the displayed stock value
                                c = document.getElementById("stock");
                                        c.innerHTML = stock;

                                // Return value is false, so no further processing is needed
                                return false;

                <table style="myshop-block:product" border="1">
                                <td colspan="2" align="right">
                                        <a style="myshop-action:order">order</a>
                                        <a style="myshop-action:back">back</a>
                                <td style="myshop-label:1;font-weight:bold"></td>
                                <td style="myshop-value:1;color:red"></td>
                                <td style="myshop-label:2;font-weight:bold"></td>
                                <td style="myshop-value:2"></td>
                                <td>Currently in stock:</td>
                                <td id="stock"><span style="myshop-value:stock"></span></td>


Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment