How to set X-Cart default main category?

We all know that there are many categories for an X-Cart Based EC shop, say www.prescriptionglassesonline.net, there are at least 50 product categories of eyeglasses. A product may be added to different categories but by default, when we add a new product, the default category is assigned to a category by alphabetical order, from a to z.

How to modify this default to our demanded category then? Say, we’d like to set “Cheap Glasses”, which category id is 39, as default category. Do as follows:

In /skin/common_files/main/product_details.tpl

(or if using prescription_glasse_sonline, /skin/reboot/main/product_details.tpl)

Before…

{include file="widgets/categoryselector/categoryselector.tpl" name="categoryid" class="InputWidth" selected_id=$product.categoryid|default:$default_categoryid}

Insert…

{assign var="default_categoryid" value="39"}

39 is the ID of the category you want to be the default.

Published
Categorized as X-Cart