X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing and adding new features (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   [PATCH] Properly reorder Product_Options variants (https://forum.x-cart.com/showthread.php?t=38684)

intel352 03-29-2008 07:04 AM

[PATCH] Properly reorder Product_Options variants
 
1 Attachment(s)
Product Options have the ability to be ordered, but this ordering isn't passed on to Variants. This is a failing in Qualiteam code logic, as Variants are an extension of Product Options, and thus should carry the same ordering value as it's related Option.

I've fixed this problem, attached is a diff which should apply on 4.1.8/4.1.9. I believe a better fix would be to rewrite the query used that establishes the first variants array (I would personally use INNER JOIN between xcart_variants, xcart_variant_items, and xcart_class_options, and then use the xcart_class_options.orderby value to order), but I didn't want to affect the pricing and whatnot that is being pulled into the original $variants array.

Result is that instead of Variants being ordered by name, they'll be ordered by the Order By value of each variant's related Option.

This affects modules/Product_Options/func.php, diff is attached in zip file

To apply the diff (aka patch), you must use the Patch/Upgrade mechanism in X-Cart administration.

Cheers

carpeperdiem 03-29-2008 07:13 AM

Re: [PATCH] Properly reorder Product_Options variants
 
Jon,

This patch does not make sense to me, as my variants are in the POS order as defined in product options.

They are NOT alphabetical.

POS determines ordering for me.

Are you certain that a stock cart needs this? I am not so sure...

intel352 03-29-2008 07:23 AM

Re: [PATCH] Properly reorder Product_Options variants
 
Thanks for posting Jeremy, after investigation, you're correct. A stock cart does not need this for the frontend, this patch will only help a stock cart in the backend (if you're particular about how your variants are ordered in the variant administration page.

The cart I was working on has a customized frontend, and to verify this was an x-cart issue, I checked administration, the variants there were ordered similarly to the ones in the frontend, but now I remember stock X-Cart orders variants in the frontend based on the order of the options.

Ah well.

BTW, I misspoke in my first post, default variant ordering is by order added to the database, not alphabetical (and not using POS), even in X-Cart variant administration.

Cheers

carpeperdiem 03-29-2008 07:30 AM

Re: [PATCH] Properly reorder Product_Options variants
 
Quote:

default variant ordering is by order added to the database, not alphabetical (and not using POS), even in X-Cart variant administration

That makes sense, Jon. For my store, we were very organized on the way in, and used a spreadsheet and csv import to propagate products -- so our admin section looks quite organized and in perfect order. But in my test store, it's a freaking mess! So I am able to test both ways.

I always suggest a csv import, for products anyway!

carlisleglass 04-01-2008 03:59 AM

Re: [PATCH] Properly reorder Product_Options variants
 
I was trying to find a way of displaying the variants in the right order for the customer, but this is even better !!!

Thank You !

intel352 04-01-2008 04:42 AM

Re: [PATCH] Properly reorder Product_Options variants
 
Glad it helped you Darren. I'm going to either have to add this into the Variant Charts module install, or change the core coding. I'd rather just add this patch in :-)

Cheers

benz 09-14-2008 02:13 AM

Re: [PATCH] Properly reorder Product_Options variants
 
Thanks, I was just starting to wade through the SQL when a last minute search found this thread...brilliant :-)

UHS 01-09-2011 06:30 PM

Re: [PATCH] Properly reorder Product_Options variants
 
I found this old thread and was wondering if anyone had anything to add to it? My situation is as follows. If I decide to remove a variant in the product admin, It changes the order by of the remaining variants for that product and I have to re-order all of the variants for that product. Does this mod help with that? This particular cart is 4.1.10

-Jonathon

alarnold 06-16-2014 11:01 AM

Re: [PATCH] Properly reorder Product_Options variants
 
Still working for 4.6.X. Don't understand why this is not built into X-cart to begin with!

alarnold 08-10-2020 07:56 PM

Re: [PATCH] Properly reorder Product_Options variants
 
The Product Options variables are displayed in the order they were added. The Option Value "OrderBy" is ignored when Option Value displayed. This patch can not be applied, but does have the needed information to correct this on-going issue. Version 7.4.12 changed the way the variables are accessed, but the code can be replaced with the patched code. (starts around line 767)


All times are GMT -8. The time now is 11:44 PM.

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