View Single Post
  #9  
Old 08-12-2006, 06:20 PM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default

Quote:
Originally Posted by geckoday
there is a change that will probably make the product pages slower if you use product options. They added a call to func_get_default_options in customer_options.php. Its inside an if but the variable tested looks like its never set so it will always make the call and tests on 4.0.18 confirm its not set. func_get_default options does a lot of processing including several queries. I imagine it will slow things down some.

Wow, Ralph -- that is some find there!

I just happen to be moving to a new server, and I am benchmarking all kinds of things -- true apples for apples testing... and I am testing virgin installs now -- I have put my store on the shelf until I sort some core stuff out...

Commenting out the "upgraded" 4.0.19 code in /modules/Product_Options/customer_options.php makes a HUGE difference in page load times for pages with options or variants. HUGE. Dramatic difference. Wow.

This is how the code looks in 4.0.18:
Code:
$product_options = func_get_product_classes($productid);

This is what it looks like in 4.0.19:
Code:
$product_options = func_get_product_classes($productid); if (empty($options)) { $min_amount = $product_info['min_amount'] ? $product_info['min_amount'] : 1; $options = func_get_default_options($productid, $min_amount, $user_account['membership']); }

So, to the PHP experts: what exactly is this function doing?
Code:
if (empty($options)) { $min_amount = $product_info['min_amount'] ? $product_info['min_amount'] : 1; $options = func_get_default_options($productid, $min_amount, $user_account['membership']); }

Is it looking for a situation where there is no option selected, and then setting a default option? I went through the changelog for .19 and there are a few references to "product options" -- but I think this code is the long way around to solve a very special problem... please correct me if I'm wrong...
Quote:
Wed Mar 15 11:38:28 MSK 2006 [!] - max - Bug: If all the products in the store that belonged to a certain product class did not have product class option values, and some of these products were added to a comparison chart, displaying the Product features chart page caused a PHP error when these products were deleted from the chart. Fixed.
Seems like for my store, where all but a few items have product options, and all of the options are single color variants as pull-down menus, this code is just a drag for me -- Ralph, does this sound right to you? Other PHP experts?

I wonder how many sub-routines there are that are the long way around, simply to solve a rare problem, but for 99% of the users, there is no need to do this... and B-L-O-A-T starts creeping in... and the codebase needs a rewrite -- oh, they did this in 4.1

Man, how I wish 4.1 was ready for prime time. I am using too many cool mods though... so 4.0.x is going to be it for the time being...

I have commented out this code from .19 -- if someone can think of a reason why I might want to keep it live, PLEASE, PLEASE speak up.

Thanks Ralph!!!!

Jeremy
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote