Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

Ok - now I'm totally baffled :o When I try to place a test order I get this error (by clicking checkout) regarding my shipping address:

 

Fatal error: Call to undefined function: tep_get_zone_code() in /home/.lew/mmherbs/mountainmeadowherbs.com/includes/functions/general.php on line 499

 

 

Here's my general.php code - I don't see anything glaring at me as incorrect :blink:

////

// Stop from parsing any further PHP code

function tep_exit() {

tep_session_close();

exit();

}

 

////

// Redirect to another page or site

function tep_redirect($url) {

if ( (strstr($url, "\n") != false) || (strstr($url, "\r") != false) ) {

tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false));

}

 

if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page

if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { // NONSSL url

$url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER)); // Change it to SSL

}

}

 

header('Location: ' . $url);

 

tep_exit();

}

 

////

// Parse the data used in the html tags to ensure the tags will not break

function tep_parse_input_field_data($data, $parse) {

return strtr(trim($data), $parse);

}

 

function tep_output_string($string, $translate = false, $protected = false) {

if ($protected == true) {

return htmlspecialchars($string);

} else {

if ($translate == false) {

return tep_parse_input_field_data($string, array('"' => '"'));

} else {

return tep_parse_input_field_data($string, $translate);

}

}

}

 

function tep_output_string_protected($string) {

return tep_output_string($string, false, true);

}

 

function tep_sanitize_string($string) {

$string = ereg_replace(' +', ' ', trim($string));

 

return preg_replace("/[<>]/", '_', $string);

}

 

////

// Return a random row from a database query

function tep_random_select($query) {

$random_product = '';

$random_query = tep_db_query($query);

$num_rows = tep_db_num_rows($random_query);

if ($num_rows > 0) {

$random_row = tep_rand(0, ($num_rows - 1));

tep_db_data_seek($random_query, $random_row);

$random_product = tep_db_fetch_array($random_query);

}

 

return $random_product;

}

 

////

// Return a product's name

// TABLES: products

function tep_get_products_name($product_id, $language = '') {

global $languages_id;

 

if (empty($language)) $language = $languages_id;

 

$product_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language . "'");

$product = tep_db_fetch_array($product_query);

 

return $product['products_name'];

}

 

////

//Master Products

// Return a product's description

// TABLES: products_description

function tep_get_products_description($product_id, $language = '') {

global $languages_id;

 

if (!tep_not_null($language)) $language = $languages_id;

 

$product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language . "'");

$product_description = tep_db_fetch_array($product_query);

 

return $product_description['products_description'];

}

//Master Products EOF

 

////

// Return a product's special price (returns nothing if there is no offer)

// TABLES: products

function tep_get_products_special_price($product_id) {

// $product_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$product_id . "' and status");

// BOF Separate Pricing Per Customer

global $sppc_customer_group_id;

 

if ( !isset($_SESSION['sppc_customer_group_id']) ) {

$customer_group_id = '0';

} else {

$customer_group_id = $_SESSION['sppc_customer_group_id'];

}

 

$product_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$product_id . "' and status and customers_group_id = '" . (int)$customer_group_id . "'");

// EOF Separate_Pricing Per Customer

 

$product = tep_db_fetch_array($product_query);

 

return $product['specials_new_products_price'];

}

 

////

// Return a product's stock

// TABLES: products

function tep_get_products_stock($products_id) {

$products_id = tep_get_prid($products_id);

$stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

$stock_values = tep_db_fetch_array($stock_query);

 

return $stock_values['products_quantity'];

}

 

////

// Check if the required stock is available

// If insufficent stock is available return an out of stock message

function tep_check_stock($products_id, $products_quantity) {

$stock_left = tep_get_products_stock($products_id) - $products_quantity;

$out_of_stock = '';

 

if ($stock_left < 0) {

$out_of_stock = '<span class="markProductOutOfStock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</span>';

}

 

return $out_of_stock;

}

 

////

// Break a word in a string if it is longer than a specified length ($len)

function tep_break_string($string, $len, $break_char = '-') {

$l = 0;

$output = '';

for ($i=0, $n=strlen($string); $i<$n; $i++) {

$char = substr($string, $i, 1);

if ($char != ' ') {

$l++;

} else {

$l = 0;

}

if ($l > $len) {

$l = 1;

$output .= $break_char;

}

$output .= $char;

}

 

return $output;

}

 

////

// Return all HTTP GET variables, except those passed as a parameter

function tep_get_all_get_params($exclude_array = '') {

global $HTTP_GET_VARS;

 

if (!is_array($exclude_array)) $exclude_array = array();

 

$get_url = '';

if (is_array($HTTP_GET_VARS) && (sizeof($HTTP_GET_VARS) > 0)) {

reset($HTTP_GET_VARS);

while (list($key, $value) = each($HTTP_GET_VARS)) {

if ( (strlen($value) > 0) && ($key != tep_session_name()) && ($key != 'error') && (!in_array($key, $exclude_array)) && ($key != 'x') && ($key != 'y') ) {

$get_url .= $key . '=' . rawurlencode(stripslashes($value)) . '&';

}

}

}

 

return $get_url;

}

 

////

// Returns an array with countries

// TABLES: countries

function tep_get_countries($countries_id = '', $with_iso_codes = false) {

$countries_array = array();

if (tep_not_null($countries_id)) {

if ($with_iso_codes == true) {

$countries = tep_db_query("select countries_name, countries_iso_code_2, countries_iso_code_3 from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "' order by countries_name");

$countries_values = tep_db_fetch_array($countries);

$countries_array = array('countries_name' => $countries_values['countries_name'],

'countries_iso_code_2' => $countries_values['countries_iso_code_2'],

'countries_iso_code_3' => $countries_values['countries_iso_code_3']);

} else {

$countries = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$countries_id . "'");

$countries_values = tep_db_fetch_array($countries);

$countries_array = array('countries_name' => $countries_values['countries_name']);

}

} else {

$countries = tep_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES . " order by countries_name");

while ($countries_values = tep_db_fetch_array($countries)) {

$countries_array[] = array('countries_id' => $countries_values['countries_id'],

'countries_name' => $countries_values['countries_name']);

}

}

 

return $countries_array;

}

 

////

// Alias function to tep_get_countries, which also returns the countries iso codes

function tep_get_countries_with_iso_codes($countries_id) {

return tep_get_countries($countries_id, true);

}

 

////

// Generate a path to categories

