Descriptive Minicart Display

This donated protion adds shipping to your MiniCart. Here are the instructions for installation in 1.3.3-sp2 (make a backup of your files first):



Take the file attached to this post called x.jpg and place it in the folder “skins/yourskin/customer/images/”.



Make your file “skins/yourskin/customer/cart_pages/cart_status.tpl” look like this:

```php {* $Id: cart_status.tpl 675 2005-10-04 11:25:33Z lantan $ }



{
Minicart mod by Backstrom, inspired by Zardos *}











{if $cart_amount}

{else}

{/if}

{if $cart_amount}
{$lang.products}: {$cart_amount}

























{else}
{$lang.cart_is_empty}
{/if}

{$lang.subtotal}: {include file="common_templates/price.tpl" value=$cart_subtotal}
{$lang.discount}: {include file="common_templates/price.tpl" value=$cart_discount}
{$lang.estimated_shipping}:
{if $cart_est_ship>0}
{include file="common_templates/price.tpl" value=$cart_est_ship}
{/if}
{$lang.total_cost}: {include file="common_templates/price.tpl" value=$cart_est_total}
















{$lang.country}:

- {$lang.select_country} -
{foreach from=$est_countries item=country}
{$country.country}
{/foreach}

{$lang.zip_postal_code}: {$lang.go} {$lang.find_rates}





```

Add this new language variable using administration > languages:

[B]Variable:[/B] [I]estimated_shipping[/I] [B]Value:[/B] [I]Estimate shipping[/I]
[B]Variable:[/B] [I]click_estimate_shipping[/I] [B]Value:[/B] [I]Click to estimate shipping[/I]
[B]Variable:[/B] [I]find_rates[/I] [B]Value:[/B] [I]Find rates...[/I]

