Hi,
I need to restrict the items added in shopping cart.
only one item should be added at a time!!
is there any fix?
Hi,
I need to restrict the items added in shopping cart.
only one item should be added at a time!!
is there any fix?
If you mean you only want your customers to be able to buy one item at a time (I'd be interested in the explanation for that), there's a mod here: http://www.zen-cart.com/index.php?ma...oducts_id=1259 that limits the amount of an order. You might be able to adapt it (or use as is if all your products are the same price).
Thanks For ur reply!!
Once when i fix it will update here ASAP!!!
Your mod was to restrict the qty of items.
But my issue is to restrict no of products added...
for example, there are 3 prod A,B,C
The user must be able to checkout only product A.
If suppose he goes back and selects product B, it should not be added with prod A.
Instead only product B must be displayed.
Hope you got my issue!!
help needed!!
I constructed that module, based on Andrew Berezin's excellent MINIMUM ORDER VALUE module.
While it might be possible to add more conditionals to that module, the format you are proposing may be quite a challenge.
PS: Please don't ask me to do it (I am very busy right now!)
And while I don't know why you are proposing to set these restrictions, it seems a sure fire way to me to drive customers AWAY from your business.
if you download that module, look in the file called:
class.maximum_order_amount.php
You will see:-
Try doing this to the above section:PHP Code:
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 && MAX_ORDER_AMOUNT > 0) {
if($_SESSION['cart']->show_total() > MAX_ORDER_AMOUNT) {
$_SESSION['valid_to_checkout'] = false;
$messageStack->add('shopping_cart', sprintf(TEXT_ORDER_OVER_MAX_AMOUNT, $currencies->format(MAX_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 && MAX_ORDER_AMOUNT > 0) {
if($_SESSION['cart']->show_total() > MAX_ORDER_AMOUNT) {
zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
}
}
break;
In your admin configuration Maximum values, you will now set the Maximum Value Allowed to 1 .PHP Code:
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() != MAX_ORDER_AMOUNT) {
$_SESSION['valid_to_checkout'] = false;
$messageStack->add('shopping_cart', sprintf(TEXT_ORDER_OVER_MAX_AMOUNT, (MAX_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() !1) {
zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
}
break;
You will also have to adjust your LANGUAGE DEFINES in that module, so that meaningful text appears in the alert messages, etc.
OOPS...
Small error:
Here's better code:
PHP Code:
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() != MAX_ORDER_AMOUNT) {
$_SESSION['valid_to_checkout'] = false;
$messageStack->add('shopping_cart', sprintf(TEXT_ORDER_OVER_MAX_AMOUNT, (MAX_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() != MAX_ORDER_AMOUNT) {
zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
}
break;
Bookmarks