Post by panagos » Mon Apr 25, 2016 5:49 am

Happy to report that I have released a free URL-based validation option extension for Opencart 2.2.0.0.
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.
The admin section also contains a "tester" which allows the administrator to validate the configuration with test data.

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.
Put another way, for step (e) above, if the xpath expression evaluates to false, then the validation will fail and the user will not be allowed to add the item to the cart.

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

--
Soteri Panagou
Freelance Developer and Opencart Zealot

http://www.opencart.com/index.php?route ... @gmail.com


New member

Posts

Joined
Sun Oct 25, 2015 3:01 am

Who is online

Users browsing this forum: No registered users and 1 guest