database and displaying content from db

General ShopSite user discussion

database and displaying content from db

Postby azrac » Fri Jun 08, 2012 12:48 pm

How do I create db tables? I have Shopsite Manager.

This is what I want to do. I need to have designer table and product table. On my pages I would display products( images, price) based on a designer.
Can I do this? Thank you.
azrac
 
Posts: 45
Joined: Wed May 30, 2012 6:50 pm

Re: database and displaying content from db

Postby Jim » Fri Jun 08, 2012 1:40 pm

There is no built in way to create new database tables but you don't need a new table anyway.

You would use one to the extra product fields to contain the Designer info. To display products based on designer you would set a VAR to the designer and do a [-- Loop Products --] and in the product template check the extra field value against the VAR and if they are the same output the product info otherwise the product template doesn't do anything.

something like this:
Page Template
Code: Select all
[-- DEFINE PAGE --]
...
# set the designer in VAR.Designer
[--VAR.Designer designer1 --]

[-- loop products --]
   [-- product --]
[-- End_loop --]
...
#set next designer
[--VAR.Designer designer2 --]

[-- loop products --]
   [-- product --]
[-- End_loop --]
...
#set the VAR for each designer and repeat the loop products section for as many designers as you have.
# You could use a page extra field (or more) to contain the designer for that page or loop through
#the extra page fields to set the VAR.Designer value instead of hard coding the desinger name into the page template.  In that case you would change the [--VAR.Designer designerX--] to [--VAR.Designer page.fieldX --]  You would have to code that section as many times as you have designers for a page but the page template could be used for multiple individual pages. 
...
[-- END_DEFINE PAGE --]


Product template
Code: Select all
[-- DEFINE PRODUCT --]
[-- IF VAR.Designer  Product.fieldx --]
# output the product info
    [-- product.graphic --] <br> [-- product.price --]
[-- ELSE --]
[-- END_IF --]

[-- END_DEFINE PRODUCT --]

Of course you will need to add your divs, tables, styles etc but that is the basics of how it is done
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah


Return to User Forum

Who is online

Users browsing this forum: No registered users and 36 guests