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

Sorting products by 'Position'

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 03-03-2019, 11:23 AM
 
welly welly is offline
 

eXpert
  
Join Date: Mar 2011
Location: UK
Posts: 209
 

Default Sorting products by 'Position'

Hi all

On the customer side, I want to be able to sort my products in each category according to their 'position' field just as I do in my 4.x store, but that particular sort option doesn't exist.

I can see that there is a developer doc which explains how to add a sort option (their example is 'arrivalDate'), and I'm happy to follow that doc having used a couple of others with some success, but instead of 'p.arrivalDate' what should I be using?

Would 'p.pos' be too easy?

On a similar note, how do I find out what the structure of the product data model/entity is so that in future I can just refer to that? Or any model, in fact?

Many thanks

Welly
__________________
X-Cart Business 5.3.6
Various add-ons

www.traininglines.co.uk
Reply With Quote
  #2  
Old 03-03-2019, 05:54 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Sorting products by 'Position'

Don't do search for products within category. Go to the categories list and click on the product number or go to the category you want to do the sort for and click on the product tab.
This will give you a list of product assigned to the category.
If you have more than X products the position field is text field to enter number into. If you have less than X products there is no text field for position - instead there is a drag/drop icon - just drag the products to change the order. X is the number of products to show on one page.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #3  
Old 03-04-2019, 12:25 AM
 
welly welly is offline
 

eXpert
  
Join Date: Mar 2011
Location: UK
Posts: 209
 

Default Re: Sorting products by 'Position'

Hi Steve

I'm not sure I understand.

I'm asking about adding a sort criterion to the category products on the customer side using an existing product field. I can follow the relevant developer doc which uses the example 'p.arrivalDate', but I don't know how to reference the field I want. The position field.

More importantly, I don't know how to find out what fields are available for products (or categories, or anything at all).

Can you help with that?

Many thanks

Welly
__________________
X-Cart Business 5.3.6
Various add-ons

www.traininglines.co.uk
Reply With Quote
  #4  
Old 03-04-2019, 05:20 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Sorting products by 'Position'

You do not have to add anything. It is already there. And it will sort by position. But you need to set this position in admin - see my previous post.

Now if you are talking about allowing customers to sort by position - that's something else. But I don't really understand why customers will care about this. The position field is more of an internal thing than public.
Anyway you can still do that but you need to make changes to how products show and the sort by dropdown filter. The field I believe is called position but check ./Model/Product.php to be sure.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #5  
Old 05-01-2019, 04:54 PM
 
david_ygao david_ygao is offline
 

Advanced Member
  
Join Date: Feb 2005
Location: canada
Posts: 40
 

Default Re: Sorting products by 'Position'

Sorting products by SKU is very useful for customer to find similar products, since similar products have similar SKU numbers. Unfortunately XC5 has removed this XC4 feature. Is it easy to add such feature ? We have very long list product in each category, It is almost impossible to manage to sort many products by pos in admin manually (by SKU in my case).
__________________
/David Gao/
X-cart business 5.3.6
Reply With Quote
  #6  
Old 05-02-2019, 12:29 AM
 
welly welly is offline
 

eXpert
  
Join Date: Mar 2011
Location: UK
Posts: 209
 

Default Re: Sorting products by 'Position'

Adding a sort option is described in this document:

https://devs.x-cart.com/basics/itemslist_introduction_--_showing_products_on_a_page/adding_new_sort_by_opt...itemslist.html

The example uses a date, but if you can identify the SKU field, you should be able to use that. Unfortunately, this is where I came unstuck, but as Steve said in his last post, the option I wanted was already there. I just didn't know it at the time.

Welly
__________________
X-Cart Business 5.3.6
Various add-ons

www.traininglines.co.uk
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may 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 12:41 AM.

   

 
X-Cart forums © 2001-2020