additional fields for an item, plus some more questions

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

i need some help. i need a way to add some additional fields to the database (like name, price etc) that actually shows up in the listing. i tried to add a delim in both the .db and the .cgi but it didn't work. i guess i messed the code, i don't know about coding html in cgi - it looks a bit different.

also, does someone know about a way to calculate how much entries are in the .db so that i can jump to different pages - just like yahoo, hotbot, download.com whatever - the footer says something like: you're on page 3 - 1 2 [3] 4 5 6 - while the other numbers are links. that would be a great features for version 2, just like the other good mods (delete button for cart-entries, 'cart is empty' etc.)

btw. i just installed the script for testing and everything works fine, i'd love to share some knowledge thanks in advance, andy

-- andy (ndee341@hotmail.com), February 22, 2000

Answers

Hi Andy, For extra fields, you need to add to the line where the fields are defined which looks something like this: ($ITEM{'itemid'}, $ITEM{'name'}, $ITEM{'retail'}, $ITEM{'price'}, $ITEM{'descrip'}, $ITEM{'image'}, $ITEM{'weight'}, $ITEM{'itemurl'},

This tells the scripts how the fields relate to the layout of the database. I you compare this version with the standard arrangement, you will see that i have added the retail field. Make sure that you apdate all the occurances, I think there are 3, but do a scan through and you will quickly find them.

You will then need to modify the table where the information is displayed. This is under the line: # Print other info and I have added an extra field like this: #Retail price print "\# $ITEM{'retail'}\n";

It's quite simple really, but you have to be careful with what you're changing and think about what you are trying to display.

Hope that helps.

all the best

Rufus

-- Rufus Biggs (rufus.biggs@m-audio.co.uk), June 06, 2000.


Moderation questions? read the FAQ