webERP Forum
add_to_cart - Printable Version

+- webERP Forum (
+-- Forum: webERP Discussion (
+--- Forum: Development Discussion & Specification (
+--- Thread: add_to_cart (/showthread.php?tid=289)

add_to_cart - Rock*Star - 07-23-2012

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.