this article last updated: February 7, 2014 Due to inevitable changes that will be made to the shopping cart software over time, the cart's variable and database structure may change from time to time without advanced notice. We will attempt to keep the information in this article up-to-date, but Modular Merchant makes no guarantee as to the accuracy of the information provided in this article. Use this information at your own risk.
working with storefront errors, warnings and notices
"Are the error, warning and notice messages displayed in the storefront held in a variable that I can access in my templates? If so, how is that data formatted?"
— Sincerely, a robot from the future
Yes, these items are stored in several PHP arrays, and these arrays are accessible in PHP code that runs in a template. Here's examples of each:
Notices
By default, notices are displayed in a storefront template by using the {NOTICES} QuickCode Tag. This tag prints out each of the messages that are currently being stored in the "notices" PHP array, if any. The name of this array is $_SESSION[mmid()]['notices'].
The array of notices is reset every time a storefront page is loaded, unless the variable retain_notices=Y is included in the page's $_REQUEST data.
Warnings
By default, notices are displayed in a storefront template by using the {WARNINGS} QuickCode Tag. This tag prints out each of the messages that are currently being stored in the "warnings" PHP array, if any. The name of this array is $_SESSION[mmid()]['warnings'].
The array of warnings is reset every time a storefront page is loaded, unless the variable retain_warnings=Y is included in the page's $_REQUEST data.
Errors
By default, notices are displayed in a storefront template by using the {ERRORS} QuickCode Tag. This tag prints out each of the messages that are currently being stored in the "errors" PHP array, if any. The name of this array is $_SESSION[mmid()]['errors'].
The array of errors is reset every time a storefront page is loaded, unless the variable retain_errors=Y is included in the page's $_REQUEST data.
replace quickcode tags at your own risk
Replacing the {MESSAGES}, {WARNINGS} and {ERRORS} QuickCode tags with your own custom PHP code to display their content is certainly something that can be done in your store's templates. However, be aware that doing so may prevent your storefront from being PCI Compliant. Resolving PCI Compliance vulnerabilities introduced by custom code may incur additional fees.
|