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

    RE: (Purchase code hidden if logged out) -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’)?>.



    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.