Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

checkout problems, duplicated shipping and payment modules


Juto

Recommended Posts

Hi, I have two problems, first I have duplicated table.rate and created an "economymaildelivery" and a "prioritymaildelivery", also I have a "storepickup". They are assigned to shipping zone "Domestic", which contains my countrys iso-2 code. These seems to work although osC selects the cheapest method and none is displayed. (:

 

I also have enabled check/money order and a duplicate of COD (payment zone "none") to have a CashOnPickup, payment zone "Domestic".

 

But on the checkout process stopped at payment method, giving these errors

 

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Date / Time: 22-02-2013 18:52:05

Error Type: [E_NOTICE] Undefined index:

On line 68

File includes/classes/payment.php

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

 

Date / Time: 22-02-2013 18:52:06

Error Type: [E_NOTICE] Undefined variable:

On line 59

File checkout_confirmation.php

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

 

So it isn't that simple to duplicate a payment method ... Here's my CashOnPickup module:

 

<?php
/*
 CashOnPickup.php
 Based on
 $Id: cod.php 1739 2007-12-20 00:52:16Z hpdl $
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2003 osCommerce
 Released under the GNU General Public License
*/
 class CashOnPickup {
   var $code, $title, $description, $enabled;
// class constructor
   function CashOnPickup() {
  global $order;
  $this->code = 'CashOnPickup';
  $this->title = (defined('MODULE_PAYMENT_CASHONPICKUP_TEXT_TITLE') ? MODULE_PAYMENT_CASHONPICKUP_TEXT_TITLE : null);
  $this->description = (defined('MODULE_PAYMENT_CASHONPICKUP_TEXT_DESCRIPTION') ? MODULE_PAYMENT_CASHONPICKUP_TEXT_DESCRIPTION : null);
  $this->sort_order = (defined('MODULE_PAYMENT_CASHONPICKUP_SORT_ORDER') ? MODULE_PAYMENT_CASHONPICKUP_SORT_ORDER : 0);
  $this->enabled = ((defined('MODULE_PAYMENT_CASHONPICKUP_STATUS') && (MODULE_PAYMENT_CASHONPICKUP_STATUS == 'true')) ? true : false);
  if (defined('MODULE_PAYMENT_CASHONPICKUP_ORDER_STATUS_ID') && ((int)MODULE_PAYMENT_CASHONPICKUP_ORDER_STATUS_ID > 0) ) {
    $this->order_status = MODULE_PAYMENT_CASHONPICKUP_ORDER_STATUS_ID;
  }
  if (is_object($order)) $this->update_status();
   }
// class methods
   function update_status() {
  global $order;
  if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_CASHONPICKUP_ZONE > 0) ) {
    $check_flag = false;
    $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_CASHONPICKUP_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
    while ($check = tep_db_fetch_array($check_query)) {
	  if ($check['zone_id'] < 1) {
	    $check_flag = true;
	    break;
	  } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
	    $check_flag = true;
	    break;
	  }
    }
    if ($check_flag == false) {
	  $this->enabled = false;
    }
  }
// disable the module if the order only contains virtual products
  if ($this->enabled == true) {
    if ($order->content_type == 'virtual') {
	  $this->enabled = false;
    }
  }
   }
   function javascript_validation() {
  return false;
   }
   function selection() {
  return array('id' => $this->code,
			   'module' => $this->title);
   }
   function pre_confirmation_check() {
  return false;
   }
   function confirmation() {
  return false;
   }
   function process_button() {
  return false;
   }
   function before_process() {
  return false;
   }
   function after_process() {
  return false;
   }
   function get_error() {
  return false;
   }
   function check() {
  if (!isset($this->_check)) {
    $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_CASHONPICKUP_STATUS'");
    $this->_check = tep_db_num_rows($check_query);
  }
  return $this->_check;
   }
   function install() {
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Payment on Pickup Module', 'MODULE_PAYMENT_CASHONPICKUP_STATUS', 'True', 'Do you want to accept Cash on Pickup payments?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  tep_db_query("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_CASHONPICKUP_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
  tep_db_query("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_CASHONPICKUP_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
  tep_db_query("insert into " . TABLE_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_CASHONPICKUP_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
  }
   function remove() {
  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
   }
   function keys() {
  return array('MODULE_PAYMENT_CASHONPICKUP_STATUS', 'MODULE_PAYMENT_CASHONPICKUP_ZONE', 'MODULE_PAYMENT_CASHONPICKUP_ORDER_STATUS_ID', 'MODULE_PAYMENT_CASHONPICKUP_SORT_ORDER');
   }
 }
?>

 

I then removed this payment module keeping only the money/check order and the above errors disappeared.

 

 

So what's wrong with the above? Or is it perhaps a DB problem?

 

I have also tried: http://addons.oscommerce.com/info/6269 but the problem with the cheapest shipping method wasn't gone... :(

 

Please, give me a hand on this.

 

Sara

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...