Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / price sort - can't figure it out

price sort - can't figure it out

Locked

Views: 1,662

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
16 May 2007, 7:14 AM
#1
fakedecoy avatar

fakedecoy

Zen Follower

Join Date:
Jul 2006
Posts:
309
Plugin Contributions:
0

price sort - can't figure it out

I've set the Categories/Products Display Sort Order to "5= Products Price+, Products Name".

I've set the Previous Next - Sort Order to "3= Price, Product Name".

In Store Manager I clicked the "Update ALL Products Price Sorter" button.

And the products displayed in any category are still not sorting by price. What am I doing wrong? And is the difference between the first two options above?

24 May 2007, 4:15 PM
#2
peanut77 avatar

peanut77

Zen Follower

Join Date:
Feb 2005
Posts:
266
Plugin Contributions:
0

Re: price sort - can't figure it out

I am trying to do the exact same thing - but with no luck unless I force the product listing to default a particular product as the first on the list - which is no use as it means I'll have to update this every time a more expensive product is listed.

Have set everything above plus have set the default product set order to a product sort id - but then my next & previous is out of sorts...

Help - must be something v.v.v.obvious - cheers

24 May 2007, 4:18 PM
#3
peanut77 avatar

peanut77

Zen Follower

Join Date:
Feb 2005
Posts:
266
Plugin Contributions:
0

Re: price sort - can't figure it out

ooops - sorted one wee bit, I forgot to amend the "next sort order" in product info to go through the list as I require.

12 Jun 2007, 9:45 AM
#4
pickledshark avatar

pickledshark

New Zenner

Join Date:
Nov 2005
Posts:
24
Plugin Contributions:
0

Re: price sort - can't figure it out

From what I can tell the products_price_sorter does not include tax.. so if you have some products with tax and some without you will get unusual results.

I am looking into this at the moment but cant find anything on the forums...

12 Jun 2007, 10:06 AM
#5
pickledshark avatar

pickledshark

New Zenner

Join Date:
Nov 2005
Posts:
24
Plugin Contributions:
0

Re: price sort - can't figure it out

I don't know if it will fix your problem but it fixed mine - this was to do with the tax rates not being added onto products_price_sorter.

I edited the function zen_update_products_price_sorter() in the file admin\includes\functions\general.php

The updated code is as follows (starts at roughly line 2510):

////
// set the products_price_sorter
function zen_update_products_price_sorter($product_id) {
global $db, $currencies;

$products_price_sorter = zen_get_products_actual_price($product_id);


# We now need to add tax onto this
$tax_class = $db->Execute('SELECT products_tax_class_id FROM ' . TABLE_PRODUCTS . ' WHERE products_id = ' . $product_id);
$tax_class_id = $tax_class->fields['products_tax_class_id'];

$tax_rate = zen_get_tax_rate_value($tax_class_id);
$products_price_sorter = zen_add_tax($products_price_sorter, $tax_rate);


$db->Execute("update " . TABLE_PRODUCTS . " set
     products_price_sorter='" . zen_db_prepare_input($products_price_sorter) . "'
     where products_id='" . $product_id . "'");

}

Please note I implemented this in version 1.3.7 and have not tested in any other.

12 Jun 2007, 3:52 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: price sort - can't figure it out

I live in Ohio ... I don't pay tax to you ... now the products_price_sorter is all goobered up for me if I login as you have added Tax ... :unsure:

27 Jun 2007, 10:41 AM
#7
fakedecoy avatar

fakedecoy

Zen Follower

Join Date:
Jul 2006
Posts:
309
Plugin Contributions:
0

Re: price sort - can't figure it out

FYI I did figure it out -

"Display Product Listing Default Sort Order"

It should be set to "3a", meaning 3rd column (which is price), and 'a' for ascending.

28 Jun 2007, 5:40 AM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: price sort - can't figure it out

Thanks for the update ...

Note: the columns can be arranged in any order so this can change depending on the order of the columns ... thanks for posting your solution ...

29 Aug 2007, 8:00 AM
#9
0101101011 avatar

0101101011

New Zenner

Join Date:
Nov 2006
Posts:
61
Plugin Contributions:
0

Re: price sort - can't figure it out

Hi, I'm preparing data to upload to database. What value(s) should go to the products_price_sorter field by default? I did some testing, but I'm getting a random results - some items show the same value as the price, other items show a random number (can't figure it out yet what this represents) - please advise, Thanks,

29 Aug 2007, 2:50 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: price sort - can't figure it out

The products_price_sorter contains the lowest price that a product can be ...

This is calculated each time a product is edited or something to do with price has changed ...

Products require a master_categories_id to compute the products_price_sorter ... if this is set correctly, you can update the products_price_sorter after importing your files in the Tools ... Store Manager ...