X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Anyone have a tpl for all products by category on one page? (https://forum.x-cart.com/showthread.php?t=51884)

Primordial Performance 01-20-2010 12:42 PM

Anyone have a tpl for all products by category on one page?
 
I've almost finished building this myself quick n dirty using {php}, but there must be an easier way. Basically I want a product page that looks like this:
CATEGORY NAME 1
A product another product yet another

CATEGORY NAME 2
fourth product fifth product
etc., with thumbnail and buy now button for each product. It seems like it should be easy to make this from an existing page - I'm afraid that my PHP approach is too much reinventing the wheel, and that a pure smarty solution would be more efficient.

cflsystems 01-20-2010 05:43 PM

Re: Anyone have a tpl for all products by category on one page?
 
I don't think that this exist in xcart by default. You need a php script to query the db for each category and products in it and assign these array values to smarty to use in a template. Using {php} inside template may do the job but it is no good with the amount of data you are trying to get and show

Primordial Performance 01-21-2010 07:19 AM

Re: Anyone have a tpl for all products by category on one page?
 
Quote:

Originally Posted by cflsystems
I don't think that this exist in xcart by default. You need a php script to query the db for each category and products in it and assign these array values to smarty to use in a template. Using {php} inside template may do the job but it is no good with the amount of data you are trying to get and show

Thanks...I guess I'll just clean up my {php} and move it to a proper php file in the root directory and use smarty properly for display.

Is anyone aware of a reason to avoid using {php} in .tpls OTHER THAN separation of logic and display? Just trying to understand xcart better and keep code as efficient as possible.

Also - if anyone else is looking for the same functionality, let me know and I'll share the technique once it's all clean.

gizmo 01-21-2010 12:33 PM

Re: Anyone have a tpl for all products by category on one page?
 
Wouldn't a good site map generate what you want?

Just thought this may be one way? yep it would have all the other stuff but you could strip it down

presson83 02-09-2010 08:35 AM

Re: Anyone have a tpl for all products by category on one page?
 
Quote:

Originally Posted by Primordial Performance
Thanks...I guess I'll just clean up my {php} and move it to a proper php file in the root directory and use smarty properly for display.

Is anyone aware of a reason to avoid using {php} in .tpls OTHER THAN separation of logic and display? Just trying to understand xcart better and keep code as efficient as possible.

Also - if anyone else is looking for the same functionality, let me know and I'll share the technique once it's all clean.


I'm very interested in this functionality - how's it coming along?

presson83 02-09-2010 11:36 AM

Re: Anyone have a tpl for all products by category on one page?
 
Found this post and it has a pretty good example of how to do this:
http://forum.x-cart.com/showthread.php?t=19730&highlight=all+products+by+c ategory+on+one+page


All times are GMT -8. The time now is 10:45 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.