Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / limited payment methods only with one categories

limited payment methods only with one categories

Locked

Views: 2,424

Results 1 to 16 of 16
This thread is locked. New replies are disabled.
19 Sep 2009, 3:54 PM
#1
thenax avatar

thenax

New Zenner

Join Date:
Jun 2009
Posts:
67
Plugin Contributions:
0

limited payment methods only with one categories

is it possible to limit payment methods (only credit card) on one category or a group of ten products?
now you can pay the items with credit card, cash or paypal.

How?

20 Sep 2009, 3:06 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: limited payment methods only with one categories

You can do this by controlling the $this->enabled in any of the modules ...

When set to false, the module will not show ... when set to true, the module will show ...

20 Sep 2009, 5:21 PM
#3
thenax avatar

thenax

New Zenner

Join Date:
Jun 2009
Posts:
67
Plugin Contributions:
0

Re: limited payment methods only with one categories

for example if i want paypal disabled for master category 103 , what have I do?

20 Sep 2009, 7:06 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: limited payment methods only with one categories

In PayPal IPN, paypal.php, you can change this function:

  function update_status() {
    global $order, $db;

    if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYPAL_ZONE > 0) ) {
      $check_flag = false;
      $check_query = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
      while (!$check_query->EOF) {
        if ($check_query->fields['zone_id'] < 1) {
          $check_flag = true;
          break;
        } elseif ($check_query->fields['zone_id'] == $order->billing['zone_id']) {
          $check_flag = true;
          break;
        }
        $check_query->MoveNext();
      }

      if ($check_flag == false) {
        $this->enabled = false;
      }
    }
  }

to read:

  function update_status() {
    global $order, $db;

    if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYPAL_ZONE > 0) ) {
      $check_flag = false;
      $check_query = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
      while (!$check_query->EOF) {
        if ($check_query->fields['zone_id'] < 1) {
          $check_flag = true;
          break;
        } elseif ($check_query->fields['zone_id'] == $order->billing['zone_id']) {
          $check_flag = true;
          break;
        }
        $check_query->MoveNext();
      }

      if ($check_flag == false) {
        $this->enabled = false;
      }
    }

[B]    global $cart;
    if ($_SESSION['cart']->in_cart_check('master_categories_id','103') > 0) {
        $this->enabled = false;
    }[/B]

  }
20 Sep 2009, 8:03 PM
#5
thenax avatar

thenax

New Zenner

Join Date:
Jun 2009
Posts:
67
Plugin Contributions:
0

Re: limited payment methods only with one categories

thank you very much! it works but '103' is a sub category! Now I would like that it works with category '100' that includes sub-categories 103 104 105. If I change '103' into '100' doesn't operate.
thank you for helping me!

21 Sep 2009, 4:07 AM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: limited payment methods only with one categories

You would need to include each specific master_categories_id for this method to work ...

25 Sep 2009, 5:18 PM
#7
kobra8 avatar

kobra8

Zen Follower

Join Date:
Mar 2009
Location:
Serbia
Posts:
350
Plugin Contributions:
0

Re: limited payment methods only with one categories

Hi,
I want to have 2 categori of product.
When customer order product in 1 categori hi get page for pay.
Byt when order product from 1 end 2 categori I want to forbit to get page for paying.

Becouse some product can't send to customer tugeder with anader product.

https://www.kavanali.com

25 Sep 2009, 5:46 PM
#8
kobra8 avatar

kobra8

Zen Follower

Join Date:
Mar 2009
Location:
Serbia
Posts:
350
Plugin Contributions:
0

Re: limited payment methods only with one categories

I want to have 2 categori of product.
When customer order product in 1 categori hi get page for pay.
Byt when order product from 1 end 2 categori I want to forbit to get page for paying.

Becouse some product can't send to customer tugeder with anader product.

https://www.kavanali.com

26 Sep 2009, 2:06 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: limited payment methods only with one categories

You could change the code to read:

  function update_status() {
    global $order, $db;

    if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYPAL_ZONE > 0) ) {
      $check_flag = false;
      $check_query = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
      while (!$check_query->EOF) {
        if ($check_query->fields['zone_id'] < 1) {
          $check_flag = true;
          break;
        } elseif ($check_query->fields['zone_id'] == $order->billing['zone_id']) {
          $check_flag = true;
          break;
        }
        $check_query->MoveNext();
      }

      if ($check_flag == false) {
        $this->enabled = false;
      }
    }

[B]    global $cart;
    if ($_SESSION['cart']->in_cart_check('master_categories_id','103') > 0 && $_SESSION['cart']->in_cart_check('master_categories_id','105') {
        $this->enabled = false;
    }[/B]

  }

Where the categories_id for 103 and 105 are the master_categories_id for these products that cannot sell together ...

26 Sep 2009, 2:19 PM
#10
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: limited payment methods only with one categories

What is the basic problem? Can the products just not be shipped together? Or is there another reason they can't be ordered together? If they are going to be shipped to the same location by different carriers or from different sources, you can set payment/shipping methods to account for the cost of two shipments.
We need more details to be able to give the best advice.

26 Sep 2009, 2:37 PM
#11
kobra8 avatar

kobra8

Zen Follower

