jozinecko Posted November 11, 2009 Share Posted November 11, 2009 Hello, please how I get on output in xml feed full category path? here is my xml_feed.php thank you <?php /* $Id: xml_vitalprix.php,v 1.00 2005/04/55 10:00:hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Modified for VitalPrix by Damien Laureaux - Timoa Contact : [email protected] This little contribution is based on the contribution xml_guide.php created by Toucouleur.fr:[email protected] Copyright (c) 2003 osCommerce Released under the GNU General Public License */ Header( 'Content-Type: text/xml; charset=windows-1250' ); define ('DISPLAY_PRICE_WITH_TAX', true); echo '<?xml version = "1.0" encoding = "windows-1250"?>'; require('includes/application_top.php'); echo '<products>'."\n"; $language_code = (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) ? $HTTP_GET_VARS['language'] : DEFAULT_LANGUAGE; $included_categories_query = tep_db_query("SELECT c.categories_id, c.parent_id, cd.categories_name FROM " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd WHERE c.categories_id = cd.categories_id AND cd.language_id = FLOOR($languages_id)"); $inc_cat = array(); // Texte tronqué -------------------------------------------------- function cut_text($text,$nbcar=0) { $text = strip_tags(str_replace(array('<BR>','<br>'), "</P>\n<P>",html_entity_decode($text))); if (strlen($text) > $nbcar && (0!=$nbcar)) { $tmp_tb = explode( ' ', $text ); $tmp_count = 0; $tmp_O = ''; while(list(,$v) = each($tmp_tb)) { if (strlen($tmp_O) >= $nbcar) break; $tmp_O .= $v.' '; } $tmp_O = substr( $tmp_O, 0, strlen($tmp_O)-1 ); if ( count($tmp_tb) > 1 ) $tmp_O .= '...'; } else $tmp_O = $text; return $tmp_O; } while ($included_categories = tep_db_fetch_array($included_categories_query)) { $inc_cat[] = array ( 'id' => $included_categories['categories_id'], 'parent' => $included_categories['parent_id'], 'name' => $included_categories['categories_name']); } $cat_info = array(); for ($i=0; $i<sizeof($inc_cat); $i++) $cat_info[$inc_cat[$i]['id']] = array ( 'parent'=> $inc_cat[$i]['parent'], 'name' => $inc_cat[$i]['name'], 'path' => $inc_cat[$i]['id'], 'link' => '' ); for ($i=0; $i<sizeof($inc_cat); $i++) { $cat_id = $inc_cat[$i]['id']; while ($cat_info[$cat_id]['parent'] != 0){ $cat_info[$inc_cat[$i]['id']]['path'] = $cat_info[$cat_id]['parent'] . '_' . $cat_info[$inc_cat[$i]['id']]['path']; $cat_id = $cat_info[$cat_id]['parent']; } $link_array = split('_', $cat_info[$inc_cat[$i]['id']] ['path']); for ($j=0; $j<sizeof($link_array); $j++) { $cat_info[$inc_cat[$i]['id']]['link'] .= ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $cat_info[$link_array[$j]]['path']) . '"><nobr>' . $cat_info[$link_array[$j]]['name'] . '</nobr></a> » '; } } $products_query = tep_db_query("SELECT p.*, pd.products_name, pd.products_description, pc.categories_id FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " pc WHERE p.products_id = pd.products_id AND p.products_id = pc.products_id AND p.products_status = 1 AND pd.language_id = FLOOR($languages_id) ORDER BY pc.categories_id, pd.products_name"); $product_num = 0; while($products = tep_db_fetch_array($products_query)) { if (intval($products['manufacturers_id']) > 0) { $manufacturers_query = tep_db_query("SELECT manufacturers_name FROM " . TABLE_MANUFACTURERS . " WHERE manufacturers_id = " . $products['manufacturers_id']); $manufacturers_result = tep_db_fetch_array($manufacturers_query); $products['manufacturers_name'] = $manufacturers_result['manufacturers_name']; } $special_query = tep_db_query("SELECT specials_new_products_price FROM " . TABLE_SPECIALS . " WHERE products_id = " . $products['products_id'] . " AND status = '1'"); if ($special_result = tep_db_fetch_array($special_query)) { $products['products_special'] = 1; $products['products_special_price'] = $special_result['specials_new_products_price']; } else { $products['products_special'] = 0; $products['products_special_price'] = 0; } $product_num++; echo '<product>'."\n"; echo '<id>'. $products['products_id'] .'</id>'."\n";; echo '<name>'. $products['products_name'] .'</name>'."\n";; echo '<description>'. $products['products_name'] .'</description>'."\n";; echo '<price>'. round(tep_add_tax($products['products_price'], tep_get_tax_rate($products['products_tax_class_id']))).'</price>'."\n"; echo '<category>'.$cat_info[$products['categories_id']]['name'] . '</category>'."\n";; echo '<manufacturer>'.$products['manufacturers_name'].'</manufacturer>'."\n";; echo '<url>'. HTTP_SERVER . DIR_WS_HTTP_CATALOG . FILENAME_PRODUCT_INFO . '?products_id=' . $products['products_id'] .'</url>'."\n";; echo '<picture>'. HTTP_SERVER . DIR_WS_HTTP_CATALOG . DIR_WS_IMAGES . $products['products_image'] .'</picture>'."\n";; echo '<part_number>'. $products['products_id'] .'</part_number>'."\n";; echo '<shipping>'. 'ZDARMA' .'</shipping>'."\n";; echo '<availability><![CDATA['. 'podla popisu' .']]></availability>'."\n";; echo '</product>'."\n";; } echo '</products>'; require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Quote Link to comment Share on other sites More sharing options...
jozinecko Posted November 13, 2009 Author Share Posted November 13, 2009 Hello, please can you HELP ME? THANK YOU Quote Link to comment Share on other sites More sharing options...
drferrari Posted February 4, 2013 Share Posted February 4, 2013 look here: http://www.oscommerce.com/forums/topic/391546-full-categories-path-in-xml-file/#entry1662445 Quote 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.