Skip to content

Commit

Permalink
Merge pull request zencart#6452 from scottcwilson/add_enabled_notifier
Browse files Browse the repository at this point in the history
Add notifier for shipping modules so sites can create exceptions
  • Loading branch information
drbyte authored May 15, 2024
2 parents 7cd4d6d + 7276e68 commit df71a8e
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 4 deletions.
9 changes: 8 additions & 1 deletion includes/modules/shipping/flat.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @version $Id: Scott C Wilson 2022 Oct 16 Modified in v1.5.8a $
*/

class flat {
class flat extends base {

/**
* $_check is used to check the configuration key set up
Expand Down Expand Up @@ -105,6 +105,13 @@ function update_status() {
$this->enabled = false;
}
}

if ($this->enabled) {
// -----
// Give a watching observer the opportunity to disable the overall shipping module.
//
$this->notify('NOTIFY_SHIPPING_FLAT_UPDATE_STATUS', [], $this->enabled);
}
}

function quote($method = '') {
Expand Down
6 changes: 6 additions & 0 deletions includes/modules/shipping/freeoptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ protected function checkForFreeOptions()
// are met.
//
$this->enabled = ($freeoptions_total === true || $freeoptions_weight === true || $freeoptions_items === true);
if ($this->enabled) {
// -----
// Give a watching observer the opportunity to disable the overall shipping module.
//
$this->notify('NOTIFY_SHIPPING_FREEOPTIONS_UPDATE_STATUS', [], $this->enabled);
}
}

// -----
Expand Down
9 changes: 8 additions & 1 deletion includes/modules/shipping/freeshipper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @version $Id: Scott C Wilson 2022 Oct 16 Modified in v1.5.8a $
*/
//
class freeshipper {
class freeshipper extends base {

/**
* $_check is used to check the configuration key set up
Expand Down Expand Up @@ -105,6 +105,13 @@ function update_status() {
$this->enabled = false;
}
}

if ($this->enabled) {
// -----
// Give a watching observer the opportunity to disable the overall shipping module.
//
$this->notify('NOTIFY_SHIPPING_FREESHIPPER_UPDATE_STATUS', [], $this->enabled);
}
}

function quote($method = '') {
Expand Down
9 changes: 8 additions & 1 deletion includes/modules/shipping/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/


class item {
class item extends base {

/**
* $_check is used to check the configuration key set up
Expand Down Expand Up @@ -107,6 +107,13 @@ function update_status() {
$this->enabled = false;
}
}

if ($this->enabled) {
// -----
// Give a watching observer the opportunity to disable the overall shipping module.
//
$this->notify('NOTIFY_SHIPPING_ITEM_UPDATE_STATUS', [], $this->enabled);
}
}

function quote($method = '') {
Expand Down
7 changes: 7 additions & 0 deletions includes/modules/shipping/perweightunit.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ function update_status() {
$this->enabled = false;
}
}

if ($this->enabled) {
// -----
// Give a watching observer the opportunity to disable the overall shipping module.
//
$this->notify('NOTIFY_SHIPPING_PERWEIGHTUNIT_UPDATE_STATUS', [], $this->enabled);
}
}
/**
* Obtain quote from shipping system/calculations
Expand Down
5 changes: 4 additions & 1 deletion includes/modules/shipping/storepickup.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ function update_status() {

// other status checks?
if ($this->enabled) {
// other checks here
// -----
// Give a watching observer the opportunity to disable the overall shipping module.
//
$this->notify('NOTIFY_SHIPPING_STOREPICKUP_UPDATE_STATUS', [], $this->enabled);
}
}
/**
Expand Down
7 changes: 7 additions & 0 deletions includes/modules/shipping/table.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ function update_status() {
$this->enabled = false;
}
}

if ($this->enabled) {
// -----
// Give a watching observer the opportunity to disable the overall shipping module.
//
$this->notify('NOTIFY_SHIPPING_TABLE_UPDATE_STATUS', [], $this->enabled);
}
}
/**
* Obtain quote from shipping system/calculations
Expand Down

0 comments on commit df71a8e

Please sign in to comment.