Patty Posted January 31, 2007 Share Posted January 31, 2007 Hey, Ken. I mean, clicking in one product on the Edit Tag page list will take to the product information page on the store. That would be nice. ;) Quote Patty Link to comment Share on other sites More sharing options...
GemRock Posted January 31, 2007 Author Share Posted January 31, 2007 (edited) Hi Patty I dont know why you want it, but anyway it can be done I think: 1. Open header tags edit php, find this line (about line 221): echo "<td class=\"smallText\" align=\"left\">".$products['products_name']."</td>\n"; Replace it with: echo "<td class=\"smallText\" align=\"left\"><a href=" . tep_href_link_shop('product_info.php?products_id='. $products['products_id']). ">".$products['products_name']."</a></td>\n"; Save & close. 2. copy the code below & paste it into html_output.php under admin/includes/functions/, just before the closing ?> at the end of the file: // The HTML href link wrapper function used in header tags edit HT4N - GemRock function tep_href_link_shop($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) { global $request_type, $session_started, $SID; if (!tep_not_null($page)) { die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>'); } if ($connection == 'NONSSL') { $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG; } elseif ($connection == 'SSL') { if (ENABLE_SSL == true) { $link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG; } else { $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG; } } else { die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL</b><br><br>'); } if (tep_not_null($parameters)) { $link .= $page . '?' . tep_output_string($parameters); $separator = '&'; } else { $link .= $page; $separator = '?'; } while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1); // Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined if ( ($add_session_id == true) && ($session_started == true) && (SESSION_FORCE_COOKIE_USE == 'False') ) { if (tep_not_null($SID)) { $_sid = $SID; } elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == true) ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) { if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) { $_sid = tep_session_name() . '=' . tep_session_id(); } } } if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) { while (strstr($link, '&&')) $link = str_replace('&&', '&', $link); $link = str_replace('?', '/', $link); $link = str_replace('&', '/', $link); $link = str_replace('=', '/', $link); $separator = '?'; } if (isset($_sid)) { $link .= $separator . tep_output_string($_sid); } return $link; } save & close. 3. open configure.php under catalog/includes/, look for the define line for DIR_WS_HTTP_CATALOG, copy the whole line and paste into configure.php under folder admin/includes/, just above the ENABLE_SSL_CATALOG line. Now, in header tags edit page, when you click any of the product names on the left, it'd take you to that product's info page. Let me know if it works. Ken Edited January 31, 2007 by GemRock Quote commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
bill110 Posted February 1, 2007 Share Posted February 1, 2007 I posted this in the wrong thread (the original topic) The newest version says it's a complete package but does'nt have the screenshots or install text. I downloaded the original but will use the newest for copy and paste to ensure no typos. Thanks for the contribution. Quote My Contributions Stylesheet With Descriptions Glassy Grey Boxtops Our Products Meta Tags On The Fly Password Protect Admin "No matter where you go....There you are" - Buccaroo Bonsai Link to comment Share on other sites More sharing options...
GemRock Posted February 1, 2007 Author Share Posted February 1, 2007 I have posted an acknowledgement here Ken Quote commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
Patty Posted February 1, 2007 Share Posted February 1, 2007 Hi, Ken. It's not that I want it, I just thought it could be useful. Tks for your prompt reply. I'll try that and post a feedback here. :thumbsup: Quote Patty Link to comment Share on other sites More sharing options...
Talle Posted February 3, 2007 Share Posted February 3, 2007 Hi again. How do I do if I want to skip the category in the page title and only want it to display productname and then shop name. Or posibly productname - category - shopname. Thx //Talle Quote Link to comment Share on other sites More sharing options...
GemRock Posted February 3, 2007 Author Share Posted February 3, 2007 (edited) ...if I want to skip the category in the page title and only want it to display productname and then shop name.Or posibly productname - category - shopname... Hi Talle Assuming your title tag in product info.php is this <title><?php echo $header_tags[title_tag]; ?></title> 1. you could enter whatever you like in the title tags field (column) in header tags edit page, e.g., productname - shop name. or 2. you could change the title tag to something like this: <title><?php echo $header_tags[products_name] . '-' . $categories['categories_name'] . '-' . TITLE; ?></title> assuming your shop's TITLE is defined by using your shop name. You could replace '-' with space, ie, ' ', if you dont want '-' between product name and category name. 3. if you dont want category name, then delete '-' . $categories['categories_name'] . HTH Ken Edited February 3, 2007 by GemRock Quote commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
Talle Posted February 3, 2007 Share Posted February 3, 2007 Thank you Ken! //Talle Quote Link to comment Share on other sites More sharing options...
Talle Posted February 4, 2007 Share Posted February 4, 2007 Just a quick question, what should I use to separate keywords? is it just a (blank) or a ,(comma) or a ; best regards //Talle Quote Link to comment Share on other sites More sharing options...
GemRock Posted February 4, 2007 Author Share Posted February 4, 2007 ...what should I use to separate keywords?is it just a (blank) or a ,(comma) or ... Comma is the answer. Ken Quote commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
Talle Posted February 4, 2007 Share Posted February 4, 2007 thank you! Should it be: keyword, keywork or keyword,keyword = shall it be a space betwen the comma and the next word or not, does it even matter? regards //Talle Quote Link to comment Share on other sites More sharing options...
GemRock Posted February 4, 2007 Author Share Posted February 4, 2007 ...shall it be a space betwen the comma and the next word or not, does it even matter?.. I dont think it matters. Ken PS. just returned from a long journey... Quote commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
GemRock Posted February 6, 2007 Author Share Posted February 6, 2007 As promised, a new package ('version 2') has just been uploaded to the contributions server (see the link in my signature). GemRock Quote commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
yos40 Posted February 9, 2007 Share Posted February 9, 2007 Hello, I seem to bump into a problem When I try to add a product to the cart i get this Warning: Cannot modify header information - headers already sent by (output started at /home/content/y/o/s/yos40/html/includes/languages/english.php:324) in /home/content/y/o/s/yos40/html/includes/functions/general.php on line 27 This is my general PHP <?php/* $Id: general.php,v 1.231 2003/07/09 01:15:48 hpdl Exp $ E-Commerce Solutions Copyright (c) 2005 www.flash-template-design.com Released under the GNU General Public License*/////// 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 ( (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']; } ////// 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"); $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; } } ////// 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; } } ////// 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; 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) ) { 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; } } } else { $month = substr($date_to_check, strpos($format_string, 'mm'), 2); } } else { return false; } $day = substr($date_to_check, strpos($format_string, 'dd'), 2); $year = substr($date_to_check, strpos($format_string, 'yyyy'), 4); } if (strlen($year) != 4) { return false; } if (!settype($year, 'integer') || !settype($month, 'integer') || !settype($day, 'integer')) { return false; } if ($month > 12 || $month < 1) { return false; } if ($day < 1) { return false; } if (tep_is_leap_year($year)) { $no_of_days[1] = 29; } if ($day > $no_of_days[$month - 1]) { return false; } $date_array = array($year, $month, $day); return true; } ////// Check if year is a leap year function tep_is_leap_year($year) { if ($year % 100 == 0) { if ($year % 400 == 0) return true; } else { if (($year % 4) == 0) return true; } return false; } ////// Return table heading with sorting capabilities function tep_create_sort_heading($sortby, $colnum, $heading) { global $PHP_SELF; $sort_prefix = ''; $sort_suffix = ''; if ($sortby) { $sort_prefix = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('page', ' Quote Link to comment Share on other sites More sharing options...
Sinequanon Posted February 9, 2007 Share Posted February 9, 2007 Hi Thanks so much for your contribution. It's all working when I view source - but the link in my admin panel is not working. When I mose over the 'Edit Header Tags' it says 'co.uk/admin/FILENAME_HEADER_TAGS_EDIT' and not the 'header_tags_edit.php' Hope you can help - sure it's simple. I have uploaded all the correct files. Thanks in advance For those who dont mind to spend a few more minutes on installation of this contrib, you can make the header_tags_edit.php accessible from the catalog box: 1. open filenames.php under admin/includes/ add this line just before the closing ?> at the bottom of the file: define('FILENAME_HEADER_TAGS_EDIT', 'header_tags_edit.php'); Save & close the file. 2. open english.php (or your shop's language.php) under admin/includes/languages/ find this line: define('BOX_CATALOG_PRODUCTS_EXPECTED', 'Products Expected'); Below it, add: define('BOX_CATALOG_HEADER_TAGS_EDIT', 'Edit Header Tags'); Save & close the file. 3. open catalog.php under admin/includes/boxes/ find this line: $contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS . '</a><br>' . below it, add: '<a href="' . tep_href_link(FILENAME_HEADER_TAGS_EDIT, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_HEADER_TAGS_EDIT . '</a><br>' . Save & close the file. Now, you can access the Edit Header Tag function from the catalog box. Enjoy! Ken Quote Link to comment Share on other sites More sharing options...
GemRock Posted February 9, 2007 Author Share Posted February 9, 2007 ../admin/FILENAME_HEADER_TAGS_EDIT' and not the 'header_tags_edit.php'... as far as I can see, there's only one reason for this error, ie, step 1 hasnt been done correctly. Note that the filenames.php is the one under admin/includes/, and not the one under catalog/includes. Ken Quote commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
GemRock Posted February 9, 2007 Author Share Posted February 9, 2007 Hi yos40 I suppose your reported problem has nothing to do with HT4N, which doesn't touch either english.php or general.php on the catalog side in any way. Ken Quote commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
yos40 Posted February 9, 2007 Share Posted February 9, 2007 ../admin/FILENAME_HEADER_TAGS_EDIT' and not the 'header_tags_edit.php'... as far as I can see, there's only one reason for this error, ie, step 1 hasnt been done correctly. Note that the filenames.php is the one under admin/includes/, and not the one under catalog/includes. Ken Ok thanks any idea wuzzp? I got no idea what to do now ... Every time my store is upon compleation and somthing gets fucked up... Relly need a lil help My site is http://www.C-square-D.com Thanks for the help Quote Link to comment Share on other sites More sharing options...
yos40 Posted February 9, 2007 Share Posted February 9, 2007 Sorry, I qouted the other replay, Quote Link to comment Share on other sites More sharing options...
GemRock Posted February 10, 2007 Author Share Posted February 10, 2007 Dan (sassypickles), This is what it should look like: <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo (strlen($categories['categories_name']) > 1) || (strlen($manufacturers['manufacturers_name']) > 1) ? $breadcrumb_tags->trail_tags(' ') . ' - ' . TITLE : TITLE; ?></title> <meta name="description" content="<?php echo strip_tags($breadcrumb_tags->trail_tags(' ')); ?>"> <meta name="keywords" content="<?php echo strip_tags($breadcrumb_tags->trail_tags(', ')); ?>"> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> Ken Quote commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
GemRock Posted February 10, 2007 Author Share Posted February 10, 2007 I have opened the application_top.php from the dowload and don't see Step 2 was wanting to know if I'm missing something Dan (sassypickles), Please refer to the minimum install instructions, it says: Step 2If you have not made any change to application_top.php under folder: catalog/includes/, then simply upload and replace it with the one you just downloaded, then go to Step 3. Otherwise, open the application_top.php for edit using a php file editor or a good text editor. btw, do not email or pm me with regard to the support issues of my contribution, it wont be quicker to get a response than posting your question on the forum here. I am sorry but i wont be able to answer any un-invited pm or email regarding your own/other osc problems. You are advised to better post it to the relevant thread on the forums to get a quicker response. Ken Quote commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
bill110 Posted February 11, 2007 Share Posted February 11, 2007 I found one small mistake in the catalog/admin/header_tags_edit.php this line define(FILENAME_HEADER_TAGS_EDIT, 'header_tags_edit.php'); should be define('FILENAME_HEADER_TAGS_EDIT', 'header_tags_edit.php'); It was missing single quotes and gave this error message: Notice: Use of undefined constant FILENAME_HEADER_TAGS_EDIT - assumed 'FILENAME_HEADER_TAGS_EDIT' in c:\program files\easyphp1-8\mysite\admin\header_tags_edit.php on line 14 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\program files\easyphp1-8\mysite\admin\header_tags_edit.php:14) in c:\program files\easyphp1-8\mysite\admin\includes\functions\sessions.php on line 67 Quote My Contributions Stylesheet With Descriptions Glassy Grey Boxtops Our Products Meta Tags On The Fly Password Protect Admin "No matter where you go....There you are" - Buccaroo Bonsai Link to comment Share on other sites More sharing options...
GemRock Posted February 11, 2007 Author Share Posted February 11, 2007 ...It was missing single quotes and gave this error message:Notice: Use of undefined constant FILENAME_HEADER_TAGS_EDIT - assumed 'FILENAME_HEADER_TAGS_EDIT' in c:\program files\easyphp1-8\mysite\admin\header_tags_edit.php on line 14... Hi Bill Thanks for that :thumbsup: . Anyone got that error could try Bill's tips. Just out of curiosity, under what circumstance (php version etc) did you get that error, as I have never got that error in all my installations of this contribution, whether locally or on live servers. To be on the safe side, I will put quotation marks on that constant in the next release. Ken Quote commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
bill110 Posted February 11, 2007 Share Posted February 11, 2007 Hi yos40: None of the header tags contributions would make their focus on non-product pages, e.g., conditions, contact us etc. There is one that has default keywords and descriptions for pages that are not product related. It's called custom meta tags per item. I am trying to find a way to incorporate some of its code with this one as that one REQUIRES you enter descriptions and keywords in admin or you get the default for those products. I'm hoping to find a way for this code to call a default string if the keyword and/or description fields are blank due to being on a non-product page. Quote My Contributions Stylesheet With Descriptions Glassy Grey Boxtops Our Products Meta Tags On The Fly Password Protect Admin "No matter where you go....There you are" - Buccaroo Bonsai Link to comment Share on other sites More sharing options...
bill110 Posted February 11, 2007 Share Posted February 11, 2007 Hi Bill Thanks for that :thumbsup: . Anyone got that error could try Bill's tips. Just out of curiosity, under what circumstance (php version etc) did you get that error, as I have never got that error in all my installations of this contribution, whether locally or on live servers. To be on the safe side, I will put quotation marks on that constant in the next release. Ken php 4.3.10 apache 1.3.33 mysql 4.1.9 Quote My Contributions Stylesheet With Descriptions Glassy Grey Boxtops Our Products Meta Tags On The Fly Password Protect Admin "No matter where you go....There you are" - Buccaroo Bonsai Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.