Jump to content



Latest News: (loading..)

drferrari

Member Since 17 Apr 2007
OFFLINE Last Active Apr 05 2013 04:36 PM
-----

Posts I've Made

In Topic: full categories path in XML file

04 April 2013 - 05:19 PM

You have an error in your SQL syntax;
fromproducts p
from products p

In Topic: How to get full cat path?

04 February 2013 - 06:33 PM

this maybe help: http://forums.oscommerce.com/topic/391546-full-categories-path-in-xml-file/#entry1662445

In Topic: xml feed how I display full category path

04 February 2013 - 06:33 PM

look here: http://forums.oscommerce.com/topic/391546-full-categories-path-in-xml-file/#entry1662445

In Topic: full categories path in XML file

04 February 2013 - 06:29 PM

includes/functions/general.php

add 2 new functions

////
// FOR MY XML FILE TO FIND ***FULL CATEGORIES PATH *******
//
function tep_get_parent_categories_xml_file(&$categories, $categories_id) {
$parent_categories_query = tep_db_query("select c.parent_id, cd.categories_id, cd.categories_name
from " . TABLE_CATEGORIES . " c,". TABLE_CATEGORIES_DESCRIPTION ." cd
where
c.categories_id = '" . (int)$categories_id . "' and
c.parent_id = cd.categories_id limit 1");
	
while ($parent_categories = tep_db_fetch_array($parent_categories_query)) {
	 if ($parent_categories['parent_id'] == 0) return true;
	 $categories[sizeof($categories)] = $parent_categories['categories_name'];
	 if ($parent_categories['parent_id'] != $categories_id) {
	 tep_get_parent_categories_xml_file($categories, $parent_categories['parent_id']);
	 }
}
}
////
// FOR MY XML FILE TO FIND ***FULL CATEGORIES PATH *******
//
function tep_get_product_path_xml_file($products_id) {
$cPath = '';
$category_query = tep_db_query("select p2c.categories_id, cd.categories_id, cd.categories_name
from" . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, ". TABLE_CATEGORIES_DESCRIPTION ." cd
where
p.products_id = '" . (int)$products_id . "' and
p.products_status = '1' and
p.products_id = p2c.products_id and
cd.categories_id = p2c.categories_id limit 1");

if (tep_db_num_rows($category_query)) {
	 $category = tep_db_fetch_array($category_query);
	 $categories = array();
	 tep_get_parent_categories_xml_file($categories, $category['categories_id']);
	 $categories = array_reverse($categories);
	 $cPath = implode('_', $categories);
	 if (tep_not_null($cPath)) $cPath .= ' > ';
	 $cPath .= $category['categories_name'];
}
return HEADER_TITLE_TOP ." > ".$cPath;
}

add to xml file:
<categoryPath><?php echo tep_get_product_path_xml_file($new_products['products_id']); ?></categoryPath>

this is the solution for Full categories Path.

In Topic: full categories path in XML file

04 February 2013 - 05:15 PM

tep_get_product_path($products_id); give you e.g. 39_51

39=Auto, 51=ferrari

how can I convert 39_51 to words => Auto > Ferrari

I think I must create new tep_get_product_path2