Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 Customization
 Selling from a second (used) products table...
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Dulrr
VP-CART New User

57 Posts

Posted - January 31 2005 :  10:11:09  Show Profile  Visit Dulrr's Homepage  Reply with Quote
Hi, everyone. I'm working on adding a table to the database which contains used items for sale which can be ordered from the database. Well, the table itself isn't the problem, of course, it's thinking through all the subtleties of the cart to make sure a customer can actually buy them. I'm writing this to help clear my head and sort out ideas, and will appreciate input from members as I'm pondering.

Adding an item to the cart: Sticky, because used stuff is in a seperate table. Hmm... wait a moment... Let's take a closer look at what happens on shopaddtocart...

~D
[edit 01]

Right: When I click on the 'order' button on a normal product page, I go to shopaddtocart.asp and pass some value as the "action." Now - what actions does shopaddtocart expect? I could probably use an 'addused' action to do add the proper logic.

We'll also have to find the display part of 'shopaddtocart' since that's also where we can change product quantities. We'll want to remember used products, since there's a limited number of each used item. This might be a tad trickier, but we'll see...

Edited by - Dulrr on January 31 2005 10:20:09

[edit 02]

Hmm... the strAction variable is tough to decipher... This is a very messy piece of code, actually - a few elseif statements probably would have cleaned this up quite a bit. Here's a small sample:

if straction<>"" then
strAction="CONTI"
else
strAction=Request("Checkout")
If straction="" then
straction=Request("Checkout.x")
end if
if straction<> "" then

Not that I'm being picky or fussy (me? NEVER! *innocent*), but wouldn't the following do the same thing with half the headache?

if Request("Checkout")<>"" then
'"Checkout" logic
elseif Request("Checkout.x")<>"" then
'"Checkout.x" logic
'elseif Request("recalculate")<>"" then
(etc)

Anyways, moving on...

Edited by - Dulrr on January 31 2005 10:30:53

[edit 03]
VPASP doesn't use the "request" command the way my reference books expect it to be used. Normally, according to the sources I've got at hand, it's suppossed to be "Request.Something()" not just "Request()." Request.Querystring(), Request.Servervariables(), Request.Form()... but no mention of simply Request(). Where is the cart getting info from, then?

Edited by - Dulrr on January 31 2005 10:44:42

[edit 04]
Found the logic for actually adding a product to the cart. Sub CartAddItem() in shopproductfeatures.asp.

Not the first place I'd look for this sub - thank-you Dreamweaver for having a site search ability!

Modifying this should accomplish what I need to do. (Here's hoping, at least!) Now - to find a way to get the right variables to this function...

Edited by - Dulrr on January 31 2005 10:53:58

[edit 05]

My kingdom for some comprehensive comments! Flaaaargh!





Edited by - Dulrr on January 31 2005 11:09:11


[edit 06]
"Boldly going foreward 'cause we can't find reverse!"

EUREKA!! I think I've found it!

Alrighty: in shop$db, near the beginning, there's a slew of constants defined. Starting at const MaxCartAttributes, we see defined everything that will be stored in the 2D array, "CartArray," when items are purchased.

Implications:

Saving an additional piece of information should be a breeze. We increase MaxCartAttributes by one, then add a new constant at the end of the list. (So cProductUsed would be #22 in my Ver. 5.0 shopping cart)

On most pages, the array of items is referred to as "arrCart" - so I can run checks based on the value stored there. Something like "if arrCart(cProductUsed, [itemnumber]) = true then ... "

We're going to need to make updates in a few areas now, including shopaddtocart.asp. However, I think we're now pretty close to the end - and still working within the structure and confines of the software!

Time to plow foreward and see what new mistakes await us!

Edited by - Dulrr on January 31 2005 14:09:25
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00