Zen Cart Logo
Forums / All Other Contributions/Addons / Minimum order for wholesale customers only.

Minimum order for wholesale customers only.

Views: 15,214

Results 21 to 40 of 60
21 May 2008, 10:09 PM
#21
marg avatar

marg

Totally Zenned

Join Date:
Mar 2004
Posts:
642
Plugin Contributions:
0

Minimum order for wholesale customers only.

What's on the line 44 in /home/fragra5/public_html/store/includes/functions/functions_general.php?

22 May 2008, 12:59 PM
#22
shokuf avatar

shokuf

New Zenner

Join Date:
Feb 2008
Posts:
56
Plugin Contributions:
0

Re: Minimum order for wholesale customers only.

header('Location: ' . $url);

22 May 2008, 6:40 PM
#23
marg avatar

marg

Totally Zenned

Join Date:
Mar 2004
Posts:
642
Plugin Contributions:
0

Re: Minimum order for wholesale customers only.

Is it possible there was a line break at the end of the file? After the closing php tag?

22 May 2008, 6:42 PM
#24
shokuf avatar

shokuf

New Zenner

Join Date:
Feb 2008
Posts:
56
Plugin Contributions:
0

Re: Minimum order for wholesale customers only.

In the functions file or class.minimum_order_amount.php?

22 May 2008, 6:44 PM
#25
marg avatar

marg

Totally Zenned

Join Date:
Mar 2004
Posts:
642
Plugin Contributions:
0

Re: Minimum order for wholesale customers only.

class.minimum_order_amount.php

22 May 2008, 6:47 PM
#26
shokuf avatar

shokuf

New Zenner

Join Date:
Feb 2008
Posts:
56
Plugin Contributions:
0

Re: Minimum order for wholesale customers only.

Nope. And I know I'm logged in as a whole account because I can see both prices. See attached. But it's letting me check out. And I have the minimum set to $200.

22 May 2008, 6:52 PM
#27
marg avatar

marg

Totally Zenned

Join Date:
Mar 2004
Posts:
642
Plugin Contributions:
0

Re: Minimum order for wholesale customers only.

I thought you had said you replaced the file with the older one... What older one file? The one that came with minimum_order?

22 May 2008, 6:54 PM
#28
shokuf avatar

shokuf

New Zenner

Join Date:
Feb 2008
Posts:
56
Plugin Contributions:
0

Re: Minimum order for wholesale customers only.

It's the one you added to.

22 May 2008, 7:03 PM
#29
marg avatar

marg

Totally Zenned

Join Date:
Mar 2004
Posts:
642
Plugin Contributions:
0

Re: Minimum order for wholesale customers only.

Hm... So for certain, line 50 look like this?
if ($_SESSION['cart']->count_contents() > 0 && $_SESSION['customers_whole'] ==1 && MIN_ORDER_AMOUNT > 0) {

22 May 2008, 7:05 PM
#30
shokuf avatar

shokuf

New Zenner

Join Date:
Feb 2008
Posts:
56
Plugin Contributions:
0

Re: Minimum order for wholesale customers only.

if ($_SESSION['cart']->count_contents() > 0 && $_SESSION['customers_whole'] == 1 && MIN_ORDER_AMOUNT > 0) {

22 May 2008, 7:08 PM
#31
marg avatar

marg

Totally Zenned

Join Date:
Mar 2004
Posts:
642
Plugin Contributions:
0

Re: Minimum order for wholesale customers only.

Did minimum_order work prior to trying to use this file?

22 May 2008, 7:10 PM
#32
shokuf avatar

shokuf

New Zenner

Join Date:
Feb 2008
Posts:
56
Plugin Contributions:
0

Re: Minimum order for wholesale customers only.

Yes. The message pops up on the shopping cart page for everyone.

22 May 2008, 8:45 PM
#33
marg avatar

marg

Totally Zenned

Join Date:
Mar 2004
Posts:
642
Plugin Contributions:
0

Re: Minimum order for wholesale customers only.

This code is incomplete... do not use the file I stated on this topic, it will not work. I am working on getting a formal contribution addition together...
Marg

6 Jun 2008, 10:26 PM
#34
keenskin avatar

keenskin

New Zenner

Join Date:
Nov 2005
Posts:
49
Plugin Contributions:
0

Re: Minimum order for wholesale customers only.

Is there a working version available yet? I can't wait to see it working

17 Dec 2008, 10:58 PM
#35
lumpylumpy avatar

lumpylumpy

New Zenner

Join Date:
Feb 2008
Posts:
27
Plugin Contributions:
0

Re: Minimum order for wholesale customers only.

Hi, i just discovered this thread.GREAT!!:clap::clap:
i have dual pricing and minimum order and wanted for a long time limit the minimim order to some customers only.
I am using 1.38a and the folowing code worked for me, i coppyed all and then pasted over in my .../includes/classes/observers/class.minimum_order_amount.php

<?php
/**
 * class.minimum_order_amount.php
 *
 * @copyright Copyright 2005-2007 Andrew Berezin eCommerce-Service.com
 * @copyright Portions Copyright 2003-2006 Zen Cart Development Team
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: config.minimum_order_amount.php 1.0.1 20.09.2007 0:06 AndrewBerezin $
 */

/**
 * Observer class used to check minimum order amount
 *
 */
class minimum_order_amount extends base {
  /**
   * constructor method
   *
   * Attaches our class to the ... and watches for 4 notifier events.
   */
  function minimum_order_amount() {
    global $zco_notifier;
//      $_SESSION['cart']->attach($this, array('NOTIFIER_CART_GET_PRODUCTS_START', 'NOTIFIER_CART_GET_PRODUCTS_END'));
    $zco_notifier->attach($this, array('NOTIFY_HEADER_END_SHOPPING_CART', 'NOTIFY_HEADER_START_CHECKOUT_SHIPPING', 'NOTIFY_HEADER_START_CHECKOUT_PAYMENT', 'NOTIFY_HEADER_START_CHECKOUT_CONFIRMATION'));
  }
  /**
   * Update Method
   *
   * Called by observed class when any of our notifiable events occur
   *
   * @param object $class
   * @param string $eventID
   */
  function update(&$class, $eventID) {
    global $messageStack;
    global $currencies;
    switch ($eventID) {
      case 'NOTIFIER_CART_GET_PRODUCTS_END':
      case 'NOTIFY_HEADER_END_SHOPPING_CART':
        if ($_SESSION['cart']->count_contents() > 0 && $_SESSION['customers_whole'] == 1 && MIN_ORDER_AMOUNT > 0) {
          if($_SESSION['cart']->show_total() < MIN_ORDER_AMOUNT) {
            $_SESSION['valid_to_checkout'] = false;
            $messageStack->add('shopping_cart', sprintf(TEXT_ORDER_UNDER_MIN_AMOUNT, $currencies->format(MIN_ORDER_AMOUNT)) . '<br />', 'caution');
          }
        }
        break;
      case 'NOTIFY_HEADER_START_CHECKOUT_SHIPPING':
      case 'NOTIFY_HEADER_START_CHECKOUT_PAYMENT':
      case 'NOTIFY_HEADER_START_CHECKOUT_CONFIRMATION':
        if ($_SESSION['cart']->count_contents() > 0 && $_SESSION['customers_whole'] == 1 && MIN_ORDER_AMOUNT > 0) {
          if($_SESSION['cart']->show_total() < MIN_ORDER_AMOUNT) {
            zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
          }
        }
        break;
      default:
        break;
    }
  }
}
?> 

Great work again Marg :clap::clap::clap::clap:
Best regards, Zoli.

21 Dec 2008, 5:21 PM
#36
lumpylumpy avatar

lumpylumpy

New Zenner

Join Date:
Feb 2008
Posts:
27
Plugin Contributions:
0

Re: Minimum order for wholesale customers only.

It's me again.As i sayd it works for me.
I think that this only works if you have the latest version of DualPrice(i have it) beacuse it relies on $_SESSION['customers_whole'] defined in /includes/modules/pages/login/header.php

Or you could do the follwing:
-create a new table in the database customers callled customers_morder (or what you want)
-edit /includes/modules/pages/login/header.php and the following
arround line 48 add customers_morder before FROM " . TABLE_CUSTOMERS . " WHERE customers_email_address = :emailAddress";

$check_customer_query = "SELECT customers_id, customers_firstname, customers_lastname, customers_password, customers_email_address, customers_default_address_id, customers_authorization, customers_referral, customers_whole, customers_morder 
FROM " . TABLE_CUSTOMERS . " WHERE customers_email_address = :emailAddress"; 

-arround line 90 after $_SESSION['customer_whole'] = $check_customer->fields['customers_whole']; add $_SESSION['customer_morder'] = $check_customer->fields['customers_morder'];

$_SESSION['customer_whole'] = $check_customer->fields['customers_whole']; 

$_SESSION['customer_morder'] = $check_customer->fields['customers_morder']; 

-change in /includes/classes/observers/class.minimum_order_amount.php (in 2 places) $_SESSION['customers_whole'] to $_SESSION['customers_morder']

  • thats all, maybe you want control this over the admin for each customer, thats also possibel.

If you want to use this feature only for wholeslae customers i suggest to upgrade your DualPricing version.
Hope this is helpfull to some one.
Best regards Zoli.

5 Jan 2009, 3:23 PM
#37
mvstudio avatar

mvstudio

Zen Follower

Join Date:
Apr 2008
Posts:
447
Plugin Contributions:
1

Re: Minimum order for wholesale customers only.

Hello, this mod is not working for me at all. Not for retail nor for wholesale.

I'm using the latest version of dual pricing and simple checkout.... any ideas on how to make this work??

Thank you in advance

5 Jan 2009, 3:34 PM
#38
mvstudio avatar

mvstudio

Zen Follower

Join Date:
Apr 2008
Posts:
447
Plugin Contributions:
1

Re: Minimum order for wholesale customers only.

One more thing, would it possible to have a field in the admin - customers area to manually enter the minimum amount order?
I have two sets of wholesale customers and with one I need a minimum amount order but not with the other.
I'm pretty sure there are others in my ame situation who would benefit tremendously by this mod.

Thank you!

6 Feb 2009, 4:07 AM
#39
bumpspt avatar

bumpspt

New Zenner

Join Date:
Dec 2008
Posts:
4
Plugin Contributions:
0

Re: Minimum order for wholesale customers only.

mvstudio:

Hello, this mod is not working for me at all. Not for retail nor for wholesale.

I'm using the latest version of dual pricing and simple checkout.... any ideas on how to make this work??

Thank you in advance

mvstudio -

I have been :frusty: this for some time now and look to have figured out a solution. So far this is working on my test site. I am by no means a programmer so it may not be the cleanest.

Feedback is always welcome.

replace code in: /includes/classes/observers/class.minimum_order_amount.php code

with the following:

<?php /** * class.minimum_order_amount.php * * @copyright Copyright 2005-2007 Andrew Berezin eCommerce-Service.com * @copyright Portions Copyright 2003-2006 Zen Cart Development Team * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: config.minimum_order_amount.php 1.0.1 20.09.2007 0:06 AndrewBerezin $ */ /** * Observer class used to check minimum order amount * */ class minimum_order_amount extends base { /** * constructor method * * Attaches our class to the ... and watches for 4 notifier events. */ function minimum_order_amount() { global $zco_notifier; // $_SESSION['cart']->attach($this, array('NOTIFIER_CART_GET_PRODUCTS_START', 'NOTIFIER_CART_GET_PRODUCTS_END')); $zco_notifier->attach($this, array('NOTIFY_HEADER_END_SHOPPING_CART', 'NOTIFY_HEADER_START_CHECKOUT_SHIPPING', 'NOTIFY_HEADER_START_CHECKOUT_PAYMENT', 'NOTIFY_HEADER_START_CHECKOUT_CONFIRMATION')); } /** * Update Method * * Called by observed class when any of our notifiable events occur * * @param object $class * @param string $eventID */ function update(&$class, $eventID) { global $messageStack; global $currencies; switch ($eventID) { case 'NOTIFIER_CART_GET_PRODUCTS_END': case 'NOTIFY_HEADER_END_SHOPPING_CART': if (isset($_SESSION['customer_id']) and $_SESSION['customer_id'] != '') { if ($_SESSION['customer_whole'] != '' > 0) { if ($_SESSION['cart']->count_contents() > 0 && MIN_ORDER_AMOUNT > 0) { if($_SESSION['cart']->show_total() < MIN_ORDER_AMOUNT) { $_SESSION['valid_to_checkout'] = false; $messageStack->add('shopping_cart', sprintf(TEXT_ORDER_UNDER_MIN_AMOUNT, $currencies->format(MIN_ORDER_AMOUNT)) . '<br />', 'caution'); } } } } break; case 'NOTIFY_HEADER_START_CHECKOUT_SHIPPING': case 'NOTIFY_HEADER_START_CHECKOUT_PAYMENT': case 'NOTIFY_HEADER_START_CHECKOUT_CONFIRMATION': if (isset($_SESSION['customer_id']) and $_SESSION['customer_id'] != '') { if ($_SESSION['customer_whole'] != '' > 0) { if ($_SESSION['cart']->count_contents() > 0 && MIN_ORDER_AMOUNT > 0) { if($_SESSION['cart']->show_total() < MIN_ORDER_AMOUNT) { zen_redirect(zen_href_link(FILENAME_SHOPPING_CART)); } } } } break; default: break; } } } ?>
6 Feb 2009, 1:14 PM
#40
bumpspt avatar

bumpspt

New Zenner

Join Date:
Dec 2008
Posts:
4
Plugin Contributions:
0

Re: Minimum order for wholesale customers only.

Let's try to make that last post a little easier to use....

<?php

/**

 * class.minimum_order_amount.php

 *

 * @copyright Copyright 2005-2007 Andrew Berezin eCommerce-Service.com

 * @copyright Portions Copyright 2003-2006 Zen Cart Development Team

 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

 * @version $Id: config.minimum_order_amount.php 1.0.1 20.09.2007 0:06 AndrewBerezin $

 */



/**

 * Observer class used to check minimum order amount

 *

 */

class minimum_order_amount extends base {

  /**

   * constructor method

   *

   * Attaches our class to the ... and watches for 4 notifier events.

   */

  function minimum_order_amount() {

    global $zco_notifier;

//      $_SESSION['cart']->attach($this, array('NOTIFIER_CART_GET_PRODUCTS_START', 'NOTIFIER_CART_GET_PRODUCTS_END'));

    $zco_notifier->attach($this, array('NOTIFY_HEADER_END_SHOPPING_CART', 'NOTIFY_HEADER_START_CHECKOUT_SHIPPING', 'NOTIFY_HEADER_START_CHECKOUT_PAYMENT', 'NOTIFY_HEADER_START_CHECKOUT_CONFIRMATION'));

  }

  /**

   * Update Method

   *

   * Called by observed class when any of our notifiable events occur

   *

   * @param object $class

   * @param string $eventID

   */

  function update(&$class, $eventID) {

    global $messageStack;

    global $currencies;

    switch ($eventID) {

      case 'NOTIFIER_CART_GET_PRODUCTS_END':

      case 'NOTIFY_HEADER_END_SHOPPING_CART':

		if (isset($_SESSION['customer_id']) and $_SESSION['customer_id'] != '') {

		  if ($_SESSION['customer_whole'] != '' > 0) {

            if ($_SESSION['cart']->count_contents() > 0 && MIN_ORDER_AMOUNT > 0) {

              if($_SESSION['cart']->show_total() < MIN_ORDER_AMOUNT) {

                $_SESSION['valid_to_checkout'] = false;

                $messageStack->add('shopping_cart', sprintf(TEXT_ORDER_UNDER_MIN_AMOUNT, $currencies->format(MIN_ORDER_AMOUNT)) . '<br />', 'caution');

			  }

			}

          }

        }

        break;

      case 'NOTIFY_HEADER_START_CHECKOUT_SHIPPING':

      case 'NOTIFY_HEADER_START_CHECKOUT_PAYMENT':

      case 'NOTIFY_HEADER_START_CHECKOUT_CONFIRMATION':
	  
	  	if (isset($_SESSION['customer_id']) and $_SESSION['customer_id'] != '') {

		  if ($_SESSION['customer_whole'] != '' > 0) {

            if ($_SESSION['cart']->count_contents() > 0 && MIN_ORDER_AMOUNT > 0) {

              if($_SESSION['cart']->show_total() < MIN_ORDER_AMOUNT) {

                zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));

			  }

			}

          }

        }

        break;

      default:

        break;

    }

  }

}

?>