Prerequisites
In your template directory, for examplebenutzer/templates/translation, an information page already exists under the file name tpl_agb.htm.
The setup consists of six steps. Steps 1 to 4 concern the product detail view ws_product.htm and the design component; steps 5 and 6 concern the terms and conditions page itself.
Step 1: Include the system library and design component
Include the WEBSALE JavaScript system library together with its design component in the product detail viewws_product.htm. If you have already done so, check the version. It must be at least 1.8.1, because the AJAX functions are only included from this version onwards.
Step 2: Create the AJAX link on the product detail view
Place the link onws_product.htm that triggers the load. The onclick event calls ws_AJAXloadTemplate; the return in front prevents the browser from additionally following the link.
The four function names mentioned here you create in step 4. The names are freely chosen, they just have to match in both places.
~WS-Charset~ tag. This way, the call remains correct even if a subshop works with a different character set.
Reference: WS-LoadTpl()
Step 3: Set up display areas on the product detail view
You need three areas: one for the loading indicator, one for the error message, and one for the terms and conditions themselves. The loading and error areas start hidden, because they are only shown by the JavaScript functions.ws_agbs_content. Only this area is automatically filled by the system library, specifically from the WS-Ajax section of the same name on the terms and conditions page from step 5. The loading and error areas are pure display elements of your template and have no counterpart on the terms and conditions page.
Step 4: Create JavaScript functions in the design component
Create the four functions named in step 2 in the design component of the WEBSALE JavaScript system library. Each of them simply switches between the three areas.ws_AJAXloadAGBsError takes effect when the shop did not respond at all. ws_AJAXloadAGBsResponseError takes effect when it responded and reported an error. If you want to inform the customer differently, insert two different messages here.
Step 5: Create a WS-Ajax section on the terms and conditions page
Ontpl_agb.htm, wrap the content that is to appear in the product detail view with a WS-Ajax section. The name of the section consists of the prefix WS-Ajax- and the ID of the display area from step 3.
Wrap the section markers themselves with {ST-Ajax}. Without this bracketing, they would appear visibly in the source code on a normal call to the terms and conditions page.
Step 6: Link to the terms and conditions page without AJAX
Thanks to the bracketing from step 5, the terms and conditions page remains fully usable without AJAX. This is not optional but necessary: if JavaScript is disabled in the customer’s browser, this route is the only one. For this, integrate a normal link, for example in the footer.WS-LoadTpl() can be found in the reference.
Reference: WS-LoadTpl() 