Hi, Mary -- (Mary allowed me access to her site, so we could iron out the final wrinkles.) Okay -- Mary, I just watched your site put 4 Numbers into the Cart; tally the order; thank me; and then, when I returned as a new shopper, those 4 numbers were absent -- so I think we can declare victory, here. :-) Here's what we did: - I restored sub check_db_with_product_id to its original, default state. (Something about what we were trying to do, in that location, was producing problems later. I continue to think we could introduce this modification into that subroutine, but we've got a running, alternate solution now anyway, one that can be switched on or switched off by way of the set-up file.) - I added a new subroutine, below that one, inside web_store_db_lib.pl, named "tag_product_as_sold". I'll paste that in, a little further down. - In the setup file, I added a new variable, $sc_db_index_for_sold_tag -- and added a new $db{'sold'} definition (numbered '8' in your setup, Mary). This would need to be allowed for in the initial set-up of the data.file, since it's an additional field, there. However, depending on how one wants to use this field, it might not need to go into the Cart at any point, so its presence may -not- affect other definitions that refer to the $db{} ones. - In web_store_html_lib.pl, I added at about line 884, a call to our new subroutine, as the last thing to be done in the "if (($reason_to_display_cart =~ /process.*order/i)..." code block. It looks like so: } # End of Else &tag_product_as_sold($product_id); } # End of if (($reason_to_display_cart =~ /process.*order/i)... - In web_store_db_lib.pl, inside "sub submit_query", just after the 'while' block begins and we split the line into fields, I added an 'if(...eq "sold")' clause, using the new variable we added to the setup file, with the purpose of -omitting- the record from being included in the retrieved records, if we find it's marked "sold" -- looks like this: @fields = split(/\|/, $line); if($fields[$sc_db_index_for_sold_tag] eq "sold") { next; } Thus -- after the Order has been committed to be processed, we're rewriting the entire data.file, and adding the word "sold" to the records of products that have been found to be in the Cart and with their correct prices. And, we are omitting from the Product Display any records we find that are marked "sold". The effect is that the item has been removed from being offered for purchase, but its record has -not- been deleted. The item would reappear in the product display, if we edited the file and removed the word "sold" from its record. Another routine could be written to do that, or it could be modified by hand, doesn't matter. Other options -- we could've chosen to -delete- the record entirely. Or we could've chosen to 'mark' the record somehow, which would mean it would still be displayed but would show itself as "not available for purchase". Either of those could be accomplished by modifying the subroutine we've added to web_store_db_lib.pl. Since this is a separate subroutine, and is referred to in just 2 places in the WebStore script set, it would be easy to re-code those 2 calls, or comment them out, if we don't want the Store to perform this action. Here's the subroutine: ############################################################ # # subroutine: tag_product_as_sold # Usage: # $status = &tag_product_as_sold($product_id); # # Parameters: # $product_id = product id in the cart to tag as sold # # Output: # $status = whether the product id is has been # found in the database. If it has not, then # we know right away that something went wrong. # ############################################################ sub tag_product_as_sold { local($product_id) = @_; local($db_product_id); local($matching_db_id); local($new_data); local($line); local(@this_db_row); open(DATAFILE, "$sc_data_file_path") || &file_open_error("$sc_data_file_path", "Read Database",__FILE__,__LINE__); while ($line = ) { chomp $line; @this_db_row = split(/\|/,$line); $db_product_id = $this_db_row[0]; if ($product_id eq $db_product_id) { $matching_db_id = $db_product_id; $this_db_row[$sc_db_index_for_sold_tag] = "sold"; $line = join("\|",@this_db_row); } $new_data .= "$line\n"; } # End of while ($line = ) close (DATAFILE); &get_file_lock("$sc_data_file_path.lock"); open (DATAFILE, ">$sc_data_file_path") || &file_open_error ("$sc_data_file_path", "Delete Item", __FILE__, __LINE__); print DATAFILE "$new_data"; close (DATAFILE); &release_file_lock("$sc_data_file_path.lock"); return ($product_id eq $matching_db_id); } # End of tag_product_as_sold ###################################################### NOTE: The last 'open' statement should be showing a right-pointing angle bracket, inside the quote and before the filename variable. I've written that as &-g-t-; here, to hopefully make sure it shows up as an angle bracket on the BBS, here -- but it must actually _be_ an angle bracket, when this is added to the script. -- Jeff --