How to ad more collums

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

How can I put more colums in my card. This is what I have now: Itemname, Itemprice, Quantity This is what I would lik to have: ItemID, Itemname, Itemprice, Itemcolor, Itemsize, Itembox

Thanks for your help

Andre. S dre@epl.nl

-- Andre (dre@epl.nl), January 22, 1999

Answers

Hi, It's not an easy job... but very possible. You should be pretty comfortable in perl though.

what you need to do is edit both the admin and s-mart script extensively. ------------------------------ For the admin Script ------------------------------ Every place you see the list:

my($itemid, $name, $price, $descrip, $image, $weight, $itemurl, $group) = split(/\|/,$_);

or:

print db join "\|", $itemid, $FORM{'name'}, $FORM{'price'}, $FORM {'descrip'}, $FORM{'image'}, $FORM{'weight'}, $FORM{'itemurl'}, $FORM {'group'}, "\|\n";

or:

my(%ITEM); ($ITEM{'itemid'}, $ITEM{'name'}, $ITEM{'price'}, $ITEM {'descrip'}, $ITEM{'image'}, $ITEM{'weight'}, $ITEM{'itemurl'}, $ITEM {'group'}) = split(/\|/,$LINES[$i]);

you need to add your new fields to the end in the same format as the others. (be very careful with syntax!)

then, you need to enter the input fields into the html generated forms. once again, copy the other fields that are already there.

Also, if you want them displayed when you do a search or 'list all' command, you need to enter in the display functions.

ex: print "New Field Name:$newfield\n";

--------------------------------------- For the Store script ---------------------------------------

every time you see these:

($itemid, $name, $price, $descrip, $image, $weight, $itemurl, $group) = split(/\|/,$_);

Or:

print REFFILE join "\|", $itemname,$itemprice,$FORM{$itemq},$weight, $itemid,$group,"\|\n";

You need to add your new fields at the end in the same format as the others.

you also need to edit all the generated html pages to show the new info. (show items, review items, buy1 items, buy2 items, etc...)

-----------------------------------------

Sorry, this is probably very vague and confusing but without writing a complete perl manual It's the only way i seem to be able to explain it. I hope it helps...

Marc Burnell

-- Marc Burnell (mburnell@efxweb.com), February 21, 1999.


Moderation questions? read the FAQ