Advanced Mini Cart

Hi all,



Where can I find this mod? It’s referenced here [url]http://forum.cs-cart.com/showpost.php?p=10703&postcount=8[/url] by snorocket but I’ve been all through 3rd Party Mods and can’t find it.



A pointer please :wink: .

Try here



[url]http://forum.cs-cart.com/showthread.php?t=1200[/url]

Zardos,



Thanks for that!



Just a couple of questions:


  1. Do I do the tasks in both post 1 and 16 or just one of them?


  2. Does this work with 1.3.4 SP3



    I appreciate the help!

Hi tletourneau



The post in “16” is a more complex version of the mod that i started, but you can only use one or the other, as far as it working in 1.3.4 sp3 i’ve not tried it.

Well the one from [url]http://forum.cs-cart.com/showpost.php?p=5967&postcount=16[/url] fails. It doesn’t seem to like 1.3.4SP3:(. I get an error in fn_cart.php which makes some sense as it seems the code has changed a bit from the example.



The 1.3.4SP3 file has this code:


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);
}




and the example showed this code as original:


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 {




There seem to be a few differences that are causing a problem.



Have there been any roumors of 1.3.5 having this function? This is beyond my meager skills to fix.

It has been mentioned, i surpose that one of these versions we might see it as it is a useful part for the cart.