Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
integration:modx:hmac_price_validation [2017/04/26 07:02] – external edit 127.0.0.1integration:modx:hmac_price_validation [2017/07/13 02:21] (current) – [Code] adam
Line 1: Line 1:
 ---- dataentry integration ---- ---- dataentry integration ----
-type          : integration     # do not change this line +type                           : integration # do not change this line 
-supports-foxycart-version-from : 0.7.0    # Minimum required FoxyCart version for this to work +supports-foxycart-version-from : 0.7.0 # Minimum required FoxyCart version for this to work 
-supports-foxycart-version-to   :     # Last FoxyCart version that supports this (leave empty if unknown) +supports-foxycart-version-to   :  # Last FoxyCart version that supports this (leave empty if unknown) 
-systems       : MODx Evolution                # the system(s) that the integration is for, separated with commas if more than one +systems                        MODx Revolution, MODx Evolution # the system(s) that the integration is for, separated with commas if more than one 
-name          : HMAC Price Validation                # the name of the integration +name                           : HMAC Price Validation # the name of the integration 
-description   : A plugin to automatically verify all links and forms output using MODX.                 +description                    : A plugin to automatically verify all links and forms output using MODX Revo and Evo #  
-tags          : hmac                # tags, separated by commas. don't include the "system" here. +tags                           : hmac # tags, separated by commas. don't include the "system" here. 
-date_dt       : 2011-06-28                # the date in YYYY-MM-DD format +date_dt                        : 2011-06-28 # the date in YYYY-MM-DD format 
-version                       # if you have a version for your code, enter it here +version                         # if you have a version for your code, enter it here 
-developer_url :                 # if you'd like a link back to your site, stick it here+developer_url                   # if you'd like a link back to your site, stick it here
 ---- ----
  
- 
-====== Automatic HMAC Price Validation for MODX Evolution + FoxyCart ====== 
  
 <WRAP important round> <WRAP important round>
Line 19: Line 17:
 The code on this page is submitted by members of the FoxyCart community, and may not verified by FoxyCart.com LLC in any way, shape, or form. Please double check the code before installing. If you need help with it please [[http://forum.foxycart.com/|post in our forum]], but if we cannot offer assistance (due to unfamiliarity with this particular system or language) we apologize in advance. The code on this page is submitted by members of the FoxyCart community, and may not verified by FoxyCart.com LLC in any way, shape, or form. Please double check the code before installing. If you need help with it please [[http://forum.foxycart.com/|post in our forum]], but if we cannot offer assistance (due to unfamiliarity with this particular system or language) we apologize in advance.
 </WRAP> </WRAP>
 +
 +Depending on which version of MODx you're working with - please review the different sections below, with approaches for MODx Revo and Evolution.
 +
 +
 +====== Automatic HMAC Price Validation for MODX Revo + FoxyCart ======
 +
 +===== Description =====
 +Automatically validates all links and forms on pages generated by [[http://modx.com/|MODX Revolution]], according to FoxyCart's [[:static:redirect:price_validation|HMAC Price Validation]] functionality.
 +
 +This plugin is easy to install, and should "just work", so it is recommended for all MODX Revo installs.
 +
 +Thanks to [[https://forum.foxycart.com/discussion/comment/54748/#Comment_54748|pixelchutes on our forums]] for this solution.
 +===== Installation =====
 +  - Create a directory in your ''assets/plugins'' directory called ''foxycart_validation'' (creating the ''plugins/'' folder if it doesn't already exist).
 +  - Download the source ''foxycart.cart_validation.php'' file [[https://github.com/FoxyCart/FoxyCart-Cart-Validation--PHP|here]] and put it into the newly created ''assets/plugins/foxycart_validation/'' directory.
 +  - Edit that file and enter the appropriate ''$secret'' and ''$cart_url'' values. (The ''$secret'' value is your store's API / datafeed key.)
 +  - Within MODx, under "Elements" create a plugin named "FoxyCart Validation".
 +  - Paste in the code below into the "Plugin Code" textarea.
 +  - In the "System Events" tab, check the ''OnWebPagePrerender'' checkbox.
 +  - Save the plugin.
 +  - Go to your [[https://admin.foxycart.com/|FoxyCart admin]] and enable the price validation under your "advanced" section. Save.
 +  - Test.
 +  - Test some more.
 +
 +{{ :integration:modx:modx_revo_validationplugin.png?nolink&700 |}}
 +
 +After creating the plugin - any add to cart link or forms on your website should be automatically signed for you.
 +
 +===== Requirements =====
 +  * All add to carts need to have a ''code'' attribute, and it should not have leading or trailing whitespace.
 +  * Cannot use double-pipes in an input's name.
 +  * Empty textareas are assumed to be "open".
 +
 +
 +===== Code =====
 +<code php><?php
 +/**
 + * FoxyCart Validation Plugin for MODx 2.x (Revolution)
 + */
 +
 +$e = &$modx->event;
 +switch ($e->name) {
 +  case 'OnWebPagePrerender':
 +    include $modx->config["base_path"].'assets/plugins/foxycart_validation/foxycart.cart_validation.php';
 +    $modx->resource->_output = FoxyCart_Helper::fc_hash_html($modx->resource->_output);
 +  break;
 +}
 +
 +return;
 +</code>
 +
 +====== Automatic HMAC Price Validation for MODX Evolution + FoxyCart ======
  
 ===== Description ===== ===== Description =====
Line 79: Line 129:
  
 ====== Manual HMAC Price Validation for MODX Evolution + FoxyCart ====== ====== Manual HMAC Price Validation for MODX Evolution + FoxyCart ======
- 
-<WRAP important round> 
-//**Please note:**// 
-The code on this page is submitted by members of the FoxyCart community, and may not verified by FoxyCart.com LLC in any way, shape, or form. Please double check the code before installing. If you need help with it please [[http://forum.foxycart.com/|post in our forum]], but if we cannot offer assistance (due to unfamiliarity with this particular system or language) we apologize in advance. 
-</WRAP> 
  
 ===== Description ===== ===== Description =====

Site Tools