Forums / Contribution-Writing Guidelines / Skeleton of modules?

Skeleton of modules?

Views: 3,645

Results 1 to 4 of 4
14 Oct 2025, 3:50 PM
#1
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Skeleton of modules?

PHP 8.4 / ZC 2.1.0

I thought I saw this mentioned in the documentation but probably track of it: is there any documentation on the minimum functions needed for any of the shipping, payment, and order_total modules? That is to say, shipment modules must have X, Y, Z class methods defined, and when each of the methods are called in relation to the process.

17 Oct 2025, 10:26 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Skeleton of modules?

Not really.
Normally there'd be no way to call one of those modules without having first run application_top, which in turn runs the init-system, which loads all the functions files and sets up autoloaders for classes ... so normally they wouldn't run into any missing dependencies.

Can you give more context?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

19 Oct 2025, 1:10 PM
#3
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: Skeleton of modules?

DrByte:

Not really.
Normally there'd be no way to call one of those modules without having first run application_top, which in turn runs the init-system, which loads all the functions files and sets up autoloaders for classes ... so normally they wouldn't run into any missing dependencies.

Can you give more context?

So there are two modules I want to work on.

  1. An "Expanded Checkout" module for PayPal using the extra functionality provided here. Pretty much the Venmo, Google Pay, Apple Pay integration buttons. This would be the payment module that I wanted to create. I wanted to make sure that I include all of the methods that need to be available to ZenCart for it to be processed. So far I have:
  • $this->update_status
  • $this->javascript_validation
  • $this->selection
  • $this->pre_confirmation_check
  • $this->confirmation
  • $this->process_button
  • $this->before_process
  • $this->after_process
  • $this->get_error
  • $this->check
  • $this->install
  • $this->remove
  • $this->keys
    As the modules' methods for that total.
  1. A Gift Card module that calls into a GiftCard API to obtain a giftcard balance and then presents it for redemption. (Sort of like the innate Gift Certificate voucher module of ZenCart but rather than use the DB, it calls a remote API). (Haven't wrote the frame of this one yet.)
19 Oct 2025, 3:01 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Skeleton of modules?

I see, ya, fair question.
I think I do have a doc somewhere on that. At the very least, all the methods that /includes/classes/payment.php (and shipping.php, order_totals.php) call without an "if method exists" check.
I'll dig and reply back.

Aside: something zcwilt was working on for ZC v3 (probably would be in Q2 2026) was a centralized set of classes and contracts (interfaces and traits) for those kinds of core modules:
https://github.com/zencart/zencart/pull/6620/files
https://github.com/zencart/documentation/pull/1290
I might revisit it next month to explore updating it and finishing it off.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.