adding extra fields

This forum is dedicated to discussions about shopping carts/ecommerce.
Forum rules
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901
Post Reply
uniformality

adding extra fields

Post by uniformality » Tue Nov 13, 2007 9:20 pm

Hi Pablo
looking forward to V5!!. im currentley trying to implement the ecommerce and cart on my site. i require 2 extra fileds 'Size' & 'referance number'

on the product form i added a combo box with 10 sizes, and for the referance number i added a Text area. The customer should choose the product , the size, the quantity and the enter the referance codes in the Text area ( the referance codes are just numbers to be put on the product by us prior to shipment, its just a label really)

i modded the cart page html scrit to
<?php session_start(); define("PRODUCTCODE", 0); define("PRODUCTNAME", 1); define("QUANTITY", 2); define("PRICE", 3); define("size", 4); define("names", 5)if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST['productcode'])) { AddToCart(); } else { $action = isset($_POST['action']) ? $_POST['action'] : ''; $value = strtoupper(substr($action, 0, 5)); switch ($value)


and the Cart contents html to
$strHTML = "<div style=\"overflow:auto; height=358px;\">"."\n";
$strHTML .= "<table border=\"0\" cellpadding=\"3\" cellspacing=\"2\" width=\"100%\">"."\n";
$strHTML .= "<tr>"."\n";
$strHTML .= "<td>Product code</td>"."\n";
$strHTML .= "<td>Product name</td>"."\n";
$strHTML .= "<td>Size</td>"."\n";
$strHTML .= "<td>Quantity</td>"."\n";
$strHTML .= "<td>Price</td>"."\n";
$strHTML .= "<td>Total</td></tr>"."\n";
$strHTML .= "<td>Names</td>"."\n";
$total = 0;
for ($i=0; $i<$itemcount; $i++)
{

can you see any problems with this working? any advice would be greatley appreciated

Regards
Paul

User avatar
Pablo
 
Posts: 15895
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Post by Pablo » Wed Nov 14, 2007 6:53 am

I've haven't tried this , but I think you will have to make the following modications:

1) Add
define("SIZE", 4);
to the cart page

2) Modify AddToCart()
$cart[SIZE][$itemcount] = $_POST['size'];

3) Modify RecalculateCart()
Change
for ($k=0; $k<4; $k++)
to
for ($k=0; $k<5; $k++)

4) Add
$strHTML .= "<td>Size</td>"."\n";
after
$strHTML .= "<td>Product name</td>"."\n";

5) Add
$strHTML .= "<td>".$cart[SIZE][$i]."</td>"."\n";
after
$strHTML .= "<td>".$cart[PRODUCTNAME][$i]."</td>"."\n";

6) On the thankyou page add
define("SIZE", 4);

7) Add
$message .= $cart[SIZE][$i]."\t";
after
$message .= $cart[PRODUCTNAME][$i]."\t";

uniformality

Post by uniformality » Thu Nov 15, 2007 1:52 pm

Hi Pablo

Thanks for the information.

i get this error when i complete the Customer page

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/spirmco/public_html/uniformality/checkout.php:1) in /home/spirmco/public_html/uniformality/checkout.php on line 2

and this when i place the order

Warning: Cannot modify header information - headers already sent by (output started at /home/spirmco/public_html/uniformality/checkout.php:1) in /home/spirmco/public_html/uniformality/checkout.php on line 23

Any help will be greatley appreciated

Regards

paul

User avatar
Pablo
 
Posts: 15895
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Post by Pablo » Thu Nov 15, 2007 4:09 pm

This probably means you have added the code to the wrong place.
Please check line 2 and line 23 and verify you've added the correct code.
Unfortunately I can't teach you how to program in PHP, so some basic knowlegde of PHP is required if you want to implement these kind of advanced features.

Post Reply