Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Variants on the Productlist

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 02-06-2008, 10:09 AM
 
intel352 intel352 is offline
 

X-Wizard
  
Join Date: Dec 2005
Posts: 1,071
 

Default Re: Variants on the Productlist

I just looked at the code, and wow, their implementation method is horrible. What they did was build a loop that runs through each product listed on the page. Then for each product, they include the Product Options and Wholesale modules.

The method of including per product is fine, when it's only 1 product. The way they've implemented means that they are running possibly 5+ additional queries per product. While this allows you to upgrade easily in the future (because they didn't make major changes to how Product Options works by default), this is one of the worse methods that you could implement regarding performance

Typically, you would build such a modification so that you grab *all* product options for *all* products, in one query. so, instead of 75+ new queries (assuming 15 products per page), you would have a max of 1-3 new queries per page (1-3 because there might be an extra query or 2 to grab additional info for all those products)

@Jonjolt: I still appreciate you posting this code, as this could be used as the basis for a better implementation, just wanted to make others aware of the performance cost and server strain this could cause.
__________________
-Jon Langevin
WARNING: Unethical developer - NOT RECOMMENDED
See details here
Reply With Quote
  #12  
Old 02-06-2008, 10:42 AM
  2coolbaby's Avatar 
2coolbaby 2coolbaby is offline
 

eXpert
  
Join Date: Sep 2004
Location: TN moving to FL
Posts: 265
 

Default Re: Variants on the Productlist

No Jon, but it is the only line that contains the line you indicated:

if (!empty($product_options) && !empty($

There is no other line even close to the above line your reference.
__________________
Mary Lee
-------------------
Dinner and a Murder Mystery Games
http://www.dinnerandamurder.com

x-cart version 4.7.5 / Mac OS 10.10.5 and Windows 8/10 sometimes - Ideal Responsive Template
Reply With Quote
  #13  
Old 02-06-2008, 11:02 AM
 
intel352 intel352 is offline
 

X-Wizard
  
Join Date: Dec 2005
Posts: 1,071
 

Default Re: Variants on the Productlist

@2coolbaby: I didn't write this code, just FYI, I'm just a commenter


looks like the line you need to find is this:
Code:
if (!empty($product_options)) $smarty->assign("product_options",$product_options);

and add this before it:
Code:
if (!$dont_assign) {

don't forget the rest of the changes. i think the patch file itself had an improper paste in it, fyi.
__________________
-Jon Langevin
WARNING: Unethical developer - NOT RECOMMENDED
See details here
Reply With Quote
  #14  
Old 02-06-2008, 11:39 AM
  2coolbaby's Avatar 
2coolbaby 2coolbaby is offline
 

eXpert
  
Join Date: Sep 2004
Location: TN moving to FL
Posts: 265
 

Default Re: Variants on the Productlist

I now notice that your user ID's are different. Jon was your real name and the user ID of the one that posted it. I was confused. Sorry about that. Thanks for the help. The moment I made the customer_options changes, my products with variants went blank. I reverted back, as it seems like that may be way to easy to mess up your cart. I could spend all day installing it, only to find one piece of code that meses up my cart. I have the Altered Cart mod Download Expander, which gives me downloads for variants and I am afraid that might interfere.
__________________
Mary Lee
-------------------
Dinner and a Murder Mystery Games
http://www.dinnerandamurder.com

x-cart version 4.7.5 / Mac OS 10.10.5 and Windows 8/10 sometimes - Ideal Responsive Template
Reply With Quote
  #15  
Old 02-06-2008, 01:03 PM
 
intel352 intel352 is offline
 

X-Wizard
  
Join Date: Dec 2005
Posts: 1,071
 

Default Re: Variants on the Productlist

sounds like you might not have patched in the changes properly, as a blank page usually suggests an error in your TPL file. you could check your error logs to see what the error was, but it's not always a helpful message if you aren't used to coding
__________________
-Jon Langevin
WARNING: Unethical developer - NOT RECOMMENDED
See details here
Reply With Quote
  #16  
Old 02-07-2008, 06:05 AM
 
Jonjolt1 Jonjolt1 is offline
 

Advanced Member
  
Join Date: Nov 2006
Posts: 49
 

Default Re: Variants on the Productlist

I'm aware of the performance issues. I havn't had the time to modify the code myself

@intel352: That was excactly what I was going to do modification wise to the code to speed it up.
__________________
4.1.9
Reply With Quote
  #17  
Old 02-11-2008, 03:43 PM
 
Chrisb Chrisb is offline
 

Member
  
Join Date: Jan 2008
Posts: 25
 

Unhappy Re: Variants on the Productlist

Has anyone figured out how to do this with drop down menus?
__________________
www.easycoffee.com.au
Version 4.1.9
Reply With Quote
  #18  
Old 02-11-2008, 04:00 PM
 
Chrisb Chrisb is offline
 

Member
  
Join Date: Jan 2008
Posts: 25
 

Default Re: Variants on the Productlist

Heh looks like I figured it out thanks to the code provided here.
__________________
www.easycoffee.com.au
Version 4.1.9
Reply With Quote
  #19  
Old 02-12-2008, 08:43 AM
 
RobinBraves RobinBraves is offline
 

Advanced Member
  
Join Date: Oct 2005
Location: FL
Posts: 98
 

Default Re: Variants on the Productlist

Hey Chris... where on your site can I see an example of this?
__________________
Version 4.1.11
Reply With Quote
  #20  
Old 02-12-2008, 09:11 AM
 
toolexperts toolexperts is offline
 

eXpert
  
Join Date: Feb 2008
Location: Knoxville, TN
Posts: 289
 

Default Re: Variants on the Productlist

i tried installing but it needs better directions after installing i get this on my pages

: Smarty error: unable to read resource: "modules/Product_Options/check_options_global.tpl" in /home/httpd/vhosts/toolexperts.com/httpdocs/Smarty-2.6.12/Smarty.class.php on line 1095
__________________
Tool Experts
X-Cart DB Version: 4.1.12 GOLD
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:47 PM.

   

 
X-Cart forums © 2001-2020