Skip to content

Coding Standards

Use simple, conventional OpenCart code. These standards are practical guardrails, not a separate framework.

PHP

  • Follow PSR-12 where compatible with OpenCart conventions.
  • Prefer OpenCart's established controller, model, language, and template patterns.
  • Keep class names, routes, and file paths canonical for OpenCart.
  • Avoid premature abstraction and generic service layers without a current use case.
  • Keep validation close to the admin/controller flow unless a shared schema is justified.

Twig

  • Keep templates readable and scoped to presentation.
  • Avoid business logic in templates.
  • Prefer canonical OpenCart fallback behaviour where useful.
  • Keep theme-specific template names aligned with shop3_ naming where custom entities are introduced.

CSS and JavaScript

  • Keep storefront assets lightweight.
  • Prefer progressive enhancement.
  • Avoid heavy dependencies without architecture justification.
  • Document new build or asset steps before introducing them.

Review Rule

If code deviates from OpenCart conventions, the PR Notes must explain why the deviation is needed and how compatibility is protected.