Results 1 to 1 of 1
  1. #1
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    3,505
    Plugin Contributions
    33

    Default /includes/modules/payment/paypal.php: What's this code supposed to do?

    In v1.5.1, the instantiation function for the paypal class (in /includes/modules/payment/paypal.php) reads:
    Code:
      function paypal($paypal_ipn_id = '') {
        global $order, $messageStack;
        $this->code = 'paypal';
        $this->codeVersion = '1.5.1';
        if (IS_ADMIN_FLAG === true) {
          // Payment Module title in Admin
          $this->title = STORE_COUNTRY != '223' ? MODULE_PAYMENT_PAYPAL_TEXT_ADMIN_TITLE_NONUSA : MODULE_PAYMENT_PAYPAL_TEXT_ADMIN_TITLE;
          if (IS_ADMIN_FLAG === true && defined('MODULE_PAYMENT_PAYPAL_IPN_DEBUG') && MODULE_PAYMENT_PAYPAL_IPN_DEBUG != 'Off') $this->title .= '<span class="alert"> (debug mode active)</span>';
          if (IS_ADMIN_FLAG === true && MODULE_PAYMENT_PAYPAL_TESTING == 'Test') $this->title .= '<span class="alert"> (dev/test mode active)</span>';
        } else {
          $this->title = MODULE_PAYMENT_PAYPAL_TEXT_CATALOG_TITLE; // Payment Module title in Catalog
        }
        $this->description = MODULE_PAYMENT_PAYPAL_TEXT_DESCRIPTION;
        $this->sort_order = MODULE_PAYMENT_PAYPAL_SORT_ORDER;
        $this->enabled = ((MODULE_PAYMENT_PAYPAL_STATUS == 'True') ? true : false);
        if ((int)MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID > 0) {
          $this->order_status = MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID;
        }
        if (is_object($order)) $this->update_status();
        $this->form_action_url = 'https://' . MODULE_PAYMENT_PAYPAL_HANDLER;
    
        if (PROJECT_VERSION_MAJOR != '1' && substr(PROJECT_VERSION_MINOR, 0, 3) != '5.0') $this->enabled = false;
    
        // verify table structure
        if (IS_ADMIN_FLAG === true) $this->tableCheckup();
      }
    What's the purpose of the line that I've colored red? If it's meant to cause the payment module to work only on the version of Zen Cart with which it's released, it's probably a good thing that the clause is flawed because no one would ever have paypal active on v1.5.1!

    If the clause is meant to limit the module's function only to a specific Zen Cart version, it should be written as
    Code:
    if (PROJECT_VERSION_MAJOR != '1' || substr(PROJECT_VERSION_MINOR, 0, 3) != '5.0') $this->enabled = false;
    Oh, and for v1.5.1 the last comparison would probably want to be changed, too.

    If that's not what the clause is meant for, please fill in my blanks.

    Note: Similar clauses exist in both the paypaldp and paypalwpp modules, with different minor version comparison values ...
    Last edited by lat9; 28 Apr 2013 at 03:04 PM.

 

 

Similar Threads

  1. v150 PHP Fatal error: Out of memory in includes/modules/attributes.php
    By donnyb in forum General Questions
    Replies: 0
    Last Post: 6 Apr 2012, 12:15 AM
  2. Warning: main(/web/zen-cart/includes/languages/english/modules/payment/header_php.php
    By Coffee1 in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 16 Jul 2009, 07:37 AM
  3. Replies: 3
    Last Post: 21 Jan 2009, 04:13 PM
  4. /includes/languages/spanish/modules/payment/paypal.php: no such file or directory
    By thosecars82 in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 2 Oct 2008, 06:45 PM
  5. Is this lne of code in payment.php correct
    By IanEtche in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 4 Dec 2006, 07:18 PM

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
  •