Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

adding custom sql

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 02-01-2008, 04:46 AM
 
mangoboom mangoboom is offline
 

Advanced Member
  
Join Date: Apr 2004
Posts: 97
 

Default 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
__________________
Using x cart 4.0.19
Reply With Quote
  #2  
Old 02-20-2008, 03:18 AM
 
mangoboom mangoboom is offline
 

Advanced Member
  
Join Date: Apr 2004
Posts: 97
 

Default Re: adding custom sql

Hi

doesnt anyone know how to do this???/

please help!
__________________
Using x cart 4.0.19
Reply With Quote
  #3  
Old 02-20-2008, 06:21 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default 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?
Reply With Quote
  #4  
Old 02-20-2008, 09:33 AM
  TelaFirma's Avatar 
TelaFirma TelaFirma is offline
 

X-Adept
  
Join Date: Nov 2002
Location: North Carolina USA
Posts: 930
 

Default 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.
Reply With Quote
  #5  
Old 02-26-2008, 06:32 AM
 
mangoboom mangoboom is offline
 

Advanced Member
  
Join Date: Apr 2004
Posts: 97
 

Default 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.
__________________
Using x cart 4.0.19
Reply With Quote
  #6  
Old 02-26-2008, 06:34 AM
 
mangoboom mangoboom is offline
 

Advanced Member
  
Join Date: Apr 2004
Posts: 97
 

Default 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
__________________
Using x cart 4.0.19
Reply With Quote
  #7  
Old 02-27-2008, 03:52 AM
  Yurij's Avatar 
Yurij Yurij is offline
Banned
 

X-Adept
  
Join Date: Jan 2008
Posts: 486
 

Default 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.
Reply With Quote
  #8  
Old 02-27-2008, 04:07 AM
 
mangoboom mangoboom is offline
 

Advanced Member
  
Join Date: Apr 2004
Posts: 97
 

Default 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
__________________
Using x cart 4.0.19
Reply With Quote
  #9  
Old 02-27-2008, 04:13 AM
  TelaFirma's Avatar 
TelaFirma TelaFirma is offline
 

X-Adept
  
Join Date: Nov 2002
Location: North Carolina USA
Posts: 930
 

Default 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.
Reply With Quote
  #10  
Old 02-27-2008, 04:26 AM
 
mangoboom mangoboom is offline
 

Advanced Member
  
Join Date: Apr 2004
Posts: 97
 

Default Re: adding custom sql

thanks, i shall have a look at the file and have a go at it.

thanks
__________________
Using x cart 4.0.19
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:30 PM.

   

 
X-Cart forums © 2001-2020