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

[PATCH] Properly reorder Product_Options variants

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 03-29-2008, 07:04 AM
 
intel352 intel352 is offline
 

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

Default [PATCH] Properly reorder Product_Options variants

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
Attached Files
File Type: zip properly_reorder_variants_4.1.x_Product_Options.zip (901 Bytes, 1290 views)
__________________
-Jon Langevin
WARNING: Unethical developer - NOT RECOMMENDED
See details here
Reply With Quote
  #2  
Old 03-29-2008, 07:13 AM
 
carpeperdiem carpeperdiem is offline
 

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

Default 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...
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #3  
Old 03-29-2008, 07:23 AM
 
intel352 intel352 is offline
 

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

Default 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
__________________
-Jon Langevin
WARNING: Unethical developer - NOT RECOMMENDED
See details here
Reply With Quote
  #4  
Old 03-29-2008, 07:30 AM
 
carpeperdiem carpeperdiem is offline
 

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

Default 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!
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #5  
Old 04-01-2008, 03:59 AM
  carlisleglass's Avatar 
carlisleglass carlisleglass is offline
 

eXpert
  
Join Date: Aug 2003
Location: Carlisle, UK
Posts: 316
 

Default 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 !
__________________
Darren Kierman
Carlisle Glass (http://www.carlisleglass.co.uk/)
... running X-Cart Gold 4.4.5 [unix]
Reply With Quote
  #6  
Old 04-01-2008, 04:42 AM
 
intel352 intel352 is offline
 

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

Default 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
__________________
-Jon Langevin
WARNING: Unethical developer - NOT RECOMMENDED
See details here
Reply With Quote
  #7  
Old 09-14-2008, 02:13 AM
 
benz benz is offline
 

Senior Member
  
Join Date: Oct 2007
Posts: 111
 

Default 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
__________________
Version 4.1.8
Version 4.1.11
Reply With Quote
  #8  
Old 01-09-2011, 06:30 PM
 
UHS UHS is offline
 

Advanced Member
  
Join Date: Nov 2010
Posts: 32
 

Default 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
__________________
Jonathon Prevost
Upper Hand Technologies

http://www.upperhandtech.com/
Reply With Quote
  #9  
Old 06-16-2014, 11:01 AM
  alarnold's Avatar 
alarnold alarnold is offline
 

Advanced Member
  
Join Date: Jan 2008
Posts: 33
 

Default 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!
__________________
X-Cart version 4.7.12 Platinum

arnoldcoin.com

Change is inevitable, except from a vending machine
Reply With Quote

The following user thanks alarnold for this useful post:
maineiac (07-29-2014)
  #10  
Old 08-10-2020, 07:56 PM
  alarnold's Avatar 
alarnold alarnold is offline
 

Advanced Member
  
Join Date: Jan 2008
Posts: 33
 

Default 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)
__________________
X-Cart version 4.7.12 Platinum

arnoldcoin.com

Change is inevitable, except from a vending machine
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 08:29 PM.

   

 
X-Cart forums © 2001-2020