Mod Request

Hello,



I hope I am posting this in the right place. I would like to be able to set a separate minimum purchase amount for each user group. It seems there is only one minimum for the whole store. I would like my wholesale customers to be required to purchase a different amount (based on the cart total) than retail customers. I can’t see a way to set this differently. I would love to hear from someone who could help me out and will happily pay a fair price for the mod. I am using version 2.1



Cheers, Lance

It would seem that you require the “Qty discount” tab on the product detail screen to be extended to have both a minimum quantity and maximum quantity (currently it’s an exact quantity). If a group falls within that range, they get the price specified.



The more difficult part of this is modifying the price calculation Javascript to be sensitive to this change. I.e. “if group equals X and order_qty is greater than min_qty and order_qty is less than max_qty then use the Qty discount price. Otherwise don’t apply the rule.”



You will probably also have to provide a hook for the common_templates/price.tpl file that can do the same.

Actually, I think it is simpler than that. It doesn’t need to be on a product by product basis. I just want their cart total to be settable to a minimum for the usergroup.



A bunch of searching last night on the web and through the forums, and I think I found just what I was looking for here



I hope the CS Team eventually incorporates this feature because I just hate dealing with mods when it comes time to upgrade. This feature and a “Back in stock” notification feature would make me a happy man.



Cheers, Lance

Okay, I misunderstood.



Then it’s not clear why you simply wouldn’t use a Promotion and have it be dependent on Product total and Usergroup. No mod required then,

Hi again,



I can’t figure out any way to do this using promotions… If you can tell me how to configure promotions so that wholesale customers must spend $250.00 before they can proceed to checkout, while retail customers don’t have a minimum for checkout, you will be my hero :).



Lance

[quote name=‘Lance Carbuncle’]Hi again,



I can’t figure out any way to do this using promotions… If you can tell me how to configure promotions so that wholesale customers must spend $250.00 before they can proceed to checkout, while retail customers don’t have a minimum for checkout, you will be my hero :).



Lance[/QUOTE]

This is not a promotion, it’s an limitation for a certain user group. I think a custom mod will solve your problem.

Joe is right. I guess I was sleepy over the weekend where I missunderstood twice what you were trying to accomplish.



If the amount is to be “fixed” and the number of groups to apply it to can also be fixed then this should be a pretty simple addon to the “checkout” controller which would do the check you want and if it fails, then you would simply send them to the “cart” page.



I thought you wanted to provide wholesalers a discount after a certain quantity or amount.

Well,



This turned into a nightmare. I purchased the script mentioned above and it apparently crashed my cart. I restored my files, and it had screwed up all my discounts which I had to rebuild. I contacted the author through the website within hours of the purchase to see if there was a fix, or possibly an error on my part. I had no response at all. I tried reinstalling it a couple days later and it had the same effect. Now more than a week later, I haven’t heard a word from the author and now have found that the website is offline http://cscartplugins.com, though it might be a ftp quota issue according to the page load. Anyone know this guy?



I guess now I have to call my credit card company and fight to reverse the charges… bummer.



I still would really like to have something like this, and if it could be made as an addon, it would be great for upgrade ability… Let me know if anyone out there would be interested in building it.



Cheers, Lance

No idea. Your link above generates a 404 error here on the forum.

I purchased from them prior,



[COLOR=black][FONT="]Gabe Ginorio

CS-Cart Plugins[/FONT][/COLOR]

I don’t know anything about cscartplugins besides that they were posting on here quite a bit and then just disappeared.



If you still want this mod / addon done I would highly recommend Joe for the job. He has done some custom work for me and I’ve been very happy with him.



I haven’t personally used tbirnseth myself, but he’s been posting on this thread and I know he knows his stuff so maybe he can help you.



I’d recommend contacting both of those guys and see what they have to say.



Brandon

I’m guessing this is a simple post controller check for the ‘checkout.checkout’ controller/mode. I.e. look at the user’s group and if they’re in a wholesale group and their cart total (not counting shipping) is less than a specified amount then generate a notification and return them to the cart page. PM me and I’ll give you a price or email me at XXsupport@ez-ms.com removing the XX’s.

Okay, I whipped this up. IT IS NOT TESTED but should give you a pretty good idea of what needs to be done if it doesn’t do it out of the box.



Create a file named:

addons/my_changes/controllers/customer/checkout.post.php



Add the following code to the file named above. The comments are pretty self explanatory. You will need to add the usergroups that are your wholesale groups to the array variable “my_wholesale_groups”. Each group ID you want checked against the user should be an element of the array. You also need to set the variable “my_minimum_order” to the amount that you want as a minimum of the order amount (minus shipping).



Note that any promotions will have been applied alreay so this is really a net amount. If you want the gross amount, you will need to add a “$cart[‘discount’]” into the equation.



If you want it “localized” for currency and languages and want to use language variables then you’ll have to modify that on your own.


```php

if( !defined('AREA') ) die('Access denied');

$my_wholesale_groups = array(13, 14); // Change this to the group_id's you want to check
$my_minimum_order = 250.00; // Change to minimum amount in the cart.

// Since the order can be adjusted in the cart and during the various phases of checkout,
// this check needs to be done on every 'checkout' mode except 'cart'.
if( $mode != 'cart' && $_SERVER['REQUEST_METHOD'] == 'POST' ) {
$_auth = empty($_SESSION['auth']) ? array() : $_SESSION['auth']);
if( empty($_auth) || empty($_auth['usergroups']) || array_intersect($my_wolesale_groups, $_auth['usergroups'] )
return array(CONTROLLER_STATUS_OK); // No user or not in usergroups

// Should be a wholesale group member from here
$_cart = &$_SESSION['cart'];
$shipping = empty($_cart['shipping_cost']) ? 0 : $_cart['shipping_cost'];
if( empty($_cart['total']) || ( ($_cart['total'] - $shipping) < $my_minimum_order) ) { // Nothing in cart or total not enough
fn_set_notification('C', "Notice", "Minimum purchase amount must be \$$my_minimum_order or more", true);
return array(CONTROLLER_STATUS_REDIRECT, INDEX_SCRIPT."?dispatch=checkout.cart");
}
// Order is more than $my_minimum_order
}
return array(CONTROLLER_STATUS_OK);
?>

```

Thanks tbirnseth!



Email sent.

I created an addon for this functionality. I removed my previous post with a code segment because the code didn’t work properly and completely and I didn’t want to maintain it.



You can view the documentation about the addon from the attachements area of the item detail page.



I’m hoping that this functionality is useful to others.



The product detail page is at: [url]http://www.ez-ms.com/addonproducts/group-minimum-orders.html[/url]



Thanks to Allen for access to his system and for providing the initial $$ to launch the project.

CS Cart Plugins got a job working for a Window's based Intranet company.



After he realized the utter stupidity of getting caught up in Window's based technologies, he found a job making twice the money with half the hours working in Austin, TX.



He and his former co-worker / partner in crime, Sergey, are now doing work for non e-commerce start-ups in Austin, TX.