Results 1 to 3 of 3

IF statement confusions.....

This is a discussion on IF statement confusions..... within the osCommerce 2.2 Modification Help forums, part of the osCommerce 2.2 Forums category; OK, I'm trying to get an order totals module to be activated/deactivated when certain conditions are met. Here's what I ...

      
  1. #1
    Member
    Join Date
    May 2004
    Posts
    31
    Rep Power
    0


    Default IF statement confusions.....

    OK, I'm trying to get an order totals module to be activated/deactivated when certain conditions are met.

    Here's what I have:

    <?php
    /*
    $Id: ot_surcharge.php,v 1.0 2003/06/19 01:13:43 hpdl wib $

    osCommerce, Open Source E-Commerce Solutions
    http://www.oscommerce.com

    Copyright (c) 2002 osCommerce

    Released under the GNU General Public License
    */

    if ($cc->cc_card_type == JCB) {
    $surch = 10;
    } else {
    $surch = 1;
    }


    class ot_surcharge {
    var $title, $output;

    function ot_surcharge() {
    $this->code = 'ot_surcharge';
    $this->title = MODULE_PAYMENT_TITLE;
    $this->description = MODULE_PAYMENT_DESCRIPTION;

    if ($surch == 10) {
    $this->enabled = ((MODULE_PAYMENT_STATUS == 'True') ? true : false);
    }

    $this->sort_order = MODULE_PAYMENT_SORT_ORDER;
    $this->include_shipping = MODULE_PAYMENT_INC_SHIPPING;
    $this->include_tax = MODULE_PAYMENT_INC_TAX;
    $this->percentage = MODULE_PAYMENT_PERCENTAGE;
    $this->minimum = MODULE_PAYMENT_MINIMUM;
    $this->calculate_tax = MODULE_PAYMENT_CALC_TAX;
    // $this->credit_class = true;
    $this->output = array();
    What I want to happen is: If the credit card type is a JCB card (as determined by the cc.php and cc_validate.php routine), make this module active - if it's something else, deactivate it.

    As it is, nothing happens - the module is deactivated no matter what card-type is used.

    What am I doing wrong?? Is the IF and ELSE statements all wrong?

    Any help would be very much appreciated - I've spent ages trying to sort this one out and it's got very, very frustrating!!

    Cheers

  2. #2
    Member
    Join Date
    Jan 2004
    Location
    edmonton, Alberta, Canada
    Posts
    62
    Rep Power
    0


    Default

    Try this
    $surch == 10;
    if ($cc->cc_card_type != JCB)
    $surch = 1;

  3. #3
    Member
    Join Date
    May 2004
    Posts
    31
    Rep Power
    0


    Default

    Thanks Pete

    Tried that, but results the same - it removes the module no matter what!

    Any other thoughts??

    Cheers

Similar Threads

  1. Help with greeting statement?
    By greg_pdq in forum osCmax v1.7 Discussion
    Replies: 1
    Last Post: 09-01-2004, 10:50 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
  •