not_steve Posted March 11, 2004 Share Posted March 11, 2004 (edited) I'm working on a contribution to allow set prices for groups of products, e.g. 500 forms: $100 1000 forms: $150 2000 forms $175 To my knowledge, nothing does this. (Master Products doesn't work with attributes for slaves, so that's not a good approach. Also, Master Products is just no appropriate, because it's the same product; and too much data entry! But Master Products is a great contribution.) I'm basing it on a hack of Price Break -- pretty far along, but am now stuck. I'm an experienced C++ and JAVA programmer, but am brand new to PHP. Questions about Price Break: 1) How does the PriceFormatter object get instantiated, and what is it's object persistence? (Is there just one object that keeps getting re-used, or is one created every time product_info or shopping_cart is executed?) 2) What is the purpose of the "loadProduct" function (in PriceFormatter)? I mean...I can see what it does, but I don't understand it's use in context. 3) Why is the this pointer required in the class functions, and why aren't the values stored in class variables? 4) Most importantly, why are not the the price and quantity arrays class member variables? They are initialized in the (what appears to be) the constructor: for ($i=1; $i<=9; $i++){ $this->quantity[$i] = -1; $this->prices[$i] = -1; } But these are not class variables. How can the class pointer refer to a class variable that doesn't exist? If doing this creates it on the spot, then why create it as a class variable? Why use an object reference? What is it's scope? Why not make them real class variables? I'm very confused. Thanks for any help. Sorry for my ignorance. Hopefully people will find this contribution useful. Bill Evans Edited March 11, 2004 by not_steve Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.