Join Date:
Mar 2009
Location:
Serbia
Posts:
350
Plugin Contributions:
0

Re: limited payment methods only with one categories

Hi, the problem is:

1.The carriers is the same.
2.The customer is the same, product be shipped to the same location.
3.The product are shipped from different sources, please.

Hay to set thet some product can't shipped together?

27 Sep 2009, 2:54 AM
#12
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: limited payment methods only with one categories

So you can't separate the items in the order and have each manufacturer ship its items to the customer?

It's really unfriendly to tell a customer who already has two items in his cart that now he can't buy them. What you may want to do, if you really and truly can't handle both items being paid for in the same order, is to check at the "add to cart" step and if one of these categories/products is in the cart, prevent the other from being added to the cart with a nice message saying "This product cannot be purchased at the same time as products from xxx category. Please check out with your current order, and order this product separately."

I still think you will have better customer relations if you figure out how to let them buy the products in the same order.

27 Sep 2009, 10:39 AM
#13
kobra8 avatar

kobra8

Zen Follower

Join Date:
Mar 2009
Location:
Serbia
Posts:
350
Plugin Contributions:
0

Re: limited payment methods only with one categories

gjh42:

What you may want to do, if you really and truly can't handle both items being paid for in the same order, is to check at the "add to cart" step and if one of these categories/products is in the cart, prevent the other from being added to the cart with a nice message saying "This product cannot be purchased at the same time as products from xxx category. Please check out with your current order, and order this product separately.".

Hay to make to some product, category can't bay at the same time, in the same order !?

Becouse product A sent from one plase, product B from anather please, do the same costumer.
The costumer order product A, then make new order for product B.
I know thet is litle complicate for costumer, when bay more then 1 product.

28 Sep 2009, 2:11 PM
#14
kobra8 avatar

kobra8

Zen Follower

Join Date:
Mar 2009
Location:
Serbia
Posts:
350
Plugin Contributions:
0

Re: limited payment methods only with one categories

Somebody!!!

5 Oct 2009, 10:57 AM
#15
kobra8 avatar

kobra8

Zen Follower

Join Date:
Mar 2009
Location:
Serbia
Posts:
350
Plugin Contributions:
0

Re: limited payment methods only with one categories

Hi, I put in table.php code, thet some categories can't sell tugeder (in same order).
I have master categori 3 end 39, product from thare can't sell tugeder.

The modul don't work!
I get blank page.
Something I mistake, byt I don't know what!!!!!

CODE of table.php:
.....................................................................
if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_TABLE_ZONE > 0) ) {
$check_flag = false;
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_TABLE_ZONE . "' and zone_country_id = '" . $order->delivery['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->delivery['zone_id']) {
$check_flag = true;
break;
}
$check->MoveNext();
}

  if ($check_flag == false) {
    $this->enabled = false;
  }
}

global $cart;
if ($_SESSION['cart']->in_cart_check('master_categories_id','3') > 0 && $_SESSION['cart']->in_cart_check('master_categories_id','39') {
    $this->enabled = false;

}

}
/**

  • I PUT CODE UP HERE ^
  • @param unknown_type $method
  • @return unknown
    */
    function quote($method = '') {
    global $order, $shipping_weight, $shipping_num_boxes, $total_count;
// shipping adjustment
switch (MODULE_SHIPPING_TABLE_MODE) {
  case ('price'):
    $order_total = $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;
    break;
  case ('weight'):
    $order_total = $shipping_weight;
    break;
  case ('item'):
    $order_total = $total_count - $_SESSION['cart']->free_shipping_items();
    break;
}

....................................................................

17 Oct 2009, 7:01 PM
#16
smarmyclothes avatar

smarmyclothes

New Zenner

Join Date:
Feb 2009
Posts:
36
Plugin Contributions:
0

Re: limited payment methods only with one categories

:clap: for this thread and a question...

I am trying to remove the Paypal Express payment option for category 29, but so far I haven't been able to get it to work.

I have used this method to remove the money order option from other categories successfully, but the Paypal Express module is giving me trouble.

I'm thinking the added code (in red) is not in the correct place, but I don't know much about php and am unsure of where it should go. Any help is much appreciated!

Here's what I have now, in paypalwpp.php:

function update_status() {

    global $order, $db;

    if ($this->enabled && (int)$this->zone > 0) {

      $check_flag = false;

      $sql = "SELECT zone_id

              FROM " . TABLE_ZONES_TO_GEO_ZONES . "

              WHERE geo_zone_id = :zoneId

              AND zone_country_id = :countryId

              ORDER BY zone_id";

      $sql = $db->bindVars($sql, ':zoneId', $this->zone, 'integer');

      $sql = $db->bindVars($sql, ':countryId', $order->billing['country']['id'], 'integer');

      $check = $db->Execute($sql);

      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) {

        $this->enabled = false;

      }
	  
	  
	  
	   global $cart;
    if ($_SESSION['cart']->in_cart_check('master_categories_id','29') > 0) {
        $this->enabled = false;
    
    }


      // module cannot be used for purchase > $10,000 USD

      $order_amount = $this->calc_order_amount($order->info['total'], 'USD');

      if ($order_amount > 10000) $this->enabled = false;
	  
	 

    }

  }