Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2005
    Location
    Hong Kong
    Posts
    307
    Plugin Contributions
    0

    red flag I made a mistake copying moneyorder.php

    Hi all,

    I'm using ZC1.3.8a without any major modifications.

    I know I was careless but I was in a rush to offer another payment option, so I duplicated moneyorder.php to moneyorder2.php.

    I knew something was wrong but I went ahead anyway, and now I need some help figure out how to fix this.

    The problem I'm facing is that if a customer chooses to pay by moneyorder2, everything is fine except that I get a blank page when trying to edit that particular order in admin.

    I can print invoice or packing slip, but if I click the "edit" button, all I get is the Zen Cart logo and the green buttons. Nothing shows up below that.

    My fault, I know =_=

    All I really need are 2 payment options that say "Bank-In" and "Cheque". And I'm already using moneyorder.php for "Bank-In" without any problem.

    So here is my moneyorder2.php, any help appreciated !

    Code:
    <?php
    /**
     * @package money order payment module
     * @copyright Copyright 2003-2006 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: moneyorder.php 4960 2006-11-20 01:46:46Z drbyte $
     */
    
      class moneyorder2 {
        var $code, $title, $description, $enabled;
    
    // class constructor
        function moneyorder2() {
          global $order;
    
          $this->code = 'moneyorder2';
          $this->title = MODULE_PAYMENT_MONEYORDER2_TEXT_TITLE;
          if (IS_ADMIN_FLAG === true && (MODULE_PAYMENT_MONEYORDER2_PAYTO == 'the Store Owner/Website Name' || MODULE_PAYMENT_MONEYORDER2_PAYTO == '')) $this->title .= '<span class="alert"> (not configured - needs pay-to)</span>';
          $this->description = MODULE_PAYMENT_MONEYORDER2_TEXT_DESCRIPTION;
          $this->sort_order = MODULE_PAYMENT_MONEYORDER2_SORT_ORDER;
          $this->enabled = ((MODULE_PAYMENT_MONEYORDER2_STATUS == 'True') ? true : false);
    
          if ((int)MODULE_PAYMENT_MONEYORDER2_ORDER_STATUS_ID > 0) {
            $this->order_status = MODULE_PAYMENT_MONEYORDER2_ORDER_STATUS_ID;
          }
    
          if (is_object($order)) $this->update_status();
        
          $this->email_footer = MODULE_PAYMENT_MONEYORDER2_TEXT_EMAIL_FOOTER;
        }
    
    // class methods
        function update_status() {
          global $order, $db;
    
          if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_MONEYORDER2_ZONE > 0) ) {
            $check_flag = false;
            $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_MONEYORDER2_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
            while (!$check->EOF) {
              if ($check->fields['zone_id'] < 1) {
                $check_flag = true;
                break;
              } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) {
                $check_flag = true;
                break;
              }
              $check->MoveNext();
            }
    
            if ($check_flag == false) {
              $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 array('title' => MODULE_PAYMENT_MONEYORDER2_TEXT_DESCRIPTION);
        }
    
        function process_button() {
          return false;
        }
    
        function before_process() {
          return false;
        }
    
        function after_process() {
          return false;
        }
    
        function get_error() {
          return false;
        }
    
        function check() {
          global $db;
          if (!isset($this->_check)) {
            $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_MONEYORDER2_STATUS'");
            $this->_check = $check_query->RecordCount();
          }
          return $this->_check;
        }
    
        function install() {
          global $db;
          $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 Check/Money Order Module', 'MODULE_PAYMENT_MONEYORDER2_STATUS', 'True', 'Do you want to accept Check/Money Order 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, date_added) values ('Make Payable to:', 'MODULE_PAYMENT_MONEYORDER2_PAYTO', 'the Store Owner/Website Name', 'Who should payments be made payable to?', '6', '1', 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_MONEYORDER2_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', 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_MONEYORDER2_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, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_MONEYORDER2_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())");
        }
    
        function remove() {
          global $db;
          $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
        }
    
        function keys() {
          return array('MODULE_PAYMENT_MONEYORDER2_STATUS', 'MODULE_PAYMENT_MONEYORDER2_ZONE', 'MODULE_PAYMENT_MONEYORDER2_ORDER_STATUS_ID', 'MODULE_PAYMENT_MONEYORDER2_SORT_ORDER', 'MODULE_PAYMENT_MONEYORDER2_PAYTO');
        }
      }
    ?>

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: I made a mistake copying moneyorder.php

    I would get the Debug Tool from the Free Software Add Ons and add it to your /admin as instructed to see what it reveals ...

    I used your code and made an order with it and am not getting any errors ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Sep 2005
    Location
    Hong Kong
    Posts
    307
    Plugin Contributions
    0

    Default Re: I made a mistake copying moneyorder.php

    Quote Originally Posted by Ajeh View Post
    I would get the Debug Tool from the Free Software Add Ons and add it to your /admin as instructed to see what it reveals ...

    I used your code and made an order with it and am not getting any errors ...
    Hi Ajeh, thanks for your reply. I'm surprised to hear that no error turns up on your side. Do you also have moneyorder (normal) enabled?

    I'll try your suggestion and see how things go. Thanks a lot ! :)

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: I made a mistake copying moneyorder.php

    I have both the original moneyorder.php and your moneyorder2.php ...

    Unless your error is in the language file, which I made from moneyorder.php ... there could be something else causing your issues that is only showing up now ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,262
    Plugin Contributions
    3

    Default Re: I made a mistake copying moneyorder.php

    Go to the free add-ons and download my ACCOUNT HOLDERS module. (In the payment modules section).

    This is a functionally identical working CLONE of Check/MoneyOrder.

    Use WINMERGE to compare the relevant files of the two modules (mine and the original Check/MoneyOrder) and you will see where you need to make edits.

    It's not difficult... you just need to pay attention to the detail
    19 years a Zencart User

 

 

Similar Threads

  1. Made a mistake some where...
    By cornick in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 6 Feb 2009, 05:48 AM
  2. Help! I made a mistake in my index.php!!
    By BradInOKC in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 3 Nov 2006, 10:13 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR