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?
Views: 15,214
Totally Zenned
What's on the line 44 in /home/fragra5/public_html/store/includes/functions/functions_general.php?
New Zenner
header('Location: ' . $url);
Totally Zenned
Is it possible there was a line break at the end of the file? After the closing php tag?
New Zenner
In the functions file or class.minimum_order_amount.php?
Totally Zenned
class.minimum_order_amount.php
New Zenner
Totally Zenned
I thought you had said you replaced the file with the older one... What older one file? The one that came with minimum_order?
New Zenner
Totally Zenned
Hm... So for certain, line 50 look like this?
if ($_SESSION['cart']->count_contents() > 0 && $_SESSION['customers_whole'] ==1 && MIN_ORDER_AMOUNT > 0) {
New Zenner
if ($_SESSION['cart']->count_contents() > 0 && $_SESSION['customers_whole'] == 1 && MIN_ORDER_AMOUNT > 0) {
Totally Zenned
Did minimum_order work prior to trying to use this file?
New Zenner
Yes. The message pops up on the shopping cart page for everyone.
Totally Zenned
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
New Zenner
Is there a working version available yet? I can't wait to see it working
New Zenner
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.
New Zenner
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']
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.
Zen Follower
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
Zen Follower
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!
New Zenner
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; } } } ?>New Zenner
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;
}
}
}
?>
Tell staff why this post should be reviewed.