function tep_get_path($current_category_id = '') {

global $cPath_array;

 

if (tep_not_null($current_category_id)) {

$cp_size = sizeof($cPath_array);

if ($cp_size == 0) {

$cPath_new = $current_category_id;

} else {

$cPath_new = '';

$last_category_query = tep_db_query("select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$cPath_array[($cp_size-1)] . "'");

$last_category = tep_db_fetch_array($last_category_query);

 

$current_category_query = tep_db_query("select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

$current_category = tep_db_fetch_array($current_category_query);

 

if ($last_category['parent_id'] == $current_category['parent_id']) {

for ($i=0; $i<($cp_size-1); $i++) {

$cPath_new .= '_' . $cPath_array[$i];

}

} else {

for ($i=0; $i<$cp_size; $i++) {

$cPath_new .= '_' . $cPath_array[$i];

}

}

$cPath_new .= '_' . $current_category_id;

 

if (substr($cPath_new, 0, 1) == '_') {

$cPath_new = substr($cPath_new, 1);

}

}

} else {

$cPath_new = implode('_', $cPath_array);

}

 

return 'cPath=' . $cPath_new;

}

 

////

// Returns the clients browser

function tep_browser_detect($component) {

global $HTTP_USER_AGENT;

 

return stristr($HTTP_USER_AGENT, $component);

}

 

////

// Alias function to tep_get_countries()

function tep_get_country_name($country_id) {

$country_array = tep_get_countries($country_id);

 

return $country_array['countries_name'];

}

 

////

// Returns the zone (State/Province) name

// TABLES: zones

function tep_get_zone_name($country_id, $zone_id, $default_zone) {

$zone_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country_id . "' and zone_id = '" . (int)$zone_id . "'");

if (tep_db_num_rows($zone_query)) {

$zone = tep_db_fetch_array($zone_query);

return $zone['zone_name'];

} else {

return $default_zone;

}

}

 

 

////

// Wrapper function for round()

function tep_round($number, $precision) {

if (strpos($number, '.') && (strlen(substr($number, strpos($number, '.')+1)) > $precision)) {

$number = substr($number, 0, strpos($number, '.') + 1 + $precision + 1);

 

if (substr($number, -1) >= 5) {

if ($precision > 1) {

$number = substr($number, 0, -1) + ('0.' . str_repeat(0, $precision-1) . '1');

} elseif ($precision == 1) {

$number = substr($number, 0, -1) + 0.1;

} else {

$number = substr($number, 0, -1) + 1;

}

} else {

$number = substr($number, 0, -1);

}

}

 

return $number;

}

 

////

// Returns the tax rate for a zone / class

// TABLES: tax_rates, zones_to_geo_zones

function tep_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) {

// global $customer_zone_id, $customer_country_id;

// BOF Separate Pricing Per Customer, tax exempt modification

global $customer_zone_id, $customer_country_id, $sppc_customer_group_tax_exempt;

 

if(!tep_session_is_registered('sppc_customer_group_tax_exempt')) {

$customer_group_tax_exempt = '0';

} else {

$customer_group_tax_exempt = $sppc_customer_group_tax_exempt;

}

 

if ($customer_group_tax_exempt == '1') {

return 0;

}

// EOF Separate Pricing Per Customer, tax exempt modification

 

if ( ($country_id == -1) && ($zone_id == -1) ) {

if (!tep_session_is_registered('customer_id')) {

$country_id = STORE_COUNTRY;

$zone_id = STORE_ZONE;

} else {

$country_id = $customer_country_id;

$zone_id = $customer_zone_id;

}

}

 

$tax_query = tep_db_query("select sum(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' group by tr.tax_priority");

if (tep_db_num_rows($tax_query)) {

$tax_multiplier = 1.0;

while ($tax = tep_db_fetch_array($tax_query)) {

$tax_multiplier *= 1.0 + ($tax['tax_rate'] / 100);

}

return ($tax_multiplier - 1.0) * 100;

} else {

return 0;

}

}

 

////

// Return the tax description for a zone / class

// TABLES: tax_rates;

function tep_get_tax_description($class_id, $country_id, $zone_id) {

$tax_query = tep_db_query("select tax_description from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' order by tr.tax_priority");

if (tep_db_num_rows($tax_query)) {

$tax_description = '';

while ($tax = tep_db_fetch_array($tax_query)) {

$tax_description .= $tax['tax_description'] . ' + ';

}

$tax_description = substr($tax_description, 0, -3);

 

return $tax_description;

} else {

return TEXT_UNKNOWN_TAX_RATE;

}

}

 

////

// Add tax to a products price

function tep_add_tax($price, $tax) {

global $currencies;

 

// if ( (DISPLAY_PRICE_WITH_TAX == 'true') && ($tax > 0) ) {

// BOF Separate Pricing Per Customer, show_tax modification

// next line was original code

// if ( (DISPLAY_PRICE_WITH_TAX == 'true') && ($tax > 0) ) {

global $sppc_customer_group_show_tax;

global $sppc_customer_group_tax_exempt;

if(!tep_session_is_registered('sppc_customer_group_show_tax')) {

$customer_group_show_tax = '1';

} else {

$customer_group_show_tax = $sppc_customer_group_show_tax;

}

 

// echo '<br>cg_tax_exempt: ';

// echo $sppc_customer_group_tax_exempt;

if ( (DISPLAY_PRICE_WITH_TAX == 'true') && ($tax > 0) && ($customer_group_show_tax == '1')) {

// EOF Separate Pricing Per Customer, show_tax modification

return tep_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']) + tep_calculate_tax($price, $tax);

} else {

return tep_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);

}

}

 

// Calculates Tax rounding the result

function tep_calculate_tax($price, $tax) {

global $currencies;

 

return tep_round($price * $tax / 100, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);

}

 

////

// Return the number of products in a category

// TABLES: products, products_to_categories, categories

function tep_count_products_in_category($category_id, $include_inactive = false) {

$products_count = 0;

if ($include_inactive == true) {

$products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$category_id . "'");

} else {

$products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '" . (int)$category_id . "'");

}

$products = tep_db_fetch_array($products_query);

$products_count += $products['total'];

 

$child_categories_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$category_id . "'");

if (tep_db_num_rows($child_categories_query)) {

while ($child_categories = tep_db_fetch_array($child_categories_query)) {

$products_count += tep_count_products_in_category($child_categories['categories_id'], $include_inactive);

}

}

 

return $products_count;

}

 

////

// Return true if the category has subcategories

// TABLES: categories

function tep_has_category_subcategories($category_id) {

$child_category_query = tep_db_query("select count(*) as count from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$category_id . "'");

$child_category = tep_db_fetch_array($child_category_query);

 

if ($child_category['count'] > 0) {

return true;

} else {

return false;

}

}

 

////

// Returns the address_format_id for the given country

// TABLES: countries;

function tep_get_address_format_id($country_id) {

$address_format_query = tep_db_query("select address_format_id as format_id from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$country_id . "'");

if (tep_db_num_rows($address_format_query)) {

$address_format = tep_db_fetch_array($address_format_query);

return $address_format['format_id'];

} else {

return '1';

}

}

 

////

// Return a formatted address

// TABLES: address_format

function tep_address_format($address_format_id, $address, $html, $boln, $eoln) {

$address_format_query = tep_db_query("select address_format as format from " . TABLE_ADDRESS_FORMAT . " where address_format_id = '" . (int)$address_format_id . "'");

$address_format = tep_db_fetch_array($address_format_query);

 

$company = tep_output_string_protected($address['company']);

if (isset($address['firstname']) && tep_not_null($address['firstname'])) {

$firstname = tep_output_string_protected($address['firstname']);

$lastname = tep_output_string_protected($address['lastname']);

} elseif (isset($address['name']) && tep_not_null($address['name'])) {

$firstname = tep_output_string_protected($address['name']);

$lastname = '';

} else {

$firstname = '';

$lastname = '';

}

$street = tep_output_string_protected($address['street_address']);

$suburb = tep_output_string_protected($address['suburb']);

$city = tep_output_string_protected($address['city']);

$state = tep_output_string_protected($address['state']);

if (isset($address['country_id']) && tep_not_null($address['country_id'])) {

$country = tep_get_country_name($address['country_id']);

 

if (isset($address['zone_id']) && tep_not_null($address['zone_id'])) {

$state = tep_get_zone_code($address['country_id'], $address['zone_id'], $state);

}

} elseif (isset($address['country']) && tep_not_null($address['country'])) {

$country = tep_output_string_protected($address['country']);

} else {

$country = '';

}

$postcode = tep_output_string_protected($address['postcode']);

$zip = $postcode;

 

if ($html) {

// HTML Mode

$HR = '<hr>';

$hr = '<hr>';

if ( ($boln == '') && ($eoln == "\n") ) { // Values not specified, use rational defaults

$CR = '<br>';

$cr = '<br>';

$eoln = $cr;

} else { // Use values supplied

$CR = $eoln . $boln;

$cr = $CR;

}

} else {

// Text Mode

$CR = $eoln;

$cr = $CR;

$HR = '----------------------------------------';

$hr = '----------------------------------------';

}

 

$statecomma = '';

$streets = $street;

if ($suburb != '') $streets = $street . $cr . $suburb;

if ($country == '') $country = tep_output_string_protected($address['country']);

if ($state != '') $statecomma = $state . ', ';

 

$fmt = $address_format['format'];

eval("\$address = \"$fmt\";");

 

if ( (ACCOUNT_COMPANY == 'true') && (tep_not_null($company)) ) {

$address = $company . $cr . $address;

}

 

return $address;

}

 

////

// Return a formatted address

// TABLES: customers, address_book

function tep_address_label($customers_id, $address_id = 1, $html = false, $boln = '', $eoln = "\n") {

$address_query = tep_db_query("select entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customers_id . "' and address_book_id = '" . (int)$address_id . "'");

$address = tep_db_fetch_array($address_query);

 

$format_id = tep_get_address_format_id($address['country_id']);

 

return tep_address_format($format_id, $address, $html, $boln, $eoln);

}

 

function tep_row_number_format($number) {

if ( ($number < 10) && (substr($number, 0, 1) != '0') ) $number = '0' . $number;

 

return $number;

}

 

function tep_get_categories($categories_array = '', $parent_id = '0', $indent = '') {

global $languages_id;

 

if (!is_array($categories_array)) $categories_array = array();

 

$categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");

while ($categories = tep_db_fetch_array($categories_query)) {

$categories_array[] = array('id' => $categories['categories_id'],

'text' => $indent . $categories['categories_name']);

 

if ($categories['categories_id'] != $parent_id) {

$categories_array = tep_get_categories($categories_array, $categories['categories_id'], $indent . '  ');

}

}

 

return $categories_array;

}

 

function tep_get_manufacturers($manufacturers_array = '') {

if (!is_array($manufacturers_array)) $manufacturers_array = array();

 

$manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");

while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {

$manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers['manufacturers_name']);

}

 

return $manufacturers_array;

}

 

////

// Return all subcategory IDs

// TABLES: categories

function tep_get_subcategories(&$subcategories_array, $parent_id = 0) {

$subcategories_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$parent_id . "'");

while ($subcategories = tep_db_fetch_array($subcategories_query)) {

$subcategories_array[sizeof($subcategories_array)] = $subcategories['categories_id'];

if ($subcategories['categories_id'] != $parent_id) {

tep_get_subcategories($subcategories_array, $subcategories['categories_id']);

}

}

}

 

// Output a raw date string in the selected locale date format

// $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS

function tep_date_long($raw_date) {

if ( ($raw_date == '0000-00-00 00:00:00') || ($raw_date == '') ) return false;

 

$year = (int)substr($raw_date, 0, 4);

$month = (int)substr($raw_date, 5, 2);

$day = (int)substr($raw_date, 8, 2);

$hour = (int)substr($raw_date, 11, 2);

$minute = (int)substr($raw_date, 14, 2);

$second = (int)substr($raw_date, 17, 2);

 

return strftime(DATE_FORMAT_LONG, mktime($hour,$minute,$second,$month,$day,$year));

}

 

////

// Output a raw date string in the selected locale date format

// $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS

// NOTE: Includes a workaround for dates before 01/01/1970 that fail on windows servers

function tep_date_short($raw_date) {

if ( ($raw_date == '0000-00-00 00:00:00') || empty($raw_date) ) return false;

 

$year = substr($raw_date, 0, 4);

$month = (int)substr($raw_date, 5, 2);

$day = (int)substr($raw_date, 8, 2);

$hour = (int)substr($raw_date, 11, 2);

$minute = (int)substr($raw_date, 14, 2);

$second = (int)substr($raw_date, 17, 2);

 

if (@date('Y', mktime($hour, $minute, $second, $month, $day, $year)) == $year) {

return date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, $year));

} else {

return ereg_replace('2037' . '$', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037)));

}

}

 