Modify your file "include/customer/cart_status.php" to look like this:
```php /******************************************************************************
* *
* Copyright (c) 2004-2005 CS-Cart.com. All rights reserved. *
* *
*******************************************************************************
* *
* CS-Cart is commercial software, only users who have purchased a valid *
* license through https://www.cs-cart.com/ and accept to the terms of this *
* License Agreement can install this product. *
* *
*******************************************************************************
* THIS CS-CART SHOP END-USER LICENSE AGREEMENT IS A LEGAL AGREEMENT BETWEEN *
* YOU AND YOUR COMPANY (COLLECTIVELY, "YOU") AND CS-CART.COM (HEREINAFTER *
* REFERRED TO AS "THE AUTHOR") FOR THE SOFTWARE PRODUCT IDENTIFIED ABOVE, *
* WHICH INCLUDES COMPUTER SOFTWARE AND MAY INCLUDE ASSOCIATED MEDIA, PRINTED *
* MATERIALS, AND "ONLINE" OR ELECTRONIC DOCUMENTATION (COLLECTIVELY, THE *
* "SOFTWARE"). BY USING THE SOFTWARE, YOU SIGNIFY YOUR AGREEMENT TO ALL *
* TERMS, CONDITIONS, AND NOTICES CONTAINED OR REFERENCED HEREIN. IF YOU ARE *
* NOT WILLING TO BE BOUND BY THIS AGREEMENT, DO NOT INSTALL OR USE THE *
* SOFTWARE. *
* *
* PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" *
* FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE *
* AT THE FOLLOWING URL: https://www.cs-cart.com/license.html *
******************************************************************************/

//
// $Id: cart_status.php 751 2005-10-13 11:20:41Z zeke $
//

// Minicart mod by Backstrom, inspired by Zardos

if ( !defined('IN_CSCART') ) { die('Access denied'); }

// Include real-time shipping rates calculation functions
@include_once $cscart_dir.DS.'shippings'.DS.'fn_rtsrc.php';

sess_register('cart');

$auth['est_country'] = (empty($auth['est_country'])) ? ((empty($cart['user_data']['s_country'])) ? @$GLOBALS['est_country'] : @$cart['user_data']['s_country']) : @$auth['est_country'];
$auth['est_zipcode'] = (empty($auth['est_zipcode'])) ? ((empty($cart['user_data']['s_zipcode'])) ? @$GLOBALS['est_zipcode'] : @$cart['user_data']['s_zipcode']) : @$auth['est_zipcode'];
$smarty->assign('est_country', @$auth['est_country']);
$smarty->assign('est_zipcode', @$auth['est_zipcode']);

if (!empty($GLOBALS['est_shipping'])) { // compute shipping
$products=0; // use products because cart['amount'] hasn't been coumpted yet
$options=0; // check options because options can chage without products changing.
if (!empty($cart['products'])) {
foreach ($cart['products'] as $k => $v) {
$products+=$v['amount']; // sum number of products
if (!empty($v['product_options'])) {
foreach ($v['product_options'] as $k1 => $v1) {
$options+=$v1; // sum option variant_ids
}
}
}
}

// if item/option added or removed, or country/zip change, recompute shipping
if ( ((@$auth['products']!=$products && $products>0) || (@$auth['options']!=$options && $options>0)) && !empty($auth['est_country'])) {
if ( empty($auth['user_id']) ) {
$auth['area'] = AREA;
$auth['user_id'] = 0;
$auth['membership_id'] = 0;
}
}
extract(fn_calculate_cart_content(&$cart, $auth, true));
$auth['products']=$products;
$auth['options']=$options;
} else {
$cart['est_ship'] = 0;
}

$cart['amount'] = (empty($cart['amount'])) ? 0 : $cart['amount'];
$cart['subtotal'] = (empty($cart['subtotal'])) ? 0 : $cart['subtotal'];
$cart['discount'] = (empty($cart['discount'])) ? 0 : $cart['discount'];
$cart['shipping_cost'] = (empty($cart['shipping_cost'])) ? 0 : $cart['shipping_cost'];
$cart['est_ship'] = (empty($cart['est_ship'])) ? 0 : $cart['est_ship'];

$cart['est_total'] = $cart['subtotal'] + $cart['discount'] + $cart['est_ship'];
$smarty->assign_by_ref('cart_amount', @$cart['amount']);
$smarty->assign_by_ref('cart_subtotal', @$cart['subtotal']);
$smarty->assign_by_ref('cart_discount', @$cart['discount']);
$smarty->assign_by_ref('cart_est_ship', @$cart['est_ship']);
$smarty->assign_by_ref('cart_est_total',@$cart['est_total']);
$smarty->assign_by_ref('est_countries', @fn_get_countries($descr_sl, false, false));

?> ```

Modify the line in file "include/customer/checkout.php" from this:

```php // Include real-time shipping rates calculation functions
@include $cscart_dir.DS.'shippings'.DS.'fn_rtsrc.php'; ```

To this:

```php // Include real-time shipping rates calculation functions
@include_once $cscart_dir.DS.'shippings'.DS.'fn_rtsrc.php'; ```

