To add page navigation to commerce.cgi by -Chris Costa-: First, depending on your version you might need to fix some bugs in commerce.cgi which do not pass relevant information along in the ordering process. ** NOTE ** the most important item to be passed for page index navigation is the "next" value. I believe current versions of commerce.cgi already have this bug addressed and pass this value. The price values below are only needed if you allow customers to search on price ranges, if not you can omit those values. You may also mirror this process to pass along any other important information to you. (such as "exact_match", etc.) These fixes allow you to return to the correct page after adding to cart or pressing continue shopping and I would recommend them regardless: 1) Add to hidden fields in productPage.inc (just copy and paste below the others): 2) Now, add the appropriate fields to the checkout link in productPage.inc by REPLACING the checkout link with this one: Be sure to replace ALL of your checkout links with this one, including any you may have added to the header or footer. 3) Add to hidden fields in commerce_html_lib.pl - sub cart_table_header (just copy and paste below the others): 4) In special_library.pl sub displayProductPage add code to replace the holders (just copy and paste below the others): s/%%next%%/$form_data{'next'}/g; s/%%qplr%%/$form_data{'query_price_low_range'}/g; s/%%qphr%%/$form_data{'query_price_high_range'}/g; **note, you may also need to add the above code in step 4 to the commerce_subs.pl file and in the sub in the header or footer if using checkout links there** ** You must do the above before using this hack for page indexing or the add to cart and continue shopping buttons will likely return the customer to the front store page. If this happens to you, then carefully go over the above step by step. ** ** Using the above fixes is a good idea whether you are using the page indexing hack or not ** Once you've done the above, now you can install this hack for page indexed navigation: You need to make modifications in 2 parts of the commerce_html_lib.pl file found in the library folder: 1) add this entire subroutine to the end of the commerce_html_lib.pl file just before the 1; leave the 1; there right after this: ## Hack to display how many products found by pages by Chris Costa sub page_status{ if ($db_status =~ /max.*row.*exceed.*/i){ local ($fromshown); local ($toshown); local ($pages); local ($page); if ($maxCount > $total_rows_returned){ $toshown = $total_rows_returned; }else{ $toshown = $maxCount; } if ($form_data{'next'} < 1){ $fromshown = 1; }else{ $fromshown = $form_data{'next'}; } ### to display page status: $page = $toshown/$sc_db_max_rows_returned; $pages = $total_rows_returned/$sc_db_max_rows_returned; if ($page =~ /\./g){ $page = int($page)+1; } if ($pages =~ /\./g){ $pages = int($pages)+1; } # end page status $cc=1; $warn_message .="
$backn  "; do { $ccnext = ($cc-1)*$sc_db_max_rows_returned; if ($cc == $page){ $warn_message .= qq! $cc  !; }else{ $warn_message .= qq!
$cc  !; } $cc++; } while ($cc<=$pages); $warn_message .= "Page $page of $pages  $front"; } $warn_message .="
"; } ## end sub page_status - don't forget to leave the: 1; 2) Now find the sub product_page_footer in that file (commerce_html_lib.pl) and REPLACE it with this ENTIRE subroutine: NOTE: If you don't want to replace it, simply re-name the old subroutine to something like sub product_page_footer_old, then paste this new one right above it. Just switch the two names if you ever want to change back. sub product_page_footer { ## Hack for price search: local($keywords); $keywords = $form_data{'keywords'}; local($lowrange); local($highrange); local($forprice); $lowrange = $form_data{'query_price_low_range'}; $highrange = $form_data{'query_price_high_range'}; if ($lowrange || $highrange){ $forprice = "&query_price_low_range=$form_data{'query_price_low_range'}&query_price_high_range=$form_data{'query_price_high_range'}"; } ## end for price search $keywords =~ s/ /+/g; # $db_status gives us the status returned from the database # search engine and $total_rows_returned gives us the # actual number of rows returned. $warn_message which # is first initialized, will be used to generate a warning # that the user should narrow their search in case # too many rows were returned. local($db_status, $total_rows_returned) = @_; local($warn_message); $warn_message = "
"; # If the database returned a status, the script checks to # see if it was like the string "max.*row.*exceed". If # so, it lets the user know that they need to narrow their # search. if ($db_status ne "") { if ($db_status =~ /max.*row.*exceed.*/i){ if($form_data{'next'} > "0"){ $backn = qq! Back !; } if ($maxCount < $rowCount){ $front = qq! Next
!; } ## Hack for page status: #now we'll break out of this and do a nice job of formatting page navigation &page_status; $warn_message .= "
"; } } # Then the script displays the footer information defined # with $sc_product_display_footer in web-store.setup and # adds the final basic HTML footer. Notice that one of the # submit buttons, "Return to Frontpage" is isolated into # the $sc_no_frames_button variable. This is because in # the frames version, we do not want that option as it # will cause an endlessly fracturing frame system. Thus, # in a frame store, you would simply set # $sc_no_frames_button to "" and nothing would print here. # Otherwise, you may include that button in your footer # for ease of navigation. The variable itself is defined # in web_store.setup. The script also will print the # warning message if there is a value for it. print qq~ $sc_product_display_footer

$warn_message ~; &StoreFooter; print qq~ ~; exit; } # end product_page_footer That's it! Now your pages will have navigation similar to the Google search engine, something likely familiar to users. Please be sure to take a look at some of the scripts I have to help with using commerce.cgi - and add functionality at: http://wildaboutbeads.com/hosting/scripts/ Regards, -Chris Costa-