////

// Parse search string into indivual objects

function tep_parse_search_string($search_str = '', &$objects) {

$search_str = trim(strtolower($search_str));

 

// Break up $search_str on whitespace; quoted string will be reconstructed later

$pieces = split('[[:space:]]+', $search_str);

$objects = array();

$tmpstring = '';

$flag = '';

 

for ($k=0; $k<count($pieces); $k++) {

while (substr($pieces[$k], 0, 1) == '(') {

$objects[] = '(';

if (strlen($pieces[$k]) > 1) {

$pieces[$k] = substr($pieces[$k], 1);

} else {

$pieces[$k] = '';

}

}

 

$post_objects = array();

 

while (substr($pieces[$k], -1) == ')') {

$post_objects[] = ')';

if (strlen($pieces[$k]) > 1) {

$pieces[$k] = substr($pieces[$k], 0, -1);

} else {

$pieces[$k] = '';

}

}

 

// Check individual words

 

if ( (substr($pieces[$k], -1) != '"') && (substr($pieces[$k], 0, 1) != '"') ) {

$objects[] = trim($pieces[$k]);

 

for ($j=0; $j<count($post_objects); $j++) {

$objects[] = $post_objects[$j];

}

} else {

/* This means that the $piece is either the beginning or the end of a string.

So, we'll slurp up the $pieces and stick them together until we get to the

end of the string or run out of pieces.

*/

 

// Add this word to the $tmpstring, starting the $tmpstring

$tmpstring = trim(ereg_replace('"', ' ', $pieces[$k]));

 

// Check for one possible exception to the rule. That there is a single quoted word.

if (substr($pieces[$k], -1 ) == '"') {

// Turn the flag off for future iterations

$flag = 'off';

 

$objects[] = trim($pieces[$k]);

 

for ($j=0; $j<count($post_objects); $j++) {

$objects[] = $post_objects[$j];

}

 

unset($tmpstring);

 

// Stop looking for the end of the string and move onto the next word.

continue;

}

 

// Otherwise, turn on the flag to indicate no quotes have been found attached to this word in the string.

$flag = 'on';

 

// Move on to the next word

$k++;

 

// Keep reading until the end of the string as long as the $flag is on

 

while ( ($flag == 'on') && ($k < count($pieces)) ) {

while (substr($pieces[$k], -1) == ')') {

$post_objects[] = ')';

if (strlen($pieces[$k]) > 1) {

$pieces[$k] = substr($pieces[$k], 0, -1);

} else {

$pieces[$k] = '';

}

}

 

// If the word doesn't end in double quotes, append it to the $tmpstring.

if (substr($pieces[$k], -1) != '"') {

// Tack this word onto the current string entity

$tmpstring .= ' ' . $pieces[$k];

 

// Move on to the next word

$k++;

continue;

} else {

/* If the $piece ends in double quotes, strip the double quotes, tack the

$piece onto the tail of the string, push the $tmpstring onto the $haves,

kill the $tmpstring, turn the $flag "off", and return.

*/

$tmpstring .= ' ' . trim(ereg_replace('"', ' ', $pieces[$k]));

 

// Push the $tmpstring onto the array of stuff to search for

$objects[] = trim($tmpstring);

 

for ($j=0; $j<count($post_objects); $j++) {

$objects[] = $post_objects[$j];

}

 

unset($tmpstring);

 

// Turn off the flag to exit the loop

$flag = 'off';

}

}

}

}

 

// add default logical operators if needed

$temp = array();

for($i=0; $i<(count($objects)-1); $i++) {

$temp[] = $objects[$i];

if ( ($objects[$i] != 'and') &&

($objects[$i] != 'or') &&

($objects[$i] != '(') &&

($objects[$i+1] != 'and') &&

($objects[$i+1] != 'or') &&

($objects[$i+1] != ')') ) {

$temp[] = ADVANCED_SEARCH_DEFAULT_OPERATOR;

}

}

$temp[] = $objects[$i];

$objects = $temp;

 

$keyword_count = 0;

$operator_count = 0;

$balance = 0;

for($i=0; $i<count($objects); $i++) {

if ($objects[$i] == '(') $balance --;

if ($objects[$i] == ')') $balance ++;

if ( ($objects[$i] == 'and') || ($objects[$i] == 'or') ) {

$operator_count ++;

} elseif ( ($objects[$i]) && ($objects[$i] != '(') && ($objects[$i] != ')') ) {

$keyword_count ++;

}

}

 

if ( ($operator_count < $keyword_count) && ($balance == 0) ) {

return true;

} else {

return false;

}

}

 

////

// Check date

