Skip to content

Custom Field Debugging#


Miva Merchant’s custom fields offer a powerful debug function designed to assist developers in diagnosing issues related to custom field usage. This debug function is invaluable when encountering challenges in reading or writing data to custom fields within the Miva Merchant environment. This documentation outlines the functionality of the debug function, its usage, and best practices for effective troubleshooting.

  • Purpose: The debug function is specifically crafted to identify and address common issues encountered during custom field implementation, such as syntax errors, typos, or references to nonexistent fields.
  • Error Output: When invoked, the debug function generates error messages highlighting encountered issues, providing valuable insights into the root cause of custom field-related problems.

Syntax#

<mvt:item name="customfields" param="Debug()" />

Output#

  • Console Display: Error messages generated by the debug function are prominently displayed in the top-right corner of the page, within the “Custom Fields Debug Console” section.
  • Error Identification: Error messages may include details such as syntax issues, product code mismatches, or missing field references, facilitating rapid issue identification and resolution.

Best Practices#

  1. Conditional Display: To prevent error messages from being visible on live sites, enclose debug function calls within conditional statements restricted to developer IP addresses.

    <mvt:if expr="s.remote_addr EQ '173.196.210.91' ">
         <mvt:item name="customfields" param="Debug()" />
     </mvt:if>
    

  2. Error Localization: Position the debug function call at the end of custom field logic to ensure comprehensive error monitoring and reporting for all preceding field operations.

Summary#

The Miva Merchant Custom Fields Debug Function serves as a vital diagnostic tool for developers navigating custom field implementation challenges. By providing real-time error feedback and insights into custom field operations, the debug function enables efficient troubleshooting and resolution of issues encountered during development and deployment. Incorporate the debug function into custom field logic to streamline error detection and enhance the robustness of Miva Merchant-powered solutions.