VP-ASP :: Shopping Cart Software

Shopping Cart Software Solutions for anywhere in the World

US/Canada(Toll Free): +1 888 587 2278
Europe/UK: +44 (020) 7193 9408
Australia/New Zealand: +61 3 9016 4497

VP-Cart StoreFront Customer Forum

Home | Profile | Register | Active Topics | Members | Search | FAQ
Save Password
Forgot your Password?

 All Forums
 VPCart Forum
 "Restore Order" Fix: Use product''s current price
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

VP-ASP New User

57 Posts

Posted - August 17 2004 :  16:23:29  Show Profile  Visit Dulrr's Homepage  Reply with Quote
Was having a bit of a struggle with order restoration, which is a useful feature for customers who regularly place orders for similar products, because a restored order will read the price saved in the oitems table instead of the products table. What this means is that restored orders will not reflect price changes (or customer discount changes), and could potentially cause problems in the long term.

So, to nip the problem in the bud, I was trying to figure out a nice, simple solution to this complicated task. What severly complicated matters was trying to find a way to restore product features with a product - restoring a cable order AND looking up it's price using the product feature logic available was positively DAUNTING. Believe it or not, there WAS a nice, simple solution - though it took a bit of creative thinking.

Instead of using the Restore feature in shoprestoreorder.asp I used the shopping cart's search ability to search out all the products from the order instead. This creates an intermediate confirmation step for the user, but negates the problems of using the Restore feature in a cart that may have to worry about price changes, etc.

And that was probably more of a history lesson than most of you could stand, so on to the update:


Modify ShopRestoreOrder.asp as follows:

Const RestoreRedirectUrl="shopdisplayproducts.asp?search=Yes&restore=Yes" (Top of page)

Find Sub RestoreItems (oid)
-Remove (or comment out) everything between
if Items.EOF then
set items=nothing
exit sub
end if
and the end of the sub

Insert instead:
dim SQL
SQL=SQL & "catalogid=" & items("catalogid")
While Not Items.EOF
SQL=SQL & " OR catalogid=" & items("catalogid")
SetSess "SQL",SQL
set items=nothing

Now, using the order restore will take you to a search page that lists all the products from the old order.
Modify shopdisplayproducts.asp and shopproductformat.asp to conditionally change the way products are displayed by testing the if the "restore" querystring is empty or not. All of the following are optional.

SetSess "CurrentUrl","shopdisplayproducts.asp"
SetSess "CurrentUrl","shopdisplayproducts.asp"
'Special handling if restoring an order
if Request.QueryString("restore")<>"" then
end if

This will cause the search page to be displayed with select boxes (not orderbuttons) and will increase the number of products per page so that all products will appear on one page (meaning the next step in the restore is a simple click and we don't have to worry about extra page numbers)

If desired, update the sub DisplayProducts() to include a string of text you wish to be displayed at the top of your order restoration search.

shopdisplayproducts.asp, shopproductformat.asp
We probably don't want to stay on the search page after ordering, so change all instances of if stayonpage="Yes" to if stayonpage="Yes" AND Request.QueryString("restore")=""

We probably want all of the "Select" checkboxes to be checked by default, so find all
<input type=checkbox name="Processed<%=prodIndex%>"  value="<%=lngCatalogid%>">
and replace with
<input type=checkbox name="Processed<%=prodIndex%>"  value="<%=lngCatalogid%>" <%if Request.QueryString("restore")<>"" then Response.Write(" CHECKED")%>>

If anybody out there finds this useful, feel free to use it. A "thank-you" or Cold One (or contribution to my college fund) is, of course, appreciated though!


Starting Member

1 Posts

Posted - May 27 2006 :  07:45:02  Show Profile  Visit Kugy's Homepage  Reply with Quote
shoprestoreorder.asp details?
Plesae write.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000