Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2428

    RE: http://www.kriesi.at/support/topic/sort-by-price-get-it-for

    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 …

    <?php _e(‘Product ID #’,’cleancut’)?>.

    Thanks.

    #37961

    The thread you’re refering to uses following code for the price sort option:

    echo "<span class='price_sort hidden'>";
    echo $the_price;
    echo "</span>";

    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).

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘How does the Sort by Price work and could I also add a sort by Product ID#?’ is closed to new replies.