Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
add_to_cart
07-23-2012, 08:54 AM,
#1
add_to_cart
I needed to add a couple of fields to salesorderdetails. I modified add_to_cart in SelectOrderItems.php and correspondingly in DefineCartClass.php and all was good with the world. I went to ship the product and ConfirmDispatch_Invoice.php got mad at me because I didn't pass my two new fields, or so I thought. I added the two new fields to add_to_cart in ConfirmDispatch_Invoice.php and it still did not like me, complained about not having parameters for the 29th and 30th spot.

So I discovered after going deeper that SelectOrderItems.php passes the full 28 parameters to add_to_cart in DefineCartClass.php and ConfirmDispatch_Invoice.php all along was passing 24, but did not crash until I added my newbies. I have "fixed" this by passing from ConfirmDispatch_Invoice.php the other 4 missing pieces, before I sent my new 2, by using what looks like default values.

It looks like the definition of add_to_cart in DefineCartClass.php has a php mechanism to supply default values in case they are not passed? Maybe this is a common procedure in php, and I have seen it in prior programming languages, where additional parameters are optional. It just confused me for a bit, so I thought I would post.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)