The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

MODx Revo Validation Plugin

blevayblevay Member
in General edited April 2012
Hi all,

In a current project i'm working on i was in need of setting up validation in MODx Revolution (2.2.0-pl2 specifically), and so I did a quick update of the Evo plugin part of the package. I thought some other folks might find this useful, so here it is. At this point i've only done the basic "it doesn't not work" testing so no guarantees!
<?php
/**
 * FoxyCart Validation Plugin for MODx 2.x (Revolution)
 *
 * @author Bryan Levay at Darkstar Design // bryan@darkstardesign.com // http://www.darkstardesign.com
 * @version 0.1
 * @example  http://wiki.foxycart.com/docs/cart/validation
 * 
 *
 * Requirements:
 *   - Form "code" values should not have leading or trailing whitespace.
 *   - Cannot use double-pipes in an input's name
 *   - Empty textareas are assumed to be "open"
 */
 
if (empty($results)) $results = array();

switch ($modx->event->name) {
	case "OnWebPagePrerender":
		$validate = $modx->getOption('base_path').'assets/plugins/foxycart_validation/foxycart.cart_validation.php';
		if (file_exists($validate)) {
			include_once($validate);
			$doc = $modx->resource->_output;
			$modx->resource->_output = FoxyCart_Helper::fc_hash_html($doc);
		}
		break;
 
	default:  // stop here
		return;
		break;
}
Comments
Sign In or Register to comment.