function tep_checkdate($date_to_check, $format_string, &$date_array) {

$separator_idx = -1;

 

$separators = array('-', ' ', '/', '.');

$month_abbr = array('jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec');

$no_of_days = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

 

$format_string = strtolower($format_string);

 

if (strlen($date_to_check) != strlen($format_string)) {

return false;

}

 

$size = sizeof($separators);

for ($i=0; $i<$size; $i++) {

$pos_separator = strpos($date_to_check, $separators[$i]);

if ($pos_separator != false) {

$date_separator_idx = $i;

break;

}

}

 

for ($i=0; $i<$size; $i++) {

$pos_separator = strpos($format_string, $separators[$i]);

if ($pos_separator != false) {

$format_separator_idx = $i;

break;

}

}

 

if ($date_separator_idx != $format_separator_idx) {

return false;

}

 

if ($date_separator_idx != -1) {

$format_string_array = explode( $separators[$date_separator_idx], $format_string );

if (sizeof($format_string_array) != 3) {

return false;

}

 

$date_to_check_array = explode( $separators[$date_separator_idx], $date_to_check );

if (sizeof($date_to_check_array) != 3) {

return false;

}

 

$size = sizeof($format_string_array);

for ($i=0; $i<$size; $i++) {

if ($format_string_array[$i] == 'mm' || $format_string_array[$i] == 'mmm') $month = $date_to_check_array[$i];

if ($format_string_array[$i] == 'dd') $day = $date_to_check_array[$i];

if ( ($format_string_array[$i] == 'yyyy') || ($format_string_array[$i] == 'aaaa') ) $year = $date_to_check_array[$i];

}

} else {

if (strlen($format_string) == 8 || strlen($format_string) == 9) {

$pos_month = strpos($format_string, 'mmm');

if ($pos_month != false) {

$month = substr( $date_to_check, $pos_month, 3 );

$size = sizeof($month_abbr);

for ($i=0; $i<$size; $i++) {

if ($month == $month_abbr[$i]) {

$month = $i;

break;

}

}

 &n


~Tracy
 

Share this post


Link to post
Share on other sites
Ok - now I'm totally baffled :o When I try to place a test order I get this error (by clicking checkout) regarding my shipping address:

 

Fatal error: Call to undefined function: tep_get_zone_code() in /home/.lew/mmherbs/mountainmeadowherbs.com/includes/functions/general.php on line 499

 

Ok - completely lost now - I just re-uploaded the shipping modules I had edited and it didn't remove the problem - so apparently those edits didn't cause it. I just can't figure how it was working earlier today and then just out of the blue it stops :(


~Tracy
 

Share this post


Link to post
Share on other sites

On the SPPC and Free Shipping for orders over a certain dollar amount ordeal - I've noticed that in the admin, under Modules>Order Total there is a Shipping option and in there it allows for Free shipping on orders over a certain dollar amount either nationally or Internationally.

 

Is there a way to combine this feature with SPPC so that the retail group would have free national shipping on orders over $150 and the wholesale group would have free national shipping on orders over $200 (no free shipping on International orders) ?


~Tracy
 

Share this post


Link to post
Share on other sites

JanZ, first thanks for all your help. It is much appreciated.

 

OK I have found that is a part of this shopping cart I haven't looked into very much. Sessions! Anyway, I found that the info wasn't being written to the db. It is now. All of the correct info about the attribute value is written to the db yet, on the first item (if quantity = 1) the text value won't show when viewed in the shoppping cart.php Only after you add another (and only f you type something into the text box) does it appear in the shopping cart. Another little glitch is that after you add the product the first time (qty = 1) the text box will now appear with a number 0 in it on the product_info.php page. This should always be empty by default. Any ideas?

 

function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) {
  // BOF Separate Pricing Per Customer, Price Break 1.11.3 modification
  global $new_products_id_in_cart, $customer_id, $sppc_customer_group_id, $languages_id;
  if(!tep_session_is_registered('sppc_customer_group_id')) { 
	$this->cg_id = '0';
	  } else {
	$this->cg_id = $sppc_customer_group_id;
  } // end if else
// EOF Separate Pricing Per Customer

  $pf = new PriceFormatter;
  $pf->loadProduct($products_id, $languages_id);
  $qty = $pf->adjustQty($qty);
  $products_id_string = tep_get_uprid($products_id, $attributes);
  $products_id = tep_get_prid($products_id_string);

  $attributes_pass_check = true;
  if (is_array($attributes)) {
	  reset($attributes);
	  while (list($option, $value) = each($attributes)) {
			 if (strstr($option, TEXT_PREFIX)) {
				 $attributes_pass_check = true;
				 break;
			 } // end if (strstr($option, TEXT_PREFIX)) 
			 if (!is_numeric($option) || !is_numeric($value)) {
				 $attributes_pass_check = false;
				 break;
			 } // end if (!is_numeric($option) || !is_numeric($value))
	  } // end while (list($option, $value) = each($attributes))
  } // end if (is_array($attributes))


  if (is_numeric($products_id) && is_numeric($qty) && ($attributes_pass_check == true)) {
// BOF SPPC attribute hide check, original query expanded to include attributes
	$check_product_query = tep_db_query("select products_status, options_id, options_values_id, attributes_hide_from_groups, '0' as hide_attr_status from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_ATTRIBUTES . " using(products_id) where p.products_id = '" . (int)$products_id . "'");
	while ($_check_product = tep_db_fetch_array($check_product_query)) {
		   $attr_hide_array = array(); // empty array in case it is still around and filled
		   $attr_hide_array = explode(",", $_check_product['attributes_hide_from_groups']);
		   if (in_array($this->cg_id, $attr_hide_array)) {
			   $_check_product['hide_attr_status'] = '1';
		   }
		   $check_product[] = $_check_product;
	} // end while ($_check_product = tep_db_fetch_array($check_product_query))
	$no_of_check_product = count($check_product);

	if (is_array($attributes)) {
		foreach($attributes as $attr_option => $attr_option_value) {
				$valid_option = '0';
				for ($x = 0; $x < $no_of_check_product; $x++) {
					 if ($attr_option == $check_product[$x]['options_id'] && $attr_option_value == $check_product[$x]['options_values_id']) {
						 $valid_option = '1';
						 if ($check_product[$x]['hide_attr_status'] == '1') {
						// delete hidden attributes from array attributes
							 unset($attributes[$attr_option]);
						 } // end if ($check_product[$x]['hide_attr_status'] == '1')
					 } // end if ($attr_option == $check_product[$x]['options_id']....
				} // end for ($x = 0; $x < $no_of_check_product; $x++)
				if ($valid_option == '0' && !strstr($attr_option, TEXT_PREFIX)) {
// after having gone through the options for this product and not having found a matching one
// we can conclude that apparently this is not a valid option for this product so remove it
				 unset($attributes[$attr_option]);
				 } // end if ($valid_option == '0' && !strstr($attr_option, TEXT_PREFIX))
		} // end foreach($attributes as $attr_option => $attr_option_value)
	 } // end if (is_array($attributes))

// now attributes have been checked and hidden and invalid ones deleted make the $products_id_string again
	$products_id_string = tep_get_uprid($products_id, $attributes);

	if ((isset($check_product) && tep_not_null($check_product)) && ($check_product[0]['products_status'] == '1')) {
// EOF SPPC attribute hide check
		if ($notify == true) {
			$new_products_id_in_cart = $products_id_string;
			tep_session_register('new_products_id_in_cart');
		} // end if ($notify == true)

		if ($this->in_cart($products_id_string)) {
			$this->update_quantity($products_id_string, (int)$qty, $attributes);
		} else {
			$this->contents[$products_id_string] = array('qty' => $qty);
// insert into database
			if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$qty . "', '" . date('Ymd') . "')"); // self contained if

				if (is_array($attributes)) {
					reset($attributes);
					while (list($option, $value) = each($attributes)) {
						   $attr_value = NULL;
						   $blank_value = FALSE;
						   if (strstr($attr_option, TEXT_PREFIX)) {
							   if (trim($value) == NULL) {
								   $blank_value = TRUE;
							   } else {
								   $option = substr($option, strlen(TEXT_PREFIX));
								   $attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES);
								   $value = PRODUCTS_OPTIONS_VALUE_TEXT_ID;
								   $this->contents[$products_id_string]['attributes'][$option] = $attr_value;
							   } // end if else
						   } // end if (strstr($option, TEXT_PREFIX))

						   if (!$blank_value) {
							   $this->contents[$products_id_string]['attributes'][$option] = $value;
}// insert into database
							   if (tep_session_is_registered('customer_id')) 
								   tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id, products_options_value_text) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$option . "', '" . (int)$value . "', '" . tep_db_input($attr_value) . "')"); // self contained if
						   //}   if (!$blank_value)
					} // end while (list($option, $value) = each($attributes))
				} // end if (is_array($attributes)) 
				$this->cleanup();

// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
				$this->cartID = $this->generate_cart_id();
	  } // end if ($this->in_cart($products_id_string)) 
	} // end if ((isset($check_product) && tep_not_null($check_product)) && ($check_product[0]['products_status'] == '1'))
  } // end if (is_numeric($products_id) && is_numeric($qty) && ($attributes_pass_check == true))
} // end function add_cart($products_id, $qty = '1', $attributes = '', $notify = true)

