Skip to content

Commit

Permalink
code updates inline with Zen Cart 1.5.5a
Browse files Browse the repository at this point in the history
  • Loading branch information
Zen4All committed Oct 24, 2016
1 parent 3bcf413 commit 0f6a176
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions includes/modules/payment/cop.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<?php

//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | [email protected] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: cop.php
//
/**
* COD Payment Module
*
* @package paymentMethod
* @copyright Copyright 2016 ZeneAll
* @copyright Portions Copyright 2003-2016 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: Author: Zen4All Mon Oct 24 cop.php
*/

class cop {

Expand Down Expand Up @@ -45,7 +40,7 @@ function update_status() {
if (stristr($_SESSION['shipping']['id'], 'storepickup') == FALSE) {
$this->enabled = ((MODULE_PAYMENT_COP_STATUS == 'True') ? true : false);
$check_flag = false;
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_COP_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_COP_ZONE . "' and zone_country_id = '" . (int)$order->delivery['country']['id'] . "' order by zone_id");
while (!$check->EOF) {
if ($check->fields['zone_id'] < 1) {
$check_flag = true;
Expand All @@ -68,6 +63,11 @@ function update_status() {
$this->enabled = false;
}
}

// other status checks?
if ($this->enabled) {
// other checks here
}
}

function javascript_validation() {
Expand Down Expand Up @@ -113,7 +113,12 @@ function check() {
}

function install() {
global $db;
global $db, $messageStack;
if (defined('MODULE_PAYMENT_COP_STATUS')) {
$messageStack->add_session('COP module already installed.', 'error');
zen_redirect(zen_href_link(FILENAME_MODULES, 'set=payment&module=cop', 'NONSSL'));
return 'failed';
}
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Cash On Delivery Module', 'MODULE_PAYMENT_COP_STATUS', 'True', 'Do you want to accept Cash On Pickup payments?', '6', '1', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
$db->Execute("insert into " . TABLE_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_COP_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_COP_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
Expand Down

0 comments on commit 0f6a176

Please sign in to comment.