Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

COD Payment Module set up for Shipping methods

The version has no conflicts with other payment modules in
MODULE_PAYMENT_XXXX_ACCEPTED_TYPES and has function for Shipping
in Checkout. osc_cfg_set_shipping_methods_checkbox_field.php need for
this modification.

Signed-off-by: Gergely <t-gely@freemail.hu>
  • Loading branch information...
commit 2ec9089597405baf15aa3621cf908e812263e693 1 parent b11cfcb
Tóth Gergely authored
4 osCommerce/OM/Core/Site/Admin/Module/Payment/COD.php
View
@@ -99,7 +99,8 @@ public function install() {
parent::install();
- $OSCOM_Database->simpleQuery("insert into " . DB_TABLE_PREFIX . "configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Enable Cash On Delivery Module', 'MODULE_PAYMENT_COD_STATUS', '-1', 'Do you want to accept Cash On Delivery payments?', '6', '0', 'osc_cfg_use_get_boolean_value', 'osc_cfg_set_boolean_value(array(1, -1))', now())");
+ $OSCOM_Database->simpleQuery("insert into " . DB_TABLE_PREFIX . "configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Enable Cash On Delivery Module', 'MODULE_PAYMENT_COD_STATUS', '-1', 'Do you want to accept Cash On Delivery payments?<br />', '6', '0', 'osc_cfg_use_get_boolean_value', 'osc_cfg_set_boolean_value(array(1, -1))', now())");
+ $OSCOM_Database->simpleQuery("insert into " . DB_TABLE_PREFIX . "configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Shipping methods', 'MODULE_PAYMENT_COD_ACCEPTED_SHIPPING_TYPES', '', 'Accept these shipping methods for this payment method.<br />', '6', '0', 'osc_cfg_set_shipping_methods_checkbox_field', now())");
$OSCOM_Database->simpleQuery("insert into " . DB_TABLE_PREFIX . "configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_COD_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '0', 'osc_cfg_use_get_zone_class_title', 'osc_cfg_set_zone_classes_pull_down_menu', now())");
$OSCOM_Database->simpleQuery("insert into " . DB_TABLE_PREFIX . "configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_COD_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
$OSCOM_Database->simpleQuery("insert into " . DB_TABLE_PREFIX . "configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_COD_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'osc_cfg_set_order_statuses_pull_down_menu', 'osc_cfg_use_get_order_status_title', now())");
@@ -115,6 +116,7 @@ public function install() {
public function getKeys() {
if ( !isset($this->_keys) ) {
$this->_keys = array('MODULE_PAYMENT_COD_STATUS',
+ 'MODULE_PAYMENT_COD_ACCEPTED_SHIPPING_TYPES',
'MODULE_PAYMENT_COD_ZONE',
'MODULE_PAYMENT_COD_ORDER_STATUS_ID',
'MODULE_PAYMENT_COD_SORT_ORDER');
8 osCommerce/OM/Core/Site/Shop/Module/Payment/COD.php
View
@@ -57,6 +57,14 @@ public function __construct() {
$this->_status = false;
}
}
+
+ $valid_shipping = preg_split("/[,]/", MODULE_PAYMENT_COD_ACCEPTED_SHIPPING_TYPES);
+ $selected_shipping_module = array($OSCOM_ShoppingCart->getShippingMethod('id'));
+ $check_flag = in_array($selected_shipping_module[0], $valid_shipping);
+
+ if ( $check_flag === false ) {
+ $this->_status = false;
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.