X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Variants on the Productlist (https://forum.x-cart.com/showthread.php?t=36132)

Jonjolt1 12-13-2007 06:37 AM

Variants on the Productlist
 
1 Attachment(s)
I think some people will appreciate this, cost me around $260 but I thought I'd share it. :mrgreen:

Don't use the Patch file, follow the install instructions and review the report .html file. :wink:

Jonjolt1 12-14-2007 05:45 AM

Re: Variants on the Productlist
 
Anyone got it working yet?

freelancer_gd 12-15-2007 11:26 AM

Re: Variants on the Productlist
 
any examples ?

Jonjolt1 12-15-2007 03:24 PM

Re: Variants on the Productlist
 
http://pleasantsmoke.com/home.php?cat=266

typologist 12-26-2007 05:46 PM

Re: Variants on the Productlist
 
Does it do what I think? Does it show the variants and allows to add to cart FROM the CATEGORY PAGE? If this is the case, i will give u a kiss! ;)

typologist 12-26-2007 06:27 PM

Re: Variants on the Productlist
 
Wow!! I installed and its awesome!

Notes: In order for this to work, you must have these options in admin:

- Display products list in multiple columns (1-3) 0
- Enable "Buy Now" button in the products list: Checked

Observations:
It makes your category pages load way slower (obvious!).

Wishlist:
1. I would love to have drop down menus with variants, instead of radio buttons, since they make the customer scroll a lot if you have many of them.
2. I would like to assign a special category, like "Buy fast" and list all products there, and use this mod only in that category.
3. It would be great that it would work if you have 3 or 2 columns format in your categories pages.

THANKS FOR SHARING! I owe u a kiss, lol.

Jonjolt1 12-28-2007 05:49 AM

Re: Variants on the Productlist
 
About loading slower, for some reason it was working fast with me then it slowed down. I think it might have to do with the template cache maybe. There is room for optimization but I havn't gotten to that stage so far.

Also the original design had a dropdown list but I had them change it to radio buttons. It code be reverted back with a few template changes.

Freakmode 01-17-2008 07:28 AM

Re: Variants on the Productlist
 
Has anyone got an example of this working I could see?

Also anyone got any further getting it to work on a 2 column product layout (that would be fantastic)

2coolbaby 02-05-2008 02:34 PM

Re: Variants on the Productlist
 
Question. The patch.diff shows this:

Quote:

