Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Minimum wholesale subtotal mod
   X-Cart forums > X-Cart 4 > Changing and adding new features
Thread Tools Search this Thread
Old 04-23-2014, 01:26 PM
  bullfrog's Avatar 
bullfrog bullfrog is offline

Join Date: Oct 2004
Location: Oregon, USA
Posts: 366

Default Minimum wholesale subtotal mod

Sellers in wholesale almost always have a minimum order requirement, but X-Cart 4.x has no setting for that.

This mod takes the built-in minimum order setting for all customers and uses it for wholesale customers only. One line of code is added to include/checkout.php. The minimum for retail buyers becomes fixed at zero, and the minimum for wholesale buyers is whatever you enter in Settings-->General settings-->('Purchase limitations' section)

Check to confirm that both Wholesale membership and the Wholesale module are both enabled. Back up include/checkout.php, then open to edit and find (may be line 50)
&& $config['General']['minimal_order_amount'] > 0
Insert the following after (the comment line is optional)
// next line added to check if user has 'Wholesale' memebership
&& $user_account['membershipid'] == 2
Save and load the edited file to the server. Start test orders for both retail and wholesale users with amounts below and above the minimum to confirm that the mod is working. All orders except for Wholesale under the minimum should proceed from cart to checkout.

"2" is the default membershipid number for 'Wholesale'. If adding the line above does not work, export MEMBERSHIPS, open to view and see if the number is still 2. If not, change to number to actual.

Because this mod changes the meaning of the minimum order subtotal, I used Webmaster mode to edit the text where the setting is made.

On the General Settings page, below the heading "Purchase limitation", I changed the text for the first two options to be:
Minimum allowed wholesale order subtotal.
Retail orders are set to 0.00 and cannot be changed.

Maximum allowed order subtotal (0 means no maximum limit)
This is for all orders, retail and wholesale.
Thanks to Mike White at Babymonkey Studios for helping me get the line syntax correct.
Bullfrog ~~~ X-Cart Gold v4.7.2 (2) v4.7.8. ⌠If the road is easy, you're likely going the wrong way.■ ― Terry Goodkind
Reply With Quote

The following user thanks bullfrog for this useful post:
totaltec (04-24-2014)
   X-Cart forums > X-Cart 4 > Changing and adding new features

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -8. The time now is 12:37 PM.


X-Cart forums © 2001-2018