Setting Featured Items In X-Cart
This had me banging my head for ages today. On the design I am implementing there needs to be both a “Best Seller” panel and a “Latest Products”. There is no latest product module as default and I refuse to pay for a third party one when I can just make my own. The problem I ran into was that no matter what I did the internal products array would only ever show four products. This was driving me crazy until I finally took a step back and thought about what was happening. I think the home/welcome page is actually using its own fake category called “Featured Products”. So even though my module was supposed to pull the entire product list it was only actually pulling items from the featured products category.
In the end I decided to ditch my “Latest Products” module and just use the “Featured Products” one instead. That led me to the next problem, how do I change which products are set as featured? Turns out it is well easy. Just head into the admin section and then on the main menu Catalog->Categories. At the bottom of the page you can add and remove products from the featured category. That mostly handles my problem, the final step was to modify the featured_products template file and impose a static limit to the number of items visible. The most we want to show are 4 as more will break the tile wrapping we’re using for displaying them.