Jump to content
Sign in to follow this  
andresull

Max total amount in cart

Recommended Posts

I would like to use this contribution "Max total amount for cart" http://addons.oscommerce.com/info/3755 but I'm not sure how to update it to fit v2.2 RC 1 or 2.

Thanks in advance, Andres Ullmann (Argentina)

 

Installation instruction for Max Amount in Cart add-On

 

1) in catalog/shopping_cart.php

 

before:

 

if ($cart->count_contents() > 0) {

 

add:

 

<?php

if ($messageStack->size('shopping_cart') > 0) {

?>

<tr>

<td><?php echo $messageStack->output('shopping_cart'); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

 

--------------------------

 

2) in catalog/includes/languages/[lang]/shopping_cart.php (where [lang] defines your language definition)

 

add:

define('TOTAL_AMMOUNT_IN_CART_ERROR', 'You have reached the maximum amount athorised by the shop owner. Please contact us for greater orders.');

 

--------------------------

 

3) in catalog/includes/classes/shopping_cart.php

 

Afer:

 

function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) {

global $new_products_id_in_cart, $customer_id;

 

$products_id_string = tep_get_uprid($products_id, $attributes);

$products_id = tep_get_prid($products_id_string);

 

add:

 

// Max Amount in Cart

$this->calculate();

if ($this->total < MAX_TOTAL_IN_CART || $quantity < $this->get_quantity($products_id)) {

 

at the end of function (before last "}"), add:

 

//Max Amount in Cart

}

---------------------------

 

4) And do the same for function update_quantity().

 

---------------------------

 

5) In Database, add folowing line:

 

INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` )

VALUES (

'', 'Maximum Total Price in Cart', 'MAX_TOTAL_IN_CART', '10000', 'Define the max total price in cart. If reached, it will display an error', '3', '19', NULL , '0000-00-00 00:00:00', NULL , NULL

);

 

In case of problem, please contact me.

osc@ghweb.ch

GHWEB Informatique Gaëtan Hermann

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×