In file "core/fn_cart.php" locate this:
```php // Apply shipping fee
if ($calculate_shipping == true && $settings['Shippings']['disable_shipping'] != 'Y') {
if (defined('CACHED_SHIPPING_RATES')) {
global $shipping_rates;
} else {
$shipping_rates = fn_calculate_shipping_rates($cart, $cart_products, $auth);
} ```
Change it to this:
```php // Apply shipping fee
if ($calculate_shipping == true && $settings['Shippings']['disable_shipping'] != 'Y') {
if (defined('CACHED_SHIPPING_RATES')) {
global $shipping_rates;
} else {
$shipping_rates = fn_calculate_shipping_rates($cart, $cart_products, $auth);
}

// Minicart get lowest shipping rate, by Backstrom
$est_ship=$shipping_rates;
$sortRate = array();
foreach($est_ship as $rate) $sortRate[] = $rate['rate'];
array_multisort($sortRate, SORT_ASC, $est_ship);
$cart['est_ship']=@$est_ship[0]['rate']; ```
In the same file, locate this:
```php function fn_get_customer_location($auth, $cart, $billing = false)
{
global $settings, $db_tables;

$s_info = array();
$prefix = 's';
if ($billing == true) {
$prefix == 'b';
}

if (empty($cart['user_data'])) {
if (empty($auth['user_id'])) { // Get data for default location
$s_info['country'] = @$settings['General']['default_country'];
$s_info['state'] = @$settings['General']['default_state'];
$s_info['zipcode'] = @$settings['General']['default_zipcode'];
$s_info['city'] = @$settings['General']['default_city'];
$s_info['address'] = @$settings['General']['default_address'];
$s_info['phone'] = '';
$s_info['firstname'] = 'John';
$s_info['lastname'] = 'Doe';
} else { // Get data from user profile
$uinfo = fn_get_user_info($auth['user_id'], $cart['profile_id']);
$s_info['country'] = @$uinfo["{$prefix}_country"];
$s_info['state'] = @$uinfo["{$prefix}_state"];
$s_info['zipcode'] = @$uinfo["{$prefix}_zipcode"];
$s_info['city'] = @$uinfo["{$prefix}_city"];
$s_info['address'] = @$uinfo["{$prefix}_address"];
$s_info['phone'] = @$uinfo["phone"];
if ($prefix == 'b') {
$s_info['firstname'] = (!empty($uinfo['b_firstname'])) ? $uinfo['b_firstname'] : $uinfo['firstname'];
$s_info['lastname'] = (!empty($uinfo['b_lastname'])) ? $uinfo['b_lastname'] : $uinfo['lastname'];
} else {
$s_info['firstname'] = (!empty($uinfo['s_firstname'])) ? $uinfo['s_firstname'] : (!empty($uinfo['b_firstname']) ? $uinfo['b_firstname'] : $uinfo['firstname']);
$s_info['lastname'] = (!empty($uinfo['s_lastname'])) ? $uinfo['s_lastname'] : (!empty($uinfo['b_lastname']) ? $uinfo['b_lastname'] : $uinfo['lastname']);
$s_info['residential_address'] = (!empty($uinfo['residential_address'])) ? $uinfo['residential_address'] : 'Y';
}
}
} else { ```
Change it to this:
```php function fn_get_customer_location($auth, $cart, $billing = false)
{
global $settings, $db_tables;

$s_info = array();
$prefix = 's';
if ($billing == true) {
$prefix == 'b';
}
// MiniCart mod to bypass default, by Backstrom
if (empty($cart['user_data'])) {
if (empty($auth['user_id'])) { // Get data for minicart location
if (!empty($auth['est_country'])) {
$s_info['country'] = @$auth['est_country'];
$s_info['state'] = '';
$s_info['zipcode'] = @$auth['est_zipcode'];
$s_info['city'] = '';
$s_info['address'] = '';
$s_info['phone'] = '';
$s_info['firstname'] = 'John';
$s_info['lastname'] = 'Doe';
} else { // Get data for default location
$s_info['country'] = @$settings['General']['default_country'];
$s_info['state'] = @$settings['General']['default_state'];
$s_info['zipcode'] = @$settings['General']['default_zipcode'];
$s_info['city'] = @$settings['General']['default_city'];
$s_info['address'] = @$settings['General']['default_address'];
$s_info['phone'] = '';
$s_info['firstname'] = 'John';
$s_info['lastname'] = 'Doe';
}
} else { // Get data from user profile
$uinfo = fn_get_user_info($auth['user_id'], $cart['profile_id']);
$s_info['country'] = @$uinfo["{$prefix}_country"];
$s_info['state'] = @$uinfo["{$prefix}_state"];
$s_info['zipcode'] = @$uinfo["{$prefix}_zipcode"];
$s_info['city'] = @$uinfo["{$prefix}_city"];
$s_info['address'] = @$uinfo["{$prefix}_address"];
$s_info['phone'] = @$uinfo["phone"];
if ($prefix == 'b') {
$s_info['firstname'] = (!empty($uinfo['b_firstname'])) ? $uinfo['b_firstname'] : $uinfo['firstname'];
$s_info['lastname'] = (!empty($uinfo['b_lastname'])) ? $uinfo['b_lastname'] : $uinfo['lastname'];
} else {
$s_info['firstname'] = (!empty($uinfo['s_firstname'])) ? $uinfo['s_firstname'] : (!empty($uinfo['b_firstname']) ? $uinfo['b_firstname'] : $uinfo['firstname']);
$s_info['lastname'] = (!empty($uinfo['s_lastname'])) ? $uinfo['s_lastname'] : (!empty($uinfo['b_lastname']) ? $uinfo['b_lastname'] : $uinfo['lastname']);
$s_info['residential_address'] = (!empty($uinfo['residential_address'])) ? $uinfo['residential_address'] : 'Y';
}
}
} else { ```

