Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Adding Product Code To Default Sorting Rate Topic   - - - - -

 
  • The Tool
  • Been Here Way Too Long Member
  • Members
  • Join Date: 30-Mar 07
  • 3876 posts

Posted 24 April 2008 - 04:06 AM #1

I have been searching for this off and on for some time now and I just happened upon it trying to correct the timezone issue. It's funny how some things are so easy to change but the challenge is finding out where to make the changes.

What this does is add default sorting for product code. It isn't complete because I have yet to determine how to add "Product Code" to the selection list in Appearance Settings, however, it still sorts your products by code.

In myphpadmin in the database table cscart_settings_variants you simply need to add the option as show in the pic below.

[ATTACH]789[/ATTACH]


Like I said, Product code does not show up in the list but if you select the blank, your products will be sorted by code both in admin and in customer area.

[ATTACH]790[/ATTACH]

I can't believe that CS-Cart architects have not implemented this? It's not that difficult and they know where things are located better than we do. Also, I am sure it's been requested at least a few times.

Attached Files



 
  • mdekok3000
  • Senior Member
  • Members
  • Join Date: 06-Feb 08
  • 883 posts

Posted 24 April 2008 - 04:32 AM #2

Add to cscart_settings_descriptions

object_id = 10007
description = Product code
object_type = V
lang_code = EN
[SIZE=2]
[/SIZE]

 
  • The Tool
  • Been Here Way Too Long Member
  • Members
  • Join Date: 30-Mar 07
  • 3876 posts

Posted 24 April 2008 - 05:20 AM #3

Thanks Matt, I was busy working on other stuff but that was where I was headed next.

For others, Matts suggestion adds the "Product code" to the selection list in admin.

 
  • davidwpotts
  • Junior Member
  • Members
  • Join Date: 21-Apr 08
  • 31 posts

Posted 05 July 2008 - 02:25 AM #4

Add to cscart_settings_descriptions

object_id = 10007
description = Product code
object_type = V
lang_code = EN


Any chance someone could be specific about where to locate this code and how to implement it. This would solve a huge problem for me. Sorry to be a pain but I know just enough about what I am doing to get in a serious fix. Thanks!!
Doc Savage

 
  • davidwpotts
  • Junior Member
  • Members
  • Join Date: 21-Apr 08
  • 31 posts

Posted 05 July 2008 - 02:57 AM #5

I have been searching for this off and on for some time now and I just happened upon it trying to correct the timezone issue. It's funny how some things are so easy to change but the challenge is finding out where to make the changes.

What this does is add default sorting for product code. It isn't complete because I have yet to determine how to add "Product Code" to the selection list in Appearance Settings, however, it still sorts your products by code.

In myphpadmin in the database table cscart_settings_variants you simply need to add the option as show in the pic below.

[ATTACH]789[/ATTACH]


Like I said, Product code does not show up in the list but if you select the blank, your products will be sorted by code both in admin and in customer area.

[ATTACH]790[/ATTACH]

I can't believe that CS-Cart architects have not implemented this? It's not that difficult and they know where things are located better than we do. Also, I am sure it's been requested at least a few times.


How do you insert the necessary field in the database. I see the insert tab but do not know what to do after that. Thanks for any and all help.
Doc Savage

 
  • davidwpotts
  • Junior Member
  • Members
  • Join Date: 21-Apr 08
  • 31 posts

Posted 05 July 2008 - 11:12 AM #6

How do you insert the necessary field in the database. I see the insert tab but do not know what to do after that. Thanks for any and all help.

I have figured out how to insert the necessary fields in the datbase. Unfortunately, I ended up with unusable results. It started sorting products like so:

10
101
102..
20
201...etc

