Forums / Upgrading to 1.5.x / Admin Specials and Featured Sort order

Admin Specials and Featured Sort order

Views: 2,301

Results 1 to 7 of 7
15 Oct 2023, 3:03 PM
#1
gothstone avatar

gothstone

Zen Follower

Join Date:
Jun 2005
Posts:
330
Plugin Contributions:
0

Admin Specials and Featured Sort order

dev.pezcollectors.com ZC1.5.8a PHP 8.1.24
In Admin, Catalog, Specials or Featured, THEN Add Special by Selection - Products are ordered by product model and I want to change it to products_id DESC.
In 157 I could just change the line ```
$prev_next_order = ' ORDER BY

Any suggestions?

2 + 2 = 5 for extremely large values of 2

Pez Collectors Store •••••••• My Plugins List

15 Oct 2023, 4:36 PM
#2
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,967
Plugin Contributions:
8

Re: Admin Specials and Featured Sort order

few things:

  • what a pain!
  • good catch, this is a bug.
  • have you played around with the new searching? it is quite powerful. and only requires partial word matches; ie searching for 'great product', would return a product whose name is 'greatest product'.

that said, find this line of code:

https://github.com/zencart/zencart/blob/3db8d527910b7fc0f0fb9e2f722833cb9d973d79/includes/functions/functions_categories.php#L339

and change it to:

$order_by = str_replace(['pd.', 'p.'], '', zen_products_sort_order(false));

the sorting is then controlled by this constant:

PRODUCT_INFO_PREVIOUS_NEXT_SORT

which is available by searching using the developers tool kit; or by admin -> configuration -> product info.

let us know if that fixes the bug for you.

note that the sorting is the same as is used on the storefront.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

15 Oct 2023, 5:08 PM
#3
gothstone avatar

gothstone

Zen Follower

Join Date:
Jun 2005
Posts:
330
Plugin Contributions:
0

Re: Admin Specials and Featured Sort order

Interesting. The change made no change on the storefront that I can find. It DID fix a separate issue on featured when selecting a product would randomly change the sort order but could mean that what you selected was on the next page. Under add by selection, it changed the sort to Product Name Alpha ASC. So kinda getting there, but my goal is still for add by selection to be product_id DESC. Actually, as long as I'm begging, the ideal would be date added descending, but assuming we don't have that bit of data here, id should be close enough.

Search is great, but most of the time the user want to go put the 10 new products she added on featured or special, so having them at the top is her ideal.

2 + 2 = 5 for extremely large values of 2

Pez Collectors Store •••••••• My Plugins List

15 Oct 2023, 7:45 PM
#4
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,967
Plugin Contributions:
8

Re: Admin Specials and Featured Sort order

gothstone:

Interesting. The change made no change on the storefront that I can find. It DID fix a separate issue on featured when selecting a product would randomly change the sort order but could mean that what you selected was on the next page. Under add by selection, it changed the sort to Product Name Alpha ASC. So kinda getting there, but my goal is still for add by selection to be product_id DESC. Actually, as long as I'm begging, the ideal would be date added descending, but assuming we don't have that bit of data here, id should be close enough.

Search is great, but most of the time the user want to go put the 10 new products she added on featured or special, so having them at the top is her ideal.

pezman,
i'm not here to acquiesce to your every request. i'm here to fix bugs.

if you want to change other sorting options, i would suggest you open a PR on the ZC github repo. barring that, i would suggest hiring one of the talented (or not so talented) coders on this board. if you need a recommendation, feel free to PM me.

i would suggest you re-read my first post. i did not say that coding change would affect the storefront; i said changing the constant will change the sorting on the storefront. however, in thinking about it, it is entirely possible that your template could be over-riding it.

best.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

16 Oct 2023, 12:10 AM
#5
gothstone avatar

gothstone

Zen Follower

Join Date:
Jun 2005
Posts:
330
Plugin Contributions:
0

Re: Admin Specials and Featured Sort order

I'm sorry, I didn't mean to offend. I'll keep playing with it on my own.

2 + 2 = 5 for extremely large values of 2

Pez Collectors Store •••••••• My Plugins List

16 Oct 2023, 12:24 AM
#6
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,967
Plugin Contributions:
8

Re: Admin Specials and Featured Sort order

gothstone:

I'm sorry, I didn't mean to offend. I'll keep playing with it on my own.

no offense taken....

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

16 Oct 2023, 1:19 AM
#7
gothstone avatar

gothstone

Zen Follower

Join Date:
Jun 2005
Posts:
330
Plugin Contributions:
0

Re: Admin Specials and Featured Sort order

Notes for the next person who finds this in search:
After applying bugfix, admin/config/product info/prev next sort order DOES set order for product by selection, but no DESC is available.
That select box is drawn on line 255 for featured. 2 lines up is an ORDER BY function. Unfortunately, it doesn't do anything that I can find.
Bad fix for now: insert between </div> tags at lines 257

<script>
var select = $('select');
  select.html(select.find('option').sort(function(x, y) {
    var num1 = parseInt($(x).text());
    var num2 = parseInt($(y).text());
        return num1> num2 ? 1 : -1;
  }));
</script>

It's an ugly hack, but it works.

2 + 2 = 5 for extremely large values of 2

Pez Collectors Store •••••••• My Plugins List