http://www.opencart.com/index.php?route ... n_id=26485
URL-based Validator Option [VQMOD]
Supported OpenCart Versions:
v2.2.0.0
What does it do:
This plugin adds support to opencart for "URL-Based options". These types of options now contain two new properties which are used to validate the data provided by the customer when the customer tries to add the associated product to their shopping cart. The properties are:
- URL: the URL which must be called when the user adds tries to add the item to their shopping cart. It is expected that the URL will return a JSON structure that can be evaluated. This returned JSON structure is then converted into an internal XML structure.
- XPath expression: The provided expression is evaluated against the internal XML structure. Must return either true or false.
Example:
Included is very basic PHP script which will indicate whether a provided number is even or odd or unknown.
Admin Configuration:
- URL: http://OPENCART_INSTALL_URL/option_url_validation-tester-is_number_even.php?input=$INPUT
- XPATH: //is_even='YES'
On the client side the following happens:
- URL-based option is presented to the user
- The User's input replaces the $INPUT variable in the configured URL
- The URL is "downloaded" using PHP curl
- The resulting JSON is converted into an XML Structure by wrapping it around a "root" element
- The configured XPATH is evaluated against the XML structure. If it evaluates to "false" then the cart validation fails and the user is alerted of the problem, indicating the provided input is invalid. Otherwise it is alloped.
Constraints
* URL:
- Currently only HTTP-GET URLs are supported. Currently only a single variable is supported,
- User-provided input replaces $INPUT in the specified URL.
- The URL provided MUST return a JSON structure.
* The XPATH expression must be a valid xpath expression that evaluates to a boolean value.
Installation
It's recommended to install VQMod Manager to enable or disable the extension.
How to install it:
1) Unzip and upload the "vqmod" folder to the root of your OpenCart install. No files are overwritten and it's required to have vqmod installed.
Support:
panagos@gmail.com