Thanks for the info found on the above thead. It helped me lots. And I have it working.
However I do not understand how or why the sort on Price actually works.
As the id is set to _price ( “id” => “_price” ),
while support for ‘custom-fields’ is added,
and later the button link is simply <?php _e(‘Price’,’cleancut’)?>.
How does one refer to the other? I don’t understand where the connection is made. Is it simply sorting on the LAST custom field?
The reason I ask, is if you wanted to also add a Product ID Number (“_product_id”), how would the code know to sort on that field instead of the price field?
assuming that link would be …
The thread you’re refering to uses following code for the price sort option:
echo "<span class='price_sort hidden'>";
As you can see the price value is between the span tags – so the sorting function can sort an use it as a parameter. (You can’t see the price value because it’s hidden).
The topic ‘How does the Sort by Price work and could I also add a sort by Product ID#?’ is closed to new replies.