Forum Moderators: coopster

Message Too Old, No Replies

Newbie help - last bit of code before we go live

PHP error

         

Debugdesign

3:36 pm on Sep 12, 2005 (gmt 0)

10+ Year Member



Hello,

I was wondering if anyone could help, I am using WA ecart to create a store and everything was ready to go live when i forgot to add postage. I went into the ecart object and one change created chaos. I have tried removing it but the problem is still there.

My error is this:
Warning: Missing argument 9 for addtocart() in /home/sites/example.co.uk/public_html/WA_eCart/HCT_eCart_PHP.php on line 28

Im sure i'm just missing a bracket or something but i can't see it.

Any help would be greatly appreciated

ian

[edited by: coopster at 4:36 pm (utc) on Sep. 12, 2005]
[edit reason] removed url and irrelevant code [/edit]

coopster

4:40 pm on Sep 12, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Hi Debugdesign, the code you dumped had no reference to the addtocart() function, nor the function itself. The problem area can be quickly identified by reading the error message that PHP offered you ...

Warning: Missing argument 9 for addtocart() in /home/sites/example.co.uk/public_html/WA_eCart/HCT_eCart_PHP.php on line 28

The script that you are running is trying to run this "addtocart" function with a missing argument, or parameter. Find the place in the active script you are processing where you are running this function and count the number of parameters being passed. Are you missing one?

Debugdesign

6:28 pm on Sep 12, 2005 (gmt 0)

10+ Year Member



My functions are:

//start node
function AddToCart($AddIfIn, $RedirectIfIn, $itemID, $itemName, $itemDescription, $itemWeight, $itemQuantity, $itemPrice, $itemColour) {
$inCartID = $this->ItemIndex($itemID, $itemName, $itemDescription, $itemWeight, $itemQuantity, $itemPrice, $itemColour);
if ($inCartID >= 0) {
if ($AddIfIn == 0) {
$this->Items[$inCartID]->Quantity = floatval($this->Items[$inCartID]->Quantity) + floatval($itemQuantity);
if ($this->Items[$inCartID]->Quantity < 0) {
$this->Items[$inCartID]->Quantity = 0;
}
if ($this->Items[$inCartID]->Quantity == 0) {
$this->DeleteFromCart($inCartID, true);
}
$this->Items[$inCartID] = $this->ResetCalculations($this->Items[$inCartID]);
}
if ($AddIfIn == 2) {
$this->Items[$ATC_x] = new HCT_eCart_ItemDefinition($itemID, $itemName, $itemDescription, $itemWeight, $itemQuantity, $itemPrice, $itemColour);
}
if ($AddIfIn == 4) {
$this->DeleteFromCart($inCartID, true);
$this->Items[] = new HCT_eCart_ItemDefinition($itemID, $itemName, $itemDescription, $itemWeight, $itemQuantity, $itemPrice, $itemColour);
}
if ($RedirectIfIn!= "") {
$this->redirStr = $RedirectIfIn;
}
}
else {
$this->Items[] = new HCT_eCart_ItemDefinition($itemID, $itemName, $itemDescription, $itemWeight, $itemQuantity, $itemPrice, $itemColour);
}
$this->ResetAll();
$this->SaveCart();
}
//end node

they seeem to be all there, aren't they?

I thought it might be a space or something. Can you see any problems

cheers

ian

grandpa

6:52 pm on Sep 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The problem doesn't appear to be with the function, but with the arguments you are passing when you call the function. Seems that one arg is missing.

Check your code where you call the function and make sure you're passing something for each of these values:
$AddIfIn, $RedirectIfIn, $itemID, $itemName, $itemDescription, $itemWeight, $itemQuantity, $itemPrice, $itemColour

Just a thought... since you added the postage, are you now passing a value for postage when you call the function? Maybe it's a matter of passing one arg too many, and it isn't defined in the function.

henry0

7:36 pm on Sep 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Echo those values and figure if any value is missing