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)
-   -   adding custom sql (https://forum.x-cart.com/showthread.php?t=37231)

mangoboom 02-01-2008 04:46 AM

adding custom sql
 
Hi

i wanted to add a list of my categories in a x cart page (.tpl file), i wanted to pull the categories out of the xcart_categories table, i tried using a PHP/MySQL connect, but that did not work, does anyone if x cart has it's own "special" code to connect to the database or some code to query the database?

thanks

mangoboom 02-20-2008 03:18 AM

Re: adding custom sql
 
Hi

doesnt anyone know how to do this???/

please help!

Yurij 02-20-2008 06:21 AM

Re: adding custom sql
 
You need an example of how to connect to database "X-CART and the list of categories?

Or would you prefer that the "X-CART" is not appealed to the database to select categories?

TelaFirma 02-20-2008 09:33 AM

Re: adding custom sql
 
Quote:

Originally Posted by mangoboom
Hi

i wanted to add a list of my categories in a x cart page (.tpl file), i wanted to pull the categories out of the xcart_categories table, i tried using a PHP/MySQL connect, but that did not work, does anyone if x cart has it's own "special" code to connect to the database or some code to query the database?

thanks


The categories array should be available to you throughout the cart - just loop through that instead of trying to add yet one more array to what is in memory.

mangoboom 02-26-2008 06:32 AM

Re: adding custom sql
 
Hi

how would i list the categories array? and also i need the categories to be link their respective detail page.

thanks for the help.

mangoboom 02-26-2008 06:34 AM

Re: adding custom sql
 
Quote:

Originally Posted by Yurij
You need an example of how to connect to database "X-CART and the list of categories?

Or would you prefer that the "X-CART" is not appealed to the database to select categories?



basically i want to list my categories on a page and have them linked to their respective page, i want to achieve this the most efficient way. i just thought a database connect and select statement would work for me, if there another easier way, then please let me know!

thanks

Yurij 02-27-2008 03:52 AM

Re: adding custom sql
 
Quote:

Originally Posted by mangoboom
basically i want to list my categories on a page and have them linked to their respective page, i want to achieve this the most efficient way. i just thought a database connect and select statement would work for me, if there another easier way, then please let me know!

thanks


A simple way, open file "skin1/customer/categories.tpl"

find line:
{capture name=menu}

and after insert next code (for link to url test.php, test1.php, test2.php):
PHP Code:

<font class="CategoriesList"><a href="test.php" class="VertMenuItems">One more cat</a></font><br />
<
font class="CategoriesList"><a href="test1.php" class="VertMenuItems">One more cat </a></font><br />
<
font class="CategoriesList"><a href="test2.php" class="VertMenuItems">One more cat 2</a></font><br /> 



If you need more additional links (in categories list) add similar.

mangoboom 02-27-2008 04:07 AM

Re: adding custom sql
 
Hi

thanks for your reply. i think you may have misunderstood me, i dont want to add more categories, i want to display my existing categories on another static page, not in my categories page.

please tell me if i have misunderstood you.

can you help me with that?

thanks

TelaFirma 02-27-2008 04:13 AM

Re: adding custom sql
 
skin1/customer/categories.tpl still has the answer to your question. You will see a {section} section that loops through the categories array and displays the name and the link. This will show you exactly how to do it.

mangoboom 02-27-2008 04:26 AM

Re: adding custom sql
 
thanks, i shall have a look at the file and have a go at it.

thanks

mangoboom 02-27-2008 05:56 AM

Re: adding custom sql
 
hi

just to let you know, i looked at categories.tpl and managed to extract the code required.

thanks for your help.


All times are GMT -8. The time now is 10:42 AM.

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