Add category in admin ?

greenspun.com : LUSENET : S-Mart Shopping Cart : One Thread

Has anyone figured out how to have the categories in a database of their own so that the user can add/delete categories from the admin panel. Also has anyone set this up to handle the following.

Upload of picture when item is added?

Add ship to address info and comments to the order form so that it writes to the order database.

Thanks in advance

Mike Cathcart

-- Mike Cathcart (mwcart@midsouth.rr.com), April 09, 2000

Answers

Part 1 of 2

I use a text file. The file is named groupfile.txt and it looks like this: shortname|Long Name| shortname2|Long Name2|

You only need to edit your config file. Here we go.... -------------------------- Near the top of your config file, add the following

$grpurl = 'group.cgi'; $grpfile = 'groupfile.txt';

near the bottom of your config file but before any subs (if you have any), add

&readgroups;

At the bottom of your config file, before 1; line, add the following

################################Read the file#################### sub readgroups { %groups = ' '; open (GRPFILE,"$grpfile") || print "Content-type: text/html\n\n Can't Open $grpfile(r): $!\n"; my(@LINES)=; close(GRPFILE); $SIZE=@LINES; for ($i=0;$i<$SIZE;$i++) { $_=$LINES[$i]; ($shrt, $lng) = split(/\|/,$_); push (@groups, $shrt, $lng); } %groups = @groups; }

That's it. I'll post an editor for it next.

-- Eddie Deboard (eddie@paragould.net), August 03, 2000.


Moderation questions? read the FAQ