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

Free shipping by membership level

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 09-22-2011, 11:14 PM
 
ehermanson ehermanson is offline
 

Newbie
  
Join Date: May 2011
Posts: 4
 

Default Free shipping by membership level

For Version 4.4.2
This only determines if a customer gets free shipping or not based on membership level.
It cannot determine what the shipping method is or exactly how much.

/************************************ In this location *********************************/

in "XCart\include\func\func.cart.php" at approximately line 1546
in function "func_calculate_shippings" after;

/************************************ After this code **********************************/

foreach($products as $k => $product) {
if (@$product['deleted']) continue; // for Advanced_Order_Management module
if (
!empty($active_modules['Egoods'])
&& $product['distribution'] != ''
) {
continue;
}

/***************************** Shipping by membership mod ******************************/

global $user_account;

if (!empty($user_account['membership'])
&& ($user_account['membership'] == 'Family' || $user_account['membership'] == 'Friends'))
{
$product['free_shipping'] = 'Y';
}

/************************************ Before this code **********************************/

// Calculate total_cost and total_weight for selection condition

if (
$product['free_shipping'] != 'Y'
|| $config['Shipping']['free_shipping_weight_select'] == 'Y'
) {
$total_cost['valid']['DST'] += $product['subtotal'];
$total_cost['valid']['ST'] += price_format($product['price'] * $product['amount']);
$total_weight['valid'] += $product['weight'] * $product['amount'];
}

/************************************************** *************************************/
__________________
X-Cart 4.4.2, Linux, Apache 2, Nginx/Varnish, PHP 5.2.12
Reply With Quote

The following 2 users thank ehermanson for this useful post:
chamberinternet (09-23-2011), vance@airfiltersexpress.c (11-29-2011)
  #2  
Old 12-07-2011, 06:49 AM
  AIEGaming's Avatar 
AIEGaming AIEGaming is offline
 

Advanced Member
  
Join Date: Nov 2010
Posts: 41
 

Default Re: Free shipping by membership level

Is there a way to offer certain shipping methods based on membership level? We need one of our wholesale customers to be able to choose UPS Ground or Next Day Air but both of them being zero cost to them. We will be shipping using their UPS account so we don't charge them for shipping. I made 2 new shipping methods for them called:

Company Name UPS Ground
Company Name UPS Next Day Air

The problem is, I don't want other customers to be able to use those shipping methods because as I mentioned earlier, they are free. Do you know of a way for us to accomplish this?
__________________
version 4.4.2
Reply With Quote
  #3  
Old 12-07-2011, 08:00 AM
  AIEGaming's Avatar 
AIEGaming AIEGaming is offline
 

Advanced Member
  
Join Date: Nov 2010
Posts: 41
 

Default Re: Free shipping by membership level

Actually... since their shipping would always be free would the above method work for what I'm trying to do? Could they still select UPS Ground or Next Day Air and just not be charged for it but regular customers would be charged the normal amount?
__________________
version 4.4.2
Reply With Quote
  #4  
Old 10-22-2012, 01:07 PM
 
dtgmap dtgmap is offline
 

Member
  
Join Date: Mar 2012
Posts: 26
 

Default Re: Free shipping by membership level

I finally figured this out after combining info from these 2 posts:

http://forum.x-cart.com/showthread.php?t=9081&highlight=shippingid
http://forum.x-cart.com/showthread.php?t=60983

1) Create an entry in xcart_config that has the following values:
name: free_shipping_allowed_method
comment: FREE SHIPPING ALLOWED METHOD
Give free shipping on a certain shipping method (Example: FedEx Ground is 43)
value: 0
category: Shipping
orderby: 4
type: text
defvalue: 0

2) In include/func/func.cart.php, insert this code:

Code:
if ($config['Shipping']['free_shipping_allowed_method'] == $shipping_id && $user_account['membership'] == 'Friends'){ $shipping_cost = 0; }


BEFORE


Code:
$display_shipping_cost = $shipping_cost; if ( $calculate_enable_flag && !( @$customer_info['tax_exempt'] == 'Y' && ( $config['Taxes']['enable_user_tax_exemption'] == 'Y' || defined('XAOM') ) ) ) { // Calculate taxes cost


3) Go into the x-cart admin, under Shipping Options, and set your shipping method
(This number will be the shippingid in the xcart_shipping table)

If you have any questions, there is valuable info in the 2 posts I referenced, such as applying to multiple shipping methods.

Note: This code change may affect your coupons. I don't currently have any set up, so I haven't tested it yet, but one of the posts addresses this scenario.
__________________
X-Cart v4.4.5
********* Power Filter
BCSE Refer-A-Friend
BCSE Auth.Net DPM/CIM
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 09:59 PM.

   

 
X-Cart forums © 2001-2020