eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
Development resources
 ::   WebWare 2.1 (Perl)
 ::   WebWare 2.0 (Java)
 ::   Cool hacks
radical hacks
Changes to Selena Sol's Webstore 4.0  
Also, check out the hack that made to do previous as well as next!

Thanks for checking out my Changes to Selena Sol's Webstore 4.0. Thanks for the great scripts, Selena & Gunther ! I'm currently working on an online catalogue for a CD Distribution Company, and I chose Web Store for the shopping cart system. However, as awesome as these scripts are, I needed to make some changes. I will document those changes here so that others can benefit from my changes. The first change here is to allow the database search to return a set number of hits at a time, giving the shopper the opportunity of viewing the next 10 hits (or whatever value you have set in your setup file). I will soon add some of the other changes I have made based on discussions in Selena Sol's Script Archive Web Conference.

View Next 10 Hits


In the file web_store.cgi under the section:
    #######################################################################   
    #                   create_html_page_from_db Subroutine               #  
    #######################################################################   
    

I replaced the following line:
    ($status,$total_row_count) = &submit_query(*database_rows);
    

With these two lines:
    ($status,$total_row_count) = &submit_query(*database_rows, $form_data{'hits_seen'});
    $hits_seen = $form_data{'hits_seen'} + $sc_db_max_rows_returned;
    


then, in the file web_store_db_lib.pl, there is a subroutine that begins with:
    ############################################################
    # 
    # subroutine: submit_query
    
i replaced the following line:
    sub submit_query
    {
      local(*database_rows) = @_;
    
with:
    sub submit_query
    {
      local(*database_rows, $hits_seen) = @_;
    
then further down in that same subroutine, replace:
    while(($line = <DATAVIRTUAL> ) &&
          ($row_count < $sc_db_max_rows_returned + 1))
    
with:
    while(($line = <DATAVIRTUAL> ) &&
          ($row_count < $sc_db_max_rows_returned + $hits_seen))
    
further down still in the same subroutine, replace:
    if (($not_found == 0) && 
        ($row_count <= $sc_db_max_rows_returned))
    
with:
    $adjusted_line_number = $sc_db_max_rows_returned+$hits_seen;
    
    if (($not_found == 0) && 
        ($row_count <= $adjusted_line_number) &&
           $row_count >= $hits_seen)
    


the last file that i modified was web_store_html_lib.pl in the section:
    #######################################################################
    #                    product_page_footer Subroutine                   #   
    #######################################################################
    
i replaced the following routine:
    if ($db_status ne "") 
      {
      if ($db_status =~ /max.*row.*exceed.*/i) 
        {
        $warn_message = qq!
        <CENTER>
        <BLOCKQUOTE>
        Your query returned $total_rows_returned.  This is more than
        the maximum we allow ($sc_db_max_rows_returned). You will need to
        restrict your query further.
        </BLOCKQUOTE></CENTER><P>!;
        }
      }
    
with:
     if ($total_rows_returned >= $hits_seen) 
        {
        $warn_message = qq!
        <CENTER>
    	<INPUT TYPE = "hidden" NAME = "hits_seen" VALUE= "$hits_seen">
    	<INPUT TYPE = "submit" NAME = "search_request_button"  
    	 VALUE = "See the next $sc_db_max_rows_returned hits">
        </CENTER>:<P>!;
        }
    


I'm pretty sure that's all I did to make the max rows returned return a predefined amount of hits. If you're interested in seeing my implementation of Webstore, you can check out the catalogue at http://www.festival.bc.ca If you have any comments, you can email me at . My site can be found at http://www.neel.org/.

thanks for stopping by !