chrometweaks.org

What may be the best iPage web host/builder?

Click Here To View All Answers...


Got a question, hope someone can answer... What may be the best iPage web host/builder? Looking forward for any comment. Another question I got... I am trying to figure out how I can set the default sort in the category listings from the product name to the product price..

I want my products to be listed in order from the lowest price to the highest price..

I know you can click on the column heading, but can I change it to default to the price column when the page first loads?.

Thanks,.

Ghiggi..

Comments (10)

Good question... I dunno what is the right answer to your question. I'll do some investigation and get back to you if I bump into an good answer. You should email the people at iPage as they probably could answer your iPage question..

Comment #1

Wouldn't you want to change to.

If ($column_list[$i] == 'PRODUCT_LIST_PRICE') {.

As well? Or something like that?.

Hth,.

Matt..

Comment #2

Ok, I got it..

You were on the right track..

I needed to change:.

  if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {.

    for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {.

      if ($column_list[$i] == 'PRODUCT_LIST_NAME') {.

        $HTTP_GET_VARS['sort'] = $i+1'a';.

        $listing_sql .= " order by pd.products_name";.

To:.

  if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {.

    for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {.

      if ($column_list[$i] == 'PRODUCT_LIST_PRICE') {.

        $HTTP_GET_VARS['sort'] = $i+1'a';.

        $listing_sql .= " order by final_price";.

Now it's working like I wanted it..

Thanks for the help,.

Ghiggi..

Comment #3

This is great, but how do I default it to descending?.

Thanks,.

Tina..

Comment #4

I figured it out. For future reference you simply place "desc" after "order by price list. The code reads....

If ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {.

   for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {.

     if ($column_list[$i] == 'PRODUCT_LIST_PRICE') {.

       $HTTP_GET_VARS['sort'] = $i+1'a';.

       $listing_sql .= " order by final_price desc";.

This post has been edited by.

Silkenstrand.

: 05 September 2004, 22:58..

Comment #5

I am trying to figure out how I can set the default sort in the category listings from the product name to the product price..

I want my products to be listed in order from the lowest price to the highest price..

I know you can click on the column heading, but can I change it to default to the price column when the page first loads?.

Thanks,.

Ghiggi..

Comment #6

It's been a while since I changed this, so bear with me here. In index.php find this code (near line 191):.

   if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {.

     for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {.

       if ($column_list[$i] == 'PRODUCT_LIST_NAME') {.

         $HTTP_GET_VARS['sort'] = $i+1'a';.

         $listing_sql .= " order by pd.products_name";.

And change that last line to:.

         $listing_sql .= " order by p.products_price";.

If that doesn't work properly, try:.

         $listing_sql .= " order by p.products_price asc";.

Regards.

Jim..

Comment #7


This question was taken from a support group/message board and re-posted here so others can learn from it.