Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New Contribution Based on Price Break - Questions


not_steve

Recommended Posts

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 by not_steve
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...