Welcome, Guest ( Customer Panel | Login )




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

Dulrr
VP-CART 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
items.close
set items=nothing
Serror=getlang("langFormatMissing")
exit sub
end if
and the end of the sub

Insert instead:
dim SQL
SQL="SELECT * FROM products WHERE "
SQL=SQL & "catalogid=" & items("catalogid")
items.MoveNext
While Not Items.EOF
SQL=SQL & " OR catalogid=" & items("catalogid")
items.MoveNext
wend
SetSess "SQL",SQL
items.close
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.

shopdisplayproducts:
Update
ProductSelect=getconfig("xProductSelect") 
SetSess "CurrentUrl","shopdisplayproducts.asp"
mypage=request.querystring("page")
mypagesize=getconfig("xProductsPerPage")
to
ProductSelect=getconfig("xProductSelect") 
SetSess "CurrentUrl","shopdisplayproducts.asp"
mypage=request.querystring("page")
mypagesize=getconfig("xProductsPerPage")
'Special handling if restoring an order
if Request.QueryString("restore")<>"" then
ProductSelect="Yes"
mypagesize=999
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)


shopdisplayproducts.asp
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")=""

shopproductformat.asp
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!

~D

Kugy
Starting Member

Turkey
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
0 Item(s)
$0.00