This mod has been testing with Realtime shipping for USPS,FEDEX,UPS. Let me know if we need to tweak the code. Enjoy

x.jpg

Hi sculptingstudio !!WOW!!



Take full credit for the minicart mod sculptingstudio, totaly amazing :rolleyes: .

I would never have come up with that amount of work in a month of sundays.



Thanks again Larry.

nice Work!!

GREAT! thank you very much for doing that!! that is a great contribution

Thanks very much for all the work Larry, it’s really very much appreciated. This will really take CS-Cart to a new level of usability!!

Will it work with manual shipping rates?

[quote name=‘circlecity’]Will it work with manual shipping rates?[/QUOTE]Looking at the code it should. What to be a ginnie pig?

I you use FedEx, you might want to add this patch below. Since I was doing a lot a minicart testing, the CS-Cart bug was generating lots of FedEx shippments. FedEx called wanting to know about all the packages I was shipping to one address! Here is the bug and simple fix:



[url]http://vb.cs-cart.com/vbugs.php?do=view&vbug_id=130[/url]

I’d love to work this in with manual shipping rates. Any idea how?

[quote name=‘MMAMuscle.com’]I’d love to work this in with manual shipping rates. Any idea how?[/QUOTE]Did you install the mod?

I installed this mod and it works great. Thank you. I do have a couple of questions though. How can I make the width of the popout smaller? The current size makes it so I have to scroll to the side to view the whole thing. Also how can I eliminate countries from being displayed? I only want to ship to the US so I have changed my destinations and managed my countries, but the countries still haven’t been taken off of the mini-cart list. I appreciate the help.



Brandon

This is a REALLY COOL mod, thanks so much Larry.



It’s taken me a long while to get back to working w/ CS-Cart. Since I don’t plan to launch the CS-C version of my current site till later in the year, I figured it was worth my while to wait till the dust settled a bit on 1.3.4 before committing a lot of time. Anyway …



This mod works great, and was very easy to implement thanks to the detailed instructions. I have noticed one issue though, and wondered if there is an easy solution … I’m still very much a rookie w/ php & smarty.



When an item is added to the cart, the quantity and subtotal update, however the total price does not until the page is refreshed. Larry, I went to your site to see how you handled it, and realized your site goes to the cart page, which forces a refresh of the cart sidebox so you would not have noticed this (I added an $11 item, then cleared my cart). I suspect this means you’re running 1.3.3, but may be wrong on that.



Is there an easy way to cause the total to update when an item is added in 1.3.4 SP2, when the add to cart action updates the cart transparently and does not go to the actual cart page refreshing the sidebox?

i would like to install this too. i have a manual table for shipping and using e latest code.

The attached file is missing

Never mind, I found it. You have to copy the image and save it to your server. (That was not clear.)