Share this post


Link to post
Share on other sites
Ok - completely lost now - I just re-uploaded the shipping modules I had edited and it didn't remove the problem - so apparently those edits didn't cause it. I just can't figure how it was working earlier today and then just out of the blue it stops :(

 

Well - thanks to the wonders of WinMerge I finally found the problem in includes/functions/general.php - somehow this block of code was simply not there:

 

////
// Returns the zone (State/Province) code
// TABLES: zones
 function tep_get_zone_code($country_id, $zone_id, $default_zone) {
$zone_query = tep_db_query("select zone_code from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country_id . "' and zone_id = '" . (int)$zone_id . "'");
if (tep_db_num_rows($zone_query)) {
  $zone = tep_db_fetch_array($zone_query);
  return $zone['zone_code'];
} else {
  return $default_zone;
}
 }

 

So I pasted it back in and all is well again - YAY!!!

 

If anyone else runs into this - this bit of code goes in just above this chunk of code:

////
// Wrapper function for round()

 

Thanks,


~Tracy
 

Share this post


Link to post
Share on other sites

WinMerge can be a life saver. Nice work Tracy.

 

JanZ I have given up on the new addition to SPPC attributes. I have Master products contribution installed and have decided to use this as a way to provide SPPC support for attributes by making them slaves to master products. This may work better by also allowing quantity discounts and quantities to be set when ordering.

Share this post


Link to post
Share on other sites

Allright guys, hopefully one of you guru's will have an idea where I should start looking for this :thumbsup:

 

I am having either (or both) a shipping issue or a session ID's issue.

 

All of my shipping modules (includes/modules/shipping and includes/languages/english/modules/shipping) as well as all of my checkout_filenamehere files are all original osC. I have removed any shipping contribution modules I had installed to try so we are dealing with a clean slate.

 

I removed all shipping modules through admin (including under Order Total Modules) and deleted them from the server. Then I uploaded them back to the server (from stock osC files) and went back into admin and installed the Table Rates module and set the Shipping under Order Total Modules to Show Shipping (False on free shipping at the moment).

 

When I go through the checkout process I have two issues.

 

1. - I never see any information regarding shipping. It is not included in the total price and is not listed anywhere on the checkout confirmation page :(

 

2. - Occasionally, after either the first checkout page or after entering CC# when I click to continue I get booted out and have to re-login. This sends me into a never ending loop of having to log in and it not recognizing I have logged in (just keep getting the login page over and over). :'(

 

I noticed that the session ID is re-created whenever it decides to log me off during the checkout process. Also, I am having a problem with the pull down category menu as it won't retain the session ID. Bill (creator of STS which is where the pull down menu came from) says that it has to be something in my code that is messing with the session ID's that is causing that menu to not keep the session ID.

 

Is it possible that a problem with the session ID could cause both of my shipping problems above - or are they two separate issues? Could the code changes SPPC does to customers.php (involving $customers_shipment_allowed) be causing the problems?

 

Any ideas on what files I should be looking at to figure out why shipping is not showing up and why I am occasionally logged off while going through the checkout process?

 

The list of contrib's I have installed is below - I uninstalled all shipping related contrib's for right now as I am trying to get the shipping to function properly. I do have a list of all of the stock osC pages that have been changed by one of the contrib's I have installed that I can post if you feel it would be beneficial :)

 

Thanks in advance for any knowledge / assistance you may be able to provide :D


~Tracy
 

Share this post


Link to post
Share on other sites
When I go through the checkout process I have two issues.

 

1. - I never see any information regarding shipping. It is not included in the total price and is not listed anywhere on the checkout confirmation page :(

 

2. - Occasionally, after either the first checkout page or after entering CC# when I click to continue I get booted out and have to re-login. This sends me into a never ending loop of having to log in and it not recognizing I have logged in (just keep getting the login page over and over). :'(

 

Hmmm - new issue with Customer Groups (I think). I went into the admin (and the database through phpMyAdmin) initially to test the shipping settings. I found two things happening here:

 

1. - it does not matter whether or not I choose the shipping options manually for any of the customer groups - I still don't see any shipping options or get charged for shipping in checkout

 

2.- initially both of my customer groups were set to only be able to use credit card payment method - I changed it to default on both (which should allow CC and Check by Mail payment options) just out of curiosity - and guess what? The only option it shows me on the checkout page is Credit Card (and claims it is the only method available). I do have Check by Mail turned on in admin, but for some reason it isn't being picked up as a possible payment method??

 

I'm hoping that by posting the other issues I'm finding with the checkout process (as I find them) will allow somebody to have an easier time pointing out what files might be messing up somewhere :thumbsup:


~Tracy
 

Share this post


Link to post
Share on other sites
I have given up on the new addition to SPPC attributes.
I just wanted to mention that perhaps this piece is giving you the trouble:

// now attributes have been checked and hidden and invalid ones deleted make the $products_id_string again
	$products_id_string = tep_get_uprid($products_id, $attributes);

This Option Type stuff seems not to change the products_id string (like 1{4}10). That might cause the strange things you experience. Oh well.

Share this post


Link to post
Share on other sites
I just wanted to mention that perhaps this piece is giving you the trouble:

// now attributes have been checked and hidden and invalid ones deleted make the $products_id_string again
	$products_id_string = tep_get_uprid($products_id, $attributes);

This Option Type stuff seems not to change the products_id string (like 1{4}10). That might cause the strange things you experience. Oh well.

Jan,

I had wondered that myself. Why I never tried it yet I don't know! Thganks I will try it another time.

Share this post


Link to post
Share on other sites
1. - it does not matter whether or not I choose the shipping options manually for any of the customer groups - I still don't see any shipping options or get charged for shipping in checkout

 

2.- initially both of my customer groups were set to only be able to use credit card payment method - I changed it to default on both (which should allow CC and Check by Mail payment options) just out of curiosity - and guess what? The only option it shows me on the checkout page is Credit Card (and claims it is the only method available). I do have Check by Mail turned on in admin, but for some reason it isn't being picked up as a possible payment method??

See if SPPC is doing this by going back to catalog/includes/classes/shipping.php and catalog/includes/classes/payment.php. These are the two files that check for/do the customer group enabling. If you go back to stock osC (or your backup) you will have all shipment and payment methods enabled for all groups.

 

There is no conflict with Shipping/Payment Zone with the user under which you are logged-in in the admin?

Share this post


Link to post
Share on other sites

Hey Jan ... or anyone who can help

 

I have a question about the price break/SPPC. I want the retail price break to apply to all customers, unless I specify a different price break for that customer.

 

I thought it did so automaticly, however for some reason it doesn't - or atleast mine isn't right now :blush: .

 

Could you let me know if there is a quick edit to make it default to retail, unless a different price break is set?

 

Many Thanks,

Kristine


Kristine

Share this post


Link to post
Share on other sites
I have a question about the price break/SPPC. I want the retail price break to apply to all customers, unless I specify a different price break for that customer.

 

I thought it did so automaticly, however for some reason it doesn't - or atleast mine isn't right now.

 

Could you let me know if there is a quick edit to make it default to retail, unless a different price break is set?

It is true that SPPC defaults to the retail price when no customer group price is set. However, the price break contribution works differently. I don't see a quick fix to enable what you want.

Share this post


Link to post
Share on other sites

Thanks Jan - Could you give me an idea of what code allows the SPPC to default to retail? I will take a look and see if I can find it myself & start working on the fix.

 

Hopefully it won't take me as long to fix the code as it will to add the price breaks on every customer for each product ;).


Kristine

Share this post


Link to post
Share on other sites

I've just installed Seperate Pricing and everything works fine, except for this:

 

As soon as I'm not logged in, everything is fine. But as soon as any user logs in, no matter which group he is in, he just sees the Prices displayed without tax.

 

Anything?

Share this post


Link to post
Share on other sites

Hi JanZ oranyone who can solve this problem

 

I have 4 customer groups set up. I just went through all my products and set up min quantities that each group can purchase along with that group's individual pricing, and everything seemed to be working, but now I go into the products from the admin, and 2 out of the 4 groups no longer have any prices or quantities entered in! It's like it all just disappeared.

 

What do you think happened to cause this?

 

Any help would be appretiated. I spent so much time going through all the products to update only to loose half of it. I just dont want the same to happen again.

Share this post


Link to post
Share on other sites
I have 4 customer groups set up. I just went through all my products and set up min quantities that each group can purchase along with that group's individual pricing, and everything seemed to be working, but now I go into the products from the admin, and 2 out of the 4 groups no longer have any prices or quantities entered in! It's like it all just disappeared.

 

What do you think happened to cause this?

It has bitten a number of people. It is caused by a "helpful" piece of code in admin/customers.php around line 256 that starts with:

// BOF Separate Pricing Per Customer
// Once all customers with a specific customers_group_id have been deleted from
// the table customers, the next time a customer is deleted, all entries in the table products_groups
// that have the (now apparently obsolete) customers_group_id will be deleted!
// If you don't want that, leave this section out, or comment it out

So better comment it out or remove those couple of lines of code before you proceed.

Share this post


Link to post
Share on other sites
As soon as I'm not logged in, everything is fine. But as soon as any user logs in, no matter which group he is in, he just sees the Prices displayed without tax.

 

Also, if I add a price for another group of customers, it simply doesn't work. The price displayed is still the default price

Probably one or more tiny errors in adding code. Difficult to say where this happens. You haven't changed the setting in admin/customers_groups.php to "Show prices without tax" have you?

Also check if the SESSION variables are set correctly when logging in (this would be due to code in login.php).

Share this post


Link to post
Share on other sites
Hi JanZ oranyone who can solve this problem

 

I have 4 customer groups set up. I just went through all my products and set up min quantities that each group can purchase along with that group's individual pricing, and everything seemed to be working, but now I go into the products from the admin, and 2 out of the 4 groups no longer have any prices or quantities entered in! It's like it all just disappeared.

 

What do you think happened to cause this?

 

Any help would be appretiated. I spent so much time going through all the products to update only to loose half of it. I just dont want the same to happen again.

 

JanZ, thank you so much for your help! I commented that out and will try to input everything in once more.

But I have another problem I saw that someone else mentioned it, but I dont see a solution.

 

My customer groups are interfering with xSell that I have installed. If I am not logged in, or logged in as retail, I see all the xSell prooducts assigned. But as soon as I log in as any of the other 3 groups, either some, or none of the xSell products show up. I have no idea why this is happening? Would appretite any help you can give me.

Share this post


Link to post
Share on other sites
I commented that out and will try to input everything in once more.
Make backups once in a while. Possibly through phpMyAdmin, the table products_groups that contains those prices.
My customer groups are interfering with xSell that I have installed. If I am not logged in, or logged in as retail, I see all the xSell prooducts assigned. But as soon as I log in as any of the other 3 groups, either some, or none of the xSell products show up. I have no idea why this is happening?
Doesn't make any sense. SPPC is about prices so if you see the wrong prices in the xSell part, that is to be expected (and easy to solve if I remember correctly). However, not showing up doesn't make any sense unless the code for the xSell is stuck in a part that is only traversed when the customer group is retail (which doesn't make sense either). What version do you use?

Share this post


Link to post
Share on other sites
Make backups once in a while. Possibly through phpMyAdmin, the table products_groups that contains those prices.

Doesn't make any sense. SPPC is about prices so if you see the wrong prices in the xSell part, that is to be expected (and easy to solve if I remember correctly). However, not showing up doesn't make any sense unless the code for the xSell is stuck in a part that is only traversed when the customer group is retail (which doesn't make sense either). What version do you use?

 

I think I figured it out. Finally! It's a chain reaction. Since my prices disappeared from before (that little code you told me to comment out), any group that did not have any prices, would not show up on the xsell. Once I input the prices and min quantities for those groups, the xsell product started showing up!!!! :D

Share this post


Link to post
Share on other sites

I know this isn't a shipping module board - but I'm hoping someone here might have an idea as to what to tell me to look for :)

 

For some reason my shipping info is not showing up during checkout (at all). So - I uploaded a brand spanking new fresh osC to my server in a new folder and had it connect to my existing database. Sure enough - when I go to checkout I get NO shipping info! :o So I'm thinking it has to be something to do with the database??

 

Any ideas on where I should look, or what I should look for?

 

TIA :D


~Tracy
 

Share this post


Link to post
Share on other sites

Hello everyone. I've spent all day installing this contrib, and I have one major issue. In some, but not all of my categories the last product in that category doesn't show - almost like it's hidden. Exactly what medved described below is happening to me, except I didn't hide anything, nor have the facility to hide anything!

 

I *think* something from 4.1.1 code includes a hiding feature and is applying itself to the last items in categories?

 

I have installed nothing SPPC related other than "The NEW Separate Pricing Per Customer 4.1.1" package on an already-modified site.

 

If in modules/product_listing.php I uncomment the debug code, it print's all 6 products.

// next part is a debug feature, when uncommented it will print the info that this module receives
/*
  echo '<pre>';
  print_r($listing);
  echo '</pre>';
*/

Also, if I delete this part of the code at the beginning, it displays all 6 products (all be it not in the correct layout).

	//BOF version 2.2 modification
if (PRODUCT_LIST_NUMCOL <= 0) {
	$colnum = 3;
	$tdsize = floor(100/3);
} 

///THE PROBLEM LIES HERE!!
else {
	$colnum = PRODUCT_LIST_NUMCOL;
	$tdsize = floor(100/PRODUCT_LIST_NUMCOL);
}
//EOF version 2.2 modification

 

Can anyone please assist me in maintaing my layout but getting all the products to show up including the last one? :huh:

 

SO i have already installed Hide products from customer groups for SPPC from 6 Aug 2006. Everything seems to be all right. No error messages.

 

Thank you all who worked so hard on this contrib. I do appreciate it.

 

But please help with this questions:

 

1.

In the admin, I hided one entire category. On the website, in the category box the name of the category is still visible, but once I clicked the category link it didn't show the products. So is this how the contrib is suppose to work? To be able to see the category but not the products that are in it?

 

2.

I have 6 products in a category. Ive decided to hide the last one. And it is hidden. So thats great. But together with the image, is hidden also the styled table with the blue background. Is it possible to fix it?

 

1.jpg

 

before hiding the product

 

2.jpg

 

after hiding the product.

 

Is there any way how to fill the cut out space with the blue color?

 

3.

After installing Add Multiple Products to Cart, in columns, for SPPC I still have problem with Display Add Multiples column. When I insert quantity in the box and click "add to cart " button, nothing is added. Does anybody knows in which page could be a problem?

 

Thanks

 

As I have a strong hunch the problem lies in my modules/product_listing.php file, I'm copying it here... Note the file comments at the top - I see it's created by the same author. Could there be something here it doesn't like?

 

<?php

/*

original: $Id: product_listing.php,v 1.44 2003/06/09 22:49:43 hpdl Exp $

 

corrected for proper HTML 2005/07/10 JanZ

merged and updated by djmonkey1 with indispensable assistance by JanZ 2005/10/05

v2.1 developed by djmonkey1 with indispensable assistance by the Mighty JanZ 2005/10/09

reverted to a non-SPPC state by djmonkey1

v 2.2 modified by adilovetini with small feature 2006/04/18

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright (c) 2003 osCommerce

 

Released under the GNU General Public License

 

*/

 

//version 2.2 modification

//if number of column per row is 1, include the original product_listing.php

if (PRODUCT_LIST_NUMCOL == 1) {

include(dirname(__FILE__).'/product_listing.php');

 

} else{

//display the version 2.2 product_listing_col.php code

 

//bof product listing with attributes

$list_box_contents = array();

$list_box_contents[] = array('params' => 'class="productListing-heading"');

$cur_row = sizeof($list_box_contents) - 1;

 

for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {

switch ($column_list[$col]) {

case 'PRODUCT_LIST_MULTIPLE':

$add_multiple = "1";

echo '<form name="buy_now_" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_multiple', 'NONSSL') . '">';

break;

}

}

//eof product listing with attributes

?>

<?php

$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

 

if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {

?>

<!-- DAN INCLUSION START -->

<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="productlisting">

<tr>

<td width="50%" height="20" background="http://www.militarymadnessuk.co.uk/images/mmuk/boxheader_straight.gif"><img src="http://www.militarymadnessuk.co.uk/images/mmuk/boxheader_left.gif" width="11" height="20"></td>

<td width="50%" height="20" align="right" background="http://www.militarymadnessuk.co.uk/images/mmuk/boxheader_straight.gif"><img src="http://www.militarymadnessuk.co.uk/images/mmuk/boxheader_right.gif" width="11" height="20"></td>

</tr>

</table></td>

</tr>

<tr>

<td class="productlisting1">

<!-- DAN INCLUSION END -->

 

<!-- START OF DISPLAYING... AT THE TOP -->

<table border="0" width="100%" cellspacing="0" cellpadding="5">

<tr>

<td class="smallText" valign="top" height="30"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>

<td class="smallText" valign="top" align="right" height="30"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

</tr>

</table>

</td>

</tr>

</table>

<!-- END OF DISPLAYING... AT THE TOP -->

<?php

}

 

$list_box_contents = array();

 

if ($listing_split->number_of_rows > 0) {

 

//BOF version 2.2 modification

if (PRODUCT_LIST_NUMCOL <= 0) {

$colnum = 3;

$tdsize = floor(100/3);

}

 

///THE PROBLEM LIES HERE!!

else {

$colnum = PRODUCT_LIST_NUMCOL;

$tdsize = floor(100/PRODUCT_LIST_NUMCOL);

}

//EOF version 2.2 modification

 

$row = 0;

//$rows = 0;

$column = 0;

$listing_query = tep_db_query($listing_split->sql_query);

 

// BOF Separate Pricing per Customer

$no_of_listings = tep_db_num_rows($listing_query);

// global variable (session) $sppc_customer_group_id -> local variable customer_group_id

 

if(!tep_session_is_registered('sppc_customer_group_id')) {

$customer_group_id = '0';

} else {

$customer_group_id = $sppc_customer_group_id;

}

 

while ($_listing = tep_db_fetch_array($listing_query)) {

$listing[] = $_listing;

$list_of_prdct_ids[] = $_listing['products_id'];

}

// next part is a debug feature, when uncommented it will print the info that this module receives

/*

echo '<pre>';

print_r($listing);

echo '</pre>';

*/

$select_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' ";

if ($no_of_listings > 1) {

for ($n = 1; $n < count($list_of_prdct_ids); $n++) {

$select_list_of_prdct_ids .= "or products_id = '".$list_of_prdct_ids[$n]."' ";

}

}

 

// get all product prices for products with the particular customer_group_id

// however not necessary for customer_group_id = 0

if ($customer_group_id != '0') {

$pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where (".$select_list_of_prdct_ids.") and pg.customers_group_id = '".$customer_group_id."' ");

// $no_of_pg_products = tep_db_num_rows($pg_query);

while ($pg_array = tep_db_fetch_array($pg_query)) {

$new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => '', 'final_price' => $pg_array['price']);

}

for ($x = 0; $x < $no_of_listings; $x++) {

// replace products prices with those from customers_group table

if(!empty($new_prices)) {

for ($i = 0; $i < count($new_prices); $i++) {

if( $listing[$x]['products_id'] == $new_prices[$i]['products_id'] ) {

$listing[$x]['products_price'] = $new_prices[$i]['products_price'];

$listing[$x]['final_price'] = $new_prices[$i]['final_price'];

}

}

} // end if(!empty($new_prices)

$listing[$x]['specials_new_products_price'] = ''; // makes sure that a retail specials price doesn't carry over to another customer group

$listing[$x]['final_price'] = $listing[$x]['products_price']; // final price should not be the retail special price

} // end for ($x = 0; $x < $no_of_listings; $x++)

} // end if ($customer_group_id != '0')

 

// an extra query is needed for all the specials

 

$specials_query = tep_db_query("select products_id, specials_new_products_price from " . TABLE_SPECIALS . " where (".$select_list_of_prdct_ids.") and status = '1' and customers_group_id = '" .$customer_group_id. "'");

while ($specials_array = tep_db_fetch_array($specials_query)) {

$new_s_prices[] = array ('products_id' => $specials_array['products_id'], 'products_price' => '', 'specials_new_products_price' => $specials_array['specials_new_products_price'] , 'final_price' => $specials_array['specials_new_products_price']);

}

 

// add the correct specials_new_products_price and replace final_price

for ($x = 0; $x < $no_of_listings; $x++) {

 

if(!empty($new_s_prices)) {

for ($i = 0; $i < count($new_s_prices); $i++) {

if( $listing[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) {

$listing[$x]['specials_new_products_price'] = $new_s_prices[$i]['specials_new_products_price'];

$listing[$x]['final_price'] = $new_s_prices[$i]['final_price'];

}

}

} // end if(!empty($new_s_prices)

} // end for ($x = 0; $x < $no_of_listings; $x++)

 

// while ($listing = tep_db_fetch_array($listing_query)) { (was original code)

 

// WARNING the code assumes there are three products per row. To use a different number change the number

// at line 195: if ($column >= 3) and the code to fill up the table row below that accordingly

 

// $counter = $row;

// $class_for_buy_now = 'class="productListing-odd"';

// $list_box_contents[$row] = array('params' => 'class="productListing-odd"');

 

for ($x = 0; $x < $no_of_listings; $x++) {

 

$rows++;

 

if (($rows/2) == floor($rows/2) && ($row > $counter)) {

$list_box_contents[$row] = array('params' => '');

//2.2 modification ,add width in td

$class_for_buy_now = 'class="productListing-even" width="'.$tdsize.'%"';

$counter = $row;

} else {

if ($row > $counter) {

$list_box_contents[$row] = array('params' => '');

//2.2 modification ,add width in td

$class_for_buy_now = 'class="productListing-odd" width="'.$tdsize.'%"';

$counter = $row;

}

}

 

//EDIT BY DAN - Change colour of background to red/green depending if in or out of stock

if ((tep_get_products_stock($listing[$x]['products_id']) <= 0)) { $listingcolor = 'productinfoout';

} else { $listingcolor = 'productinfo';}

 

$product_contents = array();

 

for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {

$lc_align = '';

 

switch ($column_list[$col]) {

case 'PRODUCT_LIST_MODEL':

$lc_align = '';

$lc_text = ' ' . $listing[$x]['products_model'] . ' ';

break;

case 'PRODUCT_LIST_NAME':

$lc_align = '';

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$lc_text = '<table width="95%" height="50"><tr><td class="productinfo" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a>';

} else {

//HERE STARTS PRODUCT LISTING NAME & PRICE FOR EACH CATEGORY

$lc_text = '<table width="95%" height="50"><tr><td class="' . $listingcolor . '" align="center"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a> ';

}

break;

case 'PRODUCT_LIST_MANUFACTURER':

$lc_align = '';

$lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing[$x]['manufacturers_id']) . '">' . $listing[$x]['manufacturers_name'] . '</a> ';

break;

case 'PRODUCT_LIST_PRICE':

$lc_align = 'right';

if (tep_not_null($listing[$x]['specials_new_products_price'])) {

$lc_text = ' <s><b><font color="0685FF">' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</s></b></font> <span class="productSpecialPrice"><b>' . $currencies->display_price($listing[$x]['specials_new_products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</b></span> </td></tr></table>';

} else {

$lc_text = ' <font color="0685FF"><b>' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</b></font> </td></tr></table>';

}

break;

case 'PRODUCT_LIST_QUANTITY':

$lc_align = 'right';

$lc_text = ' ' . /*$listing[$x]['products_quantity']*/ '' . ' ';

break;

case 'PRODUCT_LIST_WEIGHT':

$lc_align = 'right';

$lc_text = ' ' . $listing[$x]['products_weight'] . ' ';

break;

case 'PRODUCT_LIST_IMAGE':

$lc_align = 'center';

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$lc_text = '<br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';

} else {

$lc_text = '<br> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';

}

break;

//bof product listing with attributes

case 'PRODUCT_LIST_BUY_NOW':

$lc_align = 'center';

$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

break;

// Begin Buy Now button with attributes and quantity mod

// Begin Add Multiple with attributes Contrib

case 'PRODUCT_LIST_MULTIPLE':

$lc_align = 'right';

$lc_valign = 'top';

$lc_text = (TABLE_HEADING_MULTIPLE . tep_draw_input_field('Qty_ProdId_' . $listing[$x]['products_id'], '0', 'size="4"'));

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . $listing[$x]['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "'");

$product_info = tep_db_fetch_array($product_info_query);

$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing[$x]['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'");

$products_attributes = tep_db_fetch_array($products_attributes_query);

if ($products_attributes['total'] > 0) {

$lc_text .= '<table border="0" cellpadding="0" cellspacing"0">';

$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing[$x]['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'");

while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {

$selected = 0;

$products_options_array = array();

$lc_text .= '<tr><td class="main">' . $products_options_name['products_options_name'] . ':</td><td>' . "\n";

$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $listing[$x]['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'");

while ($products_options = tep_db_fetch_array($products_options_query)) {

$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);

if ($products_options['options_values_price'] != '0') {

$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';

}

}

//$lc_text .= tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]);

//$lc_text .= tep_draw_pull_down_menu('id_'.$listing[$x]['products_id'].'[' . $products_options_name_values['products_options_id'] . ']', $products_options_array);

$lc_text .= tep_draw_pull_down_menu('id_'.$listing[$x]['products_id'].'[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]);

//$lc_text .= tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]);

$lc_text .= '</td></tr>';

}

$lc_text .= '</table>';

}

break;

case 'PRODUCT_LIST_BUY_NOW_MULTIPLE':

$lc_align = 'right';

$lc_valign = 'top';

$lc_text = '<form name="buy_now_' . $listing[$x]['products_id'] . '" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now_form', 'NONSSL') . '">';

$lc_text .= (TABLE_HEADING_MULTIPLE) . '<input type="text" name="cart_quantity" value="1" maxlength="6" size="4">';

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . $listing[$x]['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "'");

$product_info = tep_db_fetch_array($product_info_query);

$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing[$x]['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'");

$products_attributes = tep_db_fetch_array($products_attributes_query);

if ($products_attributes['total'] > 0) {

$lc_text .= '<table border="0" cellpadding="0" cellspacing"0">';

$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing[$x]['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'");

while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {

$selected = 0;

$products_options_array = array();

$lc_text .= '<tr><td class="main">' . $products_options_name['products_options_name'] . ':</td><td>' . "\n";

$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . $listing[$x]['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'");

while ($products_options = tep_db_fetch_array($products_options_query)) {

$products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);

if ($products_options['options_values_price'] != '0') {

$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';

}

}

$lc_text .= tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]);

//$lc_text .= tep_draw_pull_down_menu('id_'.$listing['products_id'].'[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]);

$lc_text .= '</td></tr>';

}

$lc_text .= '</table>';

$lc_text .= tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_buy_now.gif', TEXT_BUY . $listing[$x]['products_name'] . TEXT_NOW);

 

}

if ($products_attributes['total'] == 0) {

$lc_text .= '<br> ';

$lc_text .= tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_buy_now.gif', TEXT_BUY . $listing[$x]['products_name'] . TEXT_NOW);

$lc_text .= '<br> ';

$lc_text .= '<table border="0" cellpadding="0" cellspacing"0"><tr><td class="main"></td><td></td></tr></table>';

}

$lc_text .= '</form>';

break;

// End Add Multiple mod

}

$product_contents[] = $lc_text;

}

$lc_text = implode('<br>', $product_contents);

$list_box_contents[$row][$column] = array('align' => 'center',

//bof product listing with attributes

'valign' => $lc_valign,

//eof product listing with attributes

//2.2 modification ,add width in td

'params' => 'class="productListing-data" width="'.$tdsize.'%"',

'text' => $lc_text);

 

$column ++;

 

if ($x == ($no_of_listings -1)) {

 

//BOF version 2.2 modification

// fill up the remainder of the table row with empty cells, assumes three products per row!

for($column=1; $column < $colnum; $column++) {

$list_box_contents[$row][$column + 1] = array('align' => 'center',

//bof product listing with attributes

'valign' => $lc_valign,

//eof product listing with attributes

//2.2 modification ,add width in td

'params' => 'class="productListing-data" width="'.$tdsize.'%"',

'text' => " ");

}

//EOF version 2.2 modification

 

//the commented code below is the old 2.1 version

/*

if ($column == '1') {

$list_box_contents[$row][$column + 1] = array('align' => 'center',

//bof product listing with attributes

'valign' => $lc_valign,

//eof product listing with attributes

'params' => 'class="productListing-data"',

'text' => " ");

$column ++;

}

if ($column == '2') {

$list_box_contents[$row][$column + 1] = array('align' => 'center',

//bof product listing with attributes

'valign' => $lc_valign,

//eof product listing with attributes

'params' => 'class="productListing-data"',

'text' => " ");

}

*/

}

 

//BOF version 2.2 modification

//change the hardcoded value of 3 to $colnum variable

if ($column >= $colnum || $x == ($no_of_listings -1) ) {

$row ++; // we start a new tr here with $list_box_contents

$list_box_contents[$row] = array('params' => $class_for_buy_now);

$column = 0;

}

//EOF version 2.2 modification

} // end for ($x = 0; $x < $no_of_listings; $x++)

 

new productListingBox($list_box_contents);

 

} else {

$list_box_contents = array();

//just below is the area for when it says no products in category

$list_box_contents[0] = array('params' => '');

$list_box_contents[0][] = array('params' => '',

'text' => '<!-- DAN INCLUSION START -->

<table border="0" width="100%

Share this post


Link to post
Share on other sites
Hello everyone. I've spent all day installing this contrib, and I have one major issue. In some, but not all of my categories the last product in that category doesn't show - almost like it's hidden. Exactly what medved described below is happening to me, except I didn't hide anything, nor have the facility to hide anything!
Not the same problem at all, although the same flaw (my fault) is found here also. If text is just a space between quotes, osC will throw out that table cell. It needs to be 'text' => "& #160;" where the space between the ampersand and the #160; should be removed. I think the problem is in the 2.2 modification. The last product in a full row will be nilled (as you experience) IMO.

/* start comment out version 2.2			//BOF version 2.2 modification
		// fill up the remainder of the table row with empty cells, assumes three products per row!
		for($column=1; $column < $colnum; $column++) {
			$list_box_contents[$row][$column + 1] = array('align' => 'center',
											//bof product listing with attributes
											'valign' => $lc_valign,
											//eof product listing with attributes
											//2.2 modification ,add width in td
										  'params' => 'class="productListing-data" width="'.$tdsize.'%"',
										  'text'  => "& #160;");
		}
		//EOF version 2.2 modification */

		//the no longer commented code below is the old 2.1 version
		//
		if ($column == '1') {
			$list_box_contents[$row][$column + 1] = array('align' => 'center',
											//bof product listing with attributes
											'valign' => $lc_valign,
											//eof product listing with attributes
										  'params' => 'class="productListing-data" width="'.$tdsize.'%"',
										  'text'  => "& #160;");
			$column ++;
		}
		if ($column == '2') {
			$list_box_contents[$row][$column + 1] = array('align' => 'center',
											//bof product listing with attributes
											'valign' => $lc_valign,
											//eof product listing with attributes
										  'params' => 'class="productListing-data" width="'.$tdsize.'%"',
										  'text'  => "& #160;");
		}
		// back to 2.1
	}

	//BOF version 2.2 modification
	//change the hardcoded value of 3 to $colnum variable
// but don't start a new table row with the last product !
// mixing up code here, in the version it is intended for a new row was started with the buy now buttons (to get them aligned) makes no sense to start a new row after the last product
	if ($column >= $colnum && $x < ($no_of_listings -1) ) {
		$row ++; // we start a new tr here  with $list_box_contents
		$list_box_contents[$row] = array('params' => $class_for_buy_now);
		$column = 0;
	}
	//EOF version 2.2 modification 
} // end for ($x = 0; $x < $no_of_listings; $x++)

new productListingBox($list_box_contents);

} else {
$list_box_contents = array();
//just below is the area for when it says no products in category
$list_box_contents[0] = array('params' => '');
$list_box_contents[0][] = array('params' => '',
							   'text' => '<!-- DAN INCLUSION START -->
<table border="0" width="100%

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×