Completely unusable. :(
Doc Savage

 
  • The Tool
  • Been Here Way Too Long Member
  • Members
  • Join Date: 30-Mar 07
  • 3876 posts

Posted 07 July 2008 - 08:43 AM #7

I don't know what you are selling david but if you have a lot of different manufacturers, sorting by product code keeps your products more organized.

 
  • davidwpotts
  • Junior Member
  • Members
  • Join Date: 21-Apr 08
  • 31 posts

Posted 07 July 2008 - 01:51 PM #8

I don't know what you are selling david but if you have a lot of different manufacturers, sorting by product code keeps the your products more organized.

You can have a look at tooloutfitters.net.


Good looking site. Liked the listmania layout on the homepage. Looks much better than the default settings. I will definately change mine.

I am selling comic books. Over 11,000 listed currently with literally hundreds of manufacturers/publishers. I upload new products using a spread sheet since I list 100's at a time and this is much quicker.

I have been sorting my items with the default settings which does work, although without going into a lengthy explanation, problems do arise. Sorting by product code would be perfect. Thing is, when I add new products in numeric order on the spread sheet they do not show in correct position on the site. Any new item is listed at the very end of the page. Example:

If I have products codes 1,2 3 5,6 and I add product code 4 the end result is 1,2,3,5,6,4 on my site. Even if I insert 4 in proper postion in the spreadsheet.

Thanks for you time!
Doc Savage

 
  • The Tool
  • Been Here Way Too Long Member
  • Members
  • Join Date: 30-Mar 07
  • 3876 posts

Posted 07 July 2008 - 10:53 PM #9

Something isn't right if it isn't sorting numerically. It sounds as if is still sorting by id/when added?

Did you "Update" after selecting "Product code"?

 
  • The Tool
  • Been Here Way Too Long Member
  • Members
  • Join Date: 30-Mar 07
  • 3876 posts

Posted 18 May 2009 - 08:42 PM #10

This works for version 2 as well.

 
  • The Tool
  • Been Here Way Too Long Member
  • Members
  • Join Date: 30-Mar 07
  • 3876 posts

Posted 23 May 2009 - 12:56 AM #11

This works for version 2 as well.


Well I stand corrected. This was working with the beta version but is no longer working with the "stable" version.

Edit: It doesn't seem that any of the other sorting options work either.

 
  • Eddy
  • Member
  • Members
  • Join Date: 08-Nov 07
  • 37 posts

Posted 19 June 2009 - 07:53 PM #12

This works for version 2 as well.



Dear Tool Outfitters,

How to do with the added date or time stamp?

 
  • The Tool
  • Been Here Way Too Long Member
  • Members
  • Join Date: 30-Mar 07
  • 3876 posts

Posted 21 June 2009 - 05:15 AM #13

Try this for sorting by date added:

In cscart_settings_descriptions insert:

object_id = 10008
description = Date added
object_type = V
lang_code = EN

In cscart_settings_variants insert:

variant_id = 10008
option_id = 10035
variant_name = timestamp
position = 40

 
  • michael
  • Senior Member
  • Authorized Reseller
  • Join Date: 27-Oct 06
  • 209 posts

Posted 24 July 2009 - 07:42 AM #14

Try this for sorting by date added:

In cscart_settings_descriptions insert:

object_id = 10008
description = Date added
object_type = V
lang_code = EN

In cscart_settings_variants insert:

variant_id = 10008
option_id = 10035
variant_name = timestamp
position = 40


Hi, as this method, all products are sort from olded to newest, how to make it sort from newest to oldest ?

in other topic, I see this:
Please find this part of the code:
Code:

if (empty($sort_order) || empty($directions[$sort_order])) {
	$sort_order = 'desc';
}

in the "search_products.php" file located in the "include/common" directory of your CS-Cart and replace "desc" with "asc".

But can not find search_products.php in cscart 2.0.

Thanks for your help !
Do whatever you want to do....

 
  • joe
  • Senior Member
  • Members
  • Join Date: 06-Jan 09
  • 824 posts

Posted 24 July 2009 - 08:53 AM #15

Hi, as this method, all products are sort from olded to newest, how to make it sort from newest to oldest ?

in other topic, I see this:

Please find this part of the code:
Code:

if (empty($sort_order) || empty($directions[$sort_order])) {
	$sort_order = 'desc';
}

in the "search_products.php" file located in the "include/common" directory of your CS-Cart and replace "desc" with "asc".

But can not find search_products.php in cscart 2.0.

Thanks for your help !

That version is 1.3.X...
PM me for custom project

 
  • michael
  • Senior Member
  • Authorized Reseller
  • Join Date: 27-Oct 06
  • 209 posts

Posted 24 July 2009 - 09:06 AM #16

That version is 1.3.X...


I know, so, I wanna know how to apply this in 2.0, thanks.
Do whatever you want to do....

 
  • michael
  • Senior Member
  • Authorized Reseller
  • Join Date: 27-Oct 06
  • 209 posts

Posted 29 July 2009 - 01:39 PM #17

Anyone knows ?
Do whatever you want to do....

 
  • The Tool
  • Been Here Way Too Long Member
  • Members
  • Join Date: 30-Mar 07
  • 3876 posts

Posted 29 July 2009 - 04:24 PM #18

I do not have timestamp/date added set up in mine so test it and let me know.

In /core/fn_catalog.php add the part in blue

$join .= " INNER JOIN ?:products_categories as products_categories ON products_categories.product_id = products.product_id INNER JOIN ?:categories ON ?:categories.category_id = products_categories.category_id $avail_cond $feature_search_condition";
	$limit = '';
	$group_by = 'products.product_id';
	fn_set_hook('get_products', $params, $fields, $sortings, $condition, $join, $sorting, $group_by);

	if (empty($params['sort_order']) || empty($directions[$params['sort_order']])) {
		$params['sort_order'] = '[COLOR="Blue"]desc[/COLOR]';
	}

	if (empty($params['sort_by']) || empty($sortings[$params['sort_by']])) {
		$params['sort_by'] = Registry::get('settings.Appearance.default_products_sorting');
	}

	if ($params['type'] != 'extended' && $params['sort_by'] == 'price') {
		$params['sort_by'] = 'product';
	}

	$sorting = $sortings[$params['sort_by']] . ' ' . $directions[$params['sort_order']];


 
  • The Tool
  • Been Here Way Too Long Member
  • Members
  • Join Date: 30-Mar 07
  • 3876 posts

Posted 29 July 2009 - 09:42 PM #19

I did try this with "Product code" instead of "Date added" (because I don't need it) and it does work. This is, of course, you made the changes above in the database for Date added/timestamp and it sorts from newest to oldest.

 
  • cm4554
  • Member
  • Members
  • Join Date: 01-Jul 09
  • 97 posts

Posted 03 November 2009 - 05:59 PM #20

This worked well in version 2.0.6, but did not worked in latest version 2.0.8
Can anyone got an advice?
We are currently using CS Cart 4.1.2