There is still a missing graphic, and that is the subscribe_go.gif. (I’ll attach it here.) You need this or you can’t click anything on the popup.



Also, if you’re using a template with clear backgrounds in the sideboxes, you’ll need to modify the cart_status.tpl, and add a background color to the popup box.


I asked before how I could change how the estimate shipping popup could be changed so that I wouldn’t have to scroll to the side when it opened and how I could make “United States” the selected county since that is where I will do most of my business. I was able to figure out the positioning problem by changing /skins/-yourskin-/customer/cart_pages/cart_status.tpl from:


This is a fantastic mod!



But I would like to know if is there a way to shown estimate shipping costs including VAT, because Total Cost NOT include vat on shipping…please



Also: If in cart a change item’s quantity and I press “ENTER” key on keyboard, total isn’t updated; instead if I use “update” button on cart it’s updated… any ideas, please?



I’m using CS 1.3.4 SP3…



Thanks

Regards

Anyone made this mod available for CS 1.3.4SP3, please? As I tried but I have problems with totals and with cart page to be refreshed each time.



Regards

Thanks

[quote name=‘sculptingstudio’]

In file “core/fn_cart.php” locate this:

====



In the same file, locate this:

```php function fn_get_customer_location($auth, $cart, $billing = false)

{

global $settings, $db_tables;



$s_info = array();

$prefix = ‘s’;

if ($billing == true) {

$prefix == ‘b’;

}



if (empty($cart[‘user_data’])) {

if (empty($auth[‘user_id’])) { // Get data for default location

$s_info[‘country’] = @$settings[‘General’][‘default_country’];

$s_info[‘state’] = @$settings[‘General’][‘default_state’];

$s_info[‘zipcode’] = @$settings[‘General’][‘default_zipcode’];

$s_info[‘city’] = @$settings[‘General’][‘default_city’];

$s_info[‘address’] = @$settings[‘General’][‘default_address’];

$s_info[‘phone’] = ‘’;

$s_info[‘firstname’] = ‘John’;

$s_info[‘lastname’] = ‘Doe’;

} else { // Get data from user profile

$uinfo = fn_get_user_info($auth[‘user_id’], $cart[‘profile_id’]);

$s_info[‘country’] = @$uinfo[“{$prefix}_country”];

$s_info[‘state’] = @$uinfo[“{$prefix}_state”];

$s_info[‘zipcode’] = @$uinfo[“{$prefix}_zipcode”];

$s_info[‘city’] = @$uinfo[“{$prefix}_city”];

$s_info[‘address’] = @$uinfo[“{$prefix}_address”];

$s_info[‘phone’] = @$uinfo[“phone”];

if ($prefix == ‘b’) {

$s_info[‘firstname’] = (!empty($uinfo[‘b_firstname’])) ? $uinfo[‘b_firstname’] : $uinfo[‘firstname’];

$s_info[‘lastname’] = (!empty($uinfo[‘b_lastname’])) ? $uinfo[‘b_lastname’] : $uinfo[‘lastname’];

} else {

$s_info[‘firstname’] = (!empty($uinfo[‘s_firstname’])) ? $uinfo[‘s_firstname’] : (!empty($uinfo[‘b_firstname’]) ? $uinfo[‘b_firstname’] : $uinfo[‘firstname’]);

$s_info[‘lastname’] = (!empty($uinfo[‘s_lastname’])) ? $uinfo[‘s_lastname’] : (!empty($uinfo[‘b_lastname’]) ? $uinfo[‘b_lastname’] : $uinfo[‘lastname’]);

$s_info[‘residential_address’] = (!empty($uinfo[‘residential_address’])) ? $uinfo[‘residential_address’] : ‘Y’;

}

}

} else { ```

Change it to this:

```php function fn_get_customer_location($auth, $cart, $billing = false)

{

global $settings, $db_tables;



$s_info = array();

$prefix = ‘s’;

if ($billing == true) {

$prefix == ‘b’;

}

// MiniCart mod to bypass default, by Backstrom

if (empty($cart[‘user_data’])) {

if (empty($auth[‘user_id’])) { // Get data for minicart location

if (!empty($auth[‘est_country’])) {

$s_info[‘country’] = @$auth[‘est_country’];

$s_info[‘state’] = ‘’;

$s_info[‘zipcode’] = @$auth[‘est_zipcode’];

$s_info[‘city’] = ‘’;

$s_info[‘address’] = ‘’;

$s_info[‘phone’] = ‘’;

$s_info[‘firstname’] = ‘John’;

$s_info[‘lastname’] = ‘Doe’;

} else { // Get data for default location

$s_info[‘country’] = @$settings[‘General’][‘default_country’];

$s_info[‘state’] = @$settings[‘General’][‘default_state’];

$s_info[‘zipcode’] = @$settings[‘General’][‘default_zipcode’];

$s_info[‘city’] = @$settings[‘General’][‘default_city’];

$s_info[‘address’] = @$settings[‘General’][‘default_address’];

$s_info[‘phone’] = ‘’;

$s_info[‘firstname’] = ‘John’;

$s_info[‘lastname’] = ‘Doe’;

}

} else { // Get data from user profile

$uinfo = fn_get_user_info($auth[‘user_id’], $cart[‘profile_id’]);

$s_info[‘country’] = @$uinfo[“{$prefix}_country”];

$s_info[‘state’] = @$uinfo[“{$prefix}_state”];

$s_info[‘zipcode’] = @$uinfo[“{$prefix}_zipcode”];

$s_info[‘city’] = @$uinfo[“{$prefix}_city”];

$s_info[‘address’] = @$uinfo[“{$prefix}_address”];

$s_info[‘phone’] = @$uinfo[“phone”];

if ($prefix == ‘b’) {

$s_info[‘firstname’] = (!empty($uinfo[‘b_firstname’])) ? $uinfo[‘b_firstname’] : $uinfo[‘firstname’];

$s_info[‘lastname’] = (!empty($uinfo[‘b_lastname’])) ? $uinfo[‘b_lastname’] : $uinfo[‘lastname’];

} else {

$s_info[‘firstname’] = (!empty($uinfo[‘s_firstname’])) ? $uinfo[‘s_firstname’] : (!empty($uinfo[‘b_firstname’]) ? $uinfo[‘b_firstname’] : $uinfo[‘firstname’]);

$s_info[‘lastname’] = (!empty($uinfo[‘s_lastname’])) ? $uinfo[‘s_lastname’] : (!empty($uinfo[‘b_lastname’]) ? $uinfo[‘b_lastname’] : $uinfo[‘lastname’]);

$s_info[‘residential_address’] = (!empty($uinfo[‘residential_address’])) ? $uinfo[‘residential_address’] : ‘Y’;

}

}

} else { ```



This mod has been testing with Realtime shipping for USPS,FEDEX,UPS. Let me know if we need to tweak the code. Enjoy[/QUOTE]



The deatils in core/fn_cart.php is not the same



code in core/fn_cart.php


function fn_get_customer_location($auth, $cart, $billing = false)
{
global $settings, $db_tables;

$s_info = array();
$prefix = 's';
if ($billing == true) {
$prefix = 'b';
}

if (empty($cart['user_data']) && !empty($auth['user_id'])) {
$uinfo = fn_get_user_info($auth['user_id'], $cart['profile_id']);
$s_info['country'] = @$uinfo["{$prefix}_country"];
$s_info['state'] = @$uinfo["{$prefix}_state"];
$s_info['zipcode'] = @$uinfo["{$prefix}_zipcode"];
$s_info['city'] = @$uinfo["{$prefix}_city"];
$s_info['address'] = @$uinfo["{$prefix}_address"];
$s_info['phone'] = @$uinfo["phone"];
if ($prefix == 'b') {
$s_info['firstname'] = (!empty($uinfo['b_firstname'])) ? $uinfo['b_firstname'] : $uinfo['firstname'];
$s_info['lastname'] = (!empty($uinfo['b_lastname'])) ? $uinfo['b_lastname'] : $uinfo['lastname'];
} else {
$s_info['firstname'] = (!empty($uinfo['s_firstname'])) ? $uinfo['s_firstname'] : (!empty($uinfo['b_firstname']) ? $uinfo['b_firstname'] : $uinfo['firstname']);
$s_info['lastname'] = (!empty($uinfo['s_lastname'])) ? $uinfo['s_lastname'] : (!empty($uinfo['b_lastname']) ? $uinfo['b_lastname'] : $uinfo['lastname']);
$s_info['residential_address'] = (!empty($uinfo['residential_address'])) ? $uinfo['residential_address'] : 'Y';
}
} elseif (!empty($cart['user_data'])) {
$s_info['country'] = $cart['user_data']["{$prefix}_country"];
$s_info['state'] = @$cart['user_data']["{$prefix}_state"];
$s_info['zipcode'] = $cart['user_data']["{$prefix}_zipcode"];
$s_info['city'] = $cart['user_data']["{$prefix}_city"];
$s_info['address'] = $cart['user_data']["{$prefix}_address"];
$s_info['phone'] = $cart['user_data']["phone"];
if ($prefix == 'b') {
$s_info['firstname'] = (!empty($cart['user_data']['b_firstname'])) ? $cart['user_data']['b_firstname'] : $cart['user_data']['firstname'];
$s_info['lastname'] = (!empty($cart['user_data']['b_lastname'])) ? $cart['user_data']['b_lastname'] : $cart['user_data']['lastname'];
} else {
$s_info['firstname'] = (!empty($cart['user_data']['s_firstname'])) ? $cart['user_data']['s_firstname'] : (!empty($cart['user_data']['b_firstname']) ? $cart['user_data']['b_firstname'] : @$cart['user_data']['firstname']);
$s_info['lastname'] = (!empty($cart['user_data']['s_lastname'])) ? $cart['user_data']['s_lastname'] : (!empty($cart['user_data']['b_lastname']) ? $cart['user_data']['b_lastname'] : @$cart['user_data']['lastname']);
$s_info['residential_address'] = (!empty($cart['user_data']['residential_address'])) ? $cart['user_data']['residential_address'] : 'Y';
}
}

$s_info['country'] = empty($s_info['country']) ? @$settings['General']['default_country'] : $s_info['country'];
$s_info['state'] = empty($s_info['state']) ? @$settings['General']['default_state'] : $s_info['state'];
$s_info['zipcode'] = empty($s_info['zipcode']) ? @$settings['General']['default_zipcode'] : $s_info['zipcode'];
$s_info['city'] = empty($s_info['city']) ? @$settings['General']['default_city'] : $s_info['city'];
$s_info['address'] = empty($s_info['address']) ? @$settings['General']['default_address'] : $s_info['address'];
$s_info['phone'] = empty($s_info['phone']) ? '' : $s_info['phone'];
$s_info['firstname'] = 'John';
$s_info['lastname'] = 'Doe';

$s_info['country'] = addslashes($s_info['country']);
$s_info['state'] = addslashes($s_info['state']);
$avail_country = db_get_field("SELECT COUNT(*) FROM $db_tables[countries] WHERE code='$s_info[country]' AND avail='Y'");
if (empty($avail_country)) {
return array();
}

$avail_state = db_get_field("SELECT COUNT(*) FROM $db_tables[states] WHERE country_code='$s_info[country]' AND code='$s_info[state]' AND avail='Y'");
if (empty($avail_state)) {
$s_info['state'] = '';
}

return fn_format_zipcode($s_info);
}

Yes, are different… I tried to apply changes to new file…but without luck…there are problem is updating mini cart value…