Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2010
    Posts
    182
    Plugin Contributions
    0

    Default CC Module based on a "product" not address zone

    So - here's a good one.

    Since the CC module really should not be used, we now strictly use Authorize.net and PayPal for all credit/debit transactions. AVS gets in the way sometimes and to have the old feature of the CC Module in our back pocket would be nice.

    I would like to set it up so that if a certain product is in the cart, the CC module is triggered. (I'd set a product up for example "add this to your cart for special credit card processing")

    Here's the existing code:

    /**
    * calculate zone matches and flag settings to determine whether this module should display to customers or not
    *
    */
    function update_status() {
    global $order, $db;

    if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_CC_ZONE > 0) ) {
    $check_flag = false;
    $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_CC_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;
    }
    }
    }


    I would assume if ($check->fields['zone_id'] < 1) { should be the check->cart['product_id, but I'm a little clouded on the rest as far as the code triggered from the cart/product.

    POSSIBLE?!

  2. #2
    Join Date
    Jan 2010
    Posts
    182
    Plugin Contributions
    0

    Default Re: CC Module based on a "product" not address zone

    Answer: YES!

    //Begin Enable if products_id 6867 is in the cart
    if ($_SESSION['cart']->in_cart_check('products_id','6867') > 0) {
    $this->enabled = true;
    }
    //End new Enable code


    This was inserted after line 88 in the cc.php module - before the last }

    Replace 6867 with your product ID

  3. #3
    Join Date
    Jan 2010
    Posts
    182
    Plugin Contributions
    0

    Default Re: CC Module based on a "product" not address zone

    Although it works, a major setback results:

    When searching up an old order that used the old cc.php, this reads:

    Fatal error: Call to a member function in_cart_check() on a non-object in ....includes/modules/payment/cc.php on line 91

    What can be done about that???

 

 

Similar Threads

  1. v154 Additional "Zone Rates" option, based on order total
    By knahrvorn in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 17 Sep 2015, 06:59 PM
  2. Downloadables: Why "Delivery Address: n/a" when "Shipping Address Required"?
    By zcnb in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 13 Nov 2008, 03:55 AM
  3. How do I change "Address" to "address details as it appears on card" ?
    By Flux1231 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 12 Jun 2008, 12:42 PM
  4. Reset the "Also purchased" module in "product info"
    By Char3 in forum General Questions
    Replies: 6
    Last Post: 8 Jul 2007, 04:42 PM

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