Totally Zenned
- Join Date:
- Mar 2004
- Posts:
- 642
- Plugin Contributions:
- 0
Started by pjb923 on 14 Mar 2008, 5:57 PM · Views: 15,269
Totally Zenned
New Zenner
header('Location: ' . $url);
Totally Zenned
New Zenner
In the functions file or class.minimum_order_amount.php?
Totally Zenned
New Zenner
Totally Zenned
New Zenner
Totally Zenned
New Zenner
if ($_SESSION['cart']->count_contents() > 0 && $_SESSION['customers_whole'] == 1 && MIN_ORDER_AMOUNT > 0) {
Totally Zenned
New Zenner
Yes. The message pops up on the shopping cart page for everyone.
Totally Zenned
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
M.Valenti
Contemporary Artist - Entrepreneur
http://www.manuelavalenti.com - http://www.byvalenti.com
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!
M.Valenti
Contemporary Artist - Entrepreneur
http://www.manuelavalenti.com - http://www.byvalenti.com
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.