Discussions
Getting sitecategory name in scheduled script
I’m trying to implement a way of cross selling into our product pages.
IE: having a list of other categories the item is in listed on the product page with links to these categories.
At first I wrote a script which was ran each time an item was opened and then saved:
for ( var i = 1; i <= nlapiGetLineItemCount('sitecategory'); i++ )
{
text = nlapiGetLineItemText('sitecategory', 'category', i);
strCategories += text.replace("'", "\\'");
if( i != nlapiGetLineItemCount('sitecategory') )
strCategories += ' | ';
}
this got me a list of categories the item is in like 'Cat : Sub Cat 1 | cat2 : sub cat2'
This was becoming unmanagable and so i decided to make it a scheduled script, the problem is the same code returns for example '1075 | 57734'.