Index: modules/Product_Options/customer_options.php
================================================== =================
diff -u modules/Product_Options/customer_options.php
--- modules/Product_Options/customer_options.php
+++ modules/Product_Options/customer_options.php
@@ -65,6 +65,7 @@ if (!empty($product_options) && !empty($

}

+if (!$dont_assign) {
if (!empty($product_options))
$smarty->assign("product_options",$product_options);

My customer_options.php file looks like this:

Quote:

if (!empty($product_options) && !empty($options) && is_array($options)) {


# Defined preselected options
foreach ($product_options as $k => $v) {
if (preg_match("/^\d+$/S", $options[$v['classid']])) {
if ($v['is_modifier'] == 'T') {
$product_options[$k]['default'] = $options[$v['classid']];
} else {
$product_options[$k]['options'][$options[$v['classid']]]['selected'] = 'Y';
}
} else {
$product_options[$k]['default'] = $options[$v['classid']];
}
}

}
Would I put the code after this line?:
Quote:

if (!empty($product_options) && !empty($options) && is_array($options)) {

intel352 02-06-2008 09:58 AM

Re: Variants on the Productlist
 
@2coolbaby: is that your entire file?


@Jonjolt1: the speed is likely due to the queries involved. X-Cart has to run at *least* 1 additional query per product for the product options, but likely more than 1 additional. So I'd bet you're essentially doubling/tripling your queries on your category page.

intel352 02-06-2008 10:09 AM

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.

2coolbaby 02-06-2008 10:42 AM

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.

intel352 02-06-2008 11:02 AM

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.

2coolbaby 02-06-2008 11:39 AM

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.

intel352 02-06-2008 01:03 PM

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 :-)

Jonjolt1 02-07-2008 06:05 AM

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.

Chrisb 02-11-2008 03:43 PM

Re: Variants on the Productlist
 
Has anyone figured out how to do this with drop down menus?

Chrisb 02-11-2008 04:00 PM

Re: Variants on the Productlist
 
Heh looks like I figured it out :) thanks to the code provided here.

RobinBraves 02-12-2008 08:43 AM

Re: Variants on the Productlist
 
Hey Chris... where on your site can I see an example of this?

toolexperts 02-12-2008 09:11 AM

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

Chrisb 02-12-2008 06:34 PM

Re: Variants on the Productlist
 
Go to http://www.easycoffee.com.au/home.php?cat=249
I am still testing it so it is a bit messy. I also want to have the products under the sub categories.
Sub category 1
Product 1
Product 2

Sub category 2
Product 1
Product 2
Product 3

RobinBraves 02-12-2008 06:41 PM

Re: Variants on the Productlist
 
Oh okay... very nice! I think I will install this and play with it to get it to do what I need.

Question, though, does anyone know what I can do so that it only applies to certain categories?

I'm sure I can do an "if" statement, but how would I do that? If you can provide an example of this statement, I'm sure I could translate it for what I need. Thanks so much.

Chrisb 02-12-2008 06:48 PM

Re: Variants on the Productlist
 
How did you get you web page to display with the products under the subcategories?

http://sentimentalist.net

RobinBraves 02-12-2008 06:53 PM

Re: Variants on the Productlist
 
Oh, where did you see that URL? That is one of my client's sites. I must have put it somewhere when I needed help with it.

Here is the forum for my subcategories:
http://forum.x-cart.com/showthread.php?t=19730

Chrisb 02-12-2008 07:00 PM

Re: Variants on the Productlist
 
I got that URL from the same forum that you refered me to the only problem is that it seems to change the whole product layout. Is there a way to do this without changing the individual products layout?
Cheers,

RobinBraves 02-12-2008 07:17 PM

Re: Variants on the Productlist
 
You might want to post that question on that forum.

I did a lot of manipulating to the code so I'm really not sure.

Jonjolt1 02-13-2008 05:52 AM

Re: Variants on the Productlist
 
I just reapplied the Variants Mod to my site when I upgraded from 4.1.3 to 4.1.9, worked fine no problems for me, you just need to follow the directions in the html file provided and not use the auto patch.

Jonjolt1 02-13-2008 06:03 AM

Re: Variants on the Productlist
 
My best guess is you did not upload that file. In the report_1073744846.htm file the files with [+] next to the file name indicates its a new file that has been provided.
Quote:

Originally Posted by toolexperts
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


toolexperts 02-13-2008 07:06 AM

Re: Variants on the Productlist
 
yeah i wiped out that line of code this A.M...seems to have resolved the conflict

brennan1313 11-25-2009 08:37 AM

Re: Variants on the Productlist
 
Any try/modify this for 4.3?

diviterra 11-25-2009 03:57 PM

Re: Variants on the Productlist
 
or 4.2.3?

Libsasy 02-18-2012 06:52 PM

Re: Variants on the Productlist
 
Hi - totally new here, just getting the hang of xcart and all it's settings. Brushing off my php skills too.

I am interested in displaying all the product options on the category page, and have downloaded the patch above. Have no idea what to do with it however.

There is a mod available for purchase (something like $250), but I'd prefer to just do it myself.

My site is small - I'm using xcart as a registration system with products as 'events' with various options for meals, etc. I have only 6 'events', so showing all their options shouldn't slow my page down too much.

Can anyone help me? I realize this thread is 5 years old... hopefully it's still applicable.

Thanks!

seb403 03-26-2012 07:32 AM

Re: Variants on the Productlist
 
I would be interested to see how this works as well. My client is in need.


All times are GMT -8. The time now is 09:45 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.