close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Help with Add to PayPal Cart increment (ASP)

Thread began 1/25/2011 2:08 am by Nathon Jones Web Design | Last modified 1/25/2011 11:44 am by Jason Byrnes | 2617 views | 5 replies |

Nathon Jones Web Design

Help with Add to PayPal Cart increment (ASP)

Hi. Need some help with my "Proceed to Checkout" button to PayPal.
I need to pass a name, amount and quantity variable from my cart page, to PayPal, but I need to add an incremental number, beginning with 1, to the variable name.

In PHP, I have the code as:

<? $i = 1;?>
<? foreach ( $cart->items() as $item ) { ?>
<input type="hidden" name="item_name_<?=$i?>" value="<?= _h($item->product()->full_name())?>">
<input type="hidden" name="amount_<?=$i?>" value="<?=$item->product()->price()?>">
<input type="hidden" name="quantity_<?=$i?>" value="<?=$item->quantity()?>">
<? $i++; ?>
<? } ?>

How do I recreate this for Classic ASP, whilst integrating with my eCart Repeat Region?
Here's my eCart Repeat Region, without the incremental code:

<%
while (NOT WA_eCart_EOF(spCART))
%>
<input type="hidden" name="item_name_1" value="<%=WA_eCart_DisplayInfo(spCART, "Name")%> - <%=WA_eCart_DisplayInfo(spCART, "Description")%>">
<input type="hidden" name="amount_1" value="<%=WA_eCart_DisplayInfo(spCART, "Price")%>">
<input type="hidden" name="quantity_1" value="<%=WA_eCart_DisplayInfo(spCART, "Quantity")%>">
<%
set spCART = WA_eCart_MoveNext(spCART)
wend
set spCART = WA_eCart_MoveFirst(spCART)
%>

Also, I wondered if there was anything I could add that would prompt a user if they edited the quantities of an item in their eCart but forgot to click the 'Update' cart button, and subsequently then tried to click the 'Proceed to Checkout' button?

Appreciate the help, thanks.
Nath.

Sign in to reply to this post

Jason ByrnesWebAssist

a simple way to get the correct code to use is to create a test page and add an ecart checkout form for paypal payments standard to it.

go to Insert -> eCart -> Checkout Form. Select the remote checkout option, and select Paypal Payments Standard from the checkout type.

This checkout form will have the code you are looking for.

Sign in to reply to this post

Nathon Jones Web Design

can't progress

Hi Jason. Thanks for getting back to me.

The eCart > Checkout Wizard (not Form) is trying to insert a whole load of content I don't need though. For example, it's creating a form asking for billing information which I don't need because PayPal is handling all that.
It's also trying to create other pages such as confirm.asp, checkout_success.asp and checkout_failure.asp.

Anyway, it's created the following code which, concerningly, is nothing like the form I already have on my website. Perhaps someone could help me pick through it?

<%spCART_Index = spCART.DisplayIndex - 2%>
<%
while (NOT WA_eCart_EOF(spCART))
%>
<%spCART_Index = spCART_Index + 1%>

<% 'WA eCart Validation
if ((WA_eCart_FormatNumber(WA_eCart_DisplayInfo(spCART, "Price") - ((WA_eCart_DisplayInfo(spCART, "Price")/WA_eCart_TotalColumn(spCART, "TotalPrice")) * WA_eCart_GetDiscounts(spCART)), false, 2) > 0)) then
%>
<input type="hidden" name="amount_<%=spCART_Index+1%>" id="amount_<%=spCART_Index+1%>" value="<%= WA_eCart_FormatNumber(WA_eCart_DisplayInfo(spCART, "Price") - ((WA_eCart_DisplayInfo(spCART, "Price")/WA_eCart_TotalColumn(spCART, "TotalPrice")) * WA_eCart_GetDiscounts(spCART)), false, 2) %>" />
<input type="hidden" name="item_name_<%=spCART_Index+1%>" id="item_name_<%=spCART_Index+1%>" value="<%=WA_eCart_DisplayInfo(spCART, "Name")%>" />
<input type="hidden" name="item_number_<%=spCART_Index+1%>" id="item_number_<%=spCART_Index+1%>" value="<%=WA_eCart_DisplayInfo(spCART, "ID")%>" />
<input type="hidden" name="quantity_<%=spCART_Index+1%>" id="quantity_<%=spCART_Index+1%>" value="<%=WA_eCart_DisplayInfo(spCART, "Quantity")%>" />
<input type="hidden" name="on0_<%=spCART_Index+1%>" id="on0_<%=spCART_Index+1%>" value="" />
<input type="hidden" name="os0_<%=spCART_Index+1%>" id="os0_<%=spCART_Index+1%>" value="" />
<input type="hidden" name="on1_<%=spCART_Index+1%>" id="on1_<%=spCART_Index+1%>" value="" />
<input type="hidden" name="os1_<%=spCART_Index+1%>" id="os1_<%=spCART_Index+1%>" value="" />
<% 'WA eCart Validation
else
spCART_Index = spCART_Index - 1
end if
%>
<%
set spCART = WA_eCart_MoveNext(spCART)
wend
set spCART = WA_eCart_MoveFirst(spCART)
%>

What parts of the above code do I need with the more simplified form I have listed in my original post above? For example...

What is the difference between <%spCART_Index = spCART.DisplayIndex - 2%> and <%spCART_Index = spCART_Index + 1%>?

What is WA eCart Validation?

What are the 4 new variables the wizard has created?:
on0_<%=spCART_Index+1%>
os0_<%=spCART_Index+1%>
on1_<%=spCART_Index+1%>
os1_<%=spCART_Index+1%>

I don't really like using the WebAssist wizards because, in the past, I've had nothing but trouble with them. I also don't like the fact that I can't select "none" for the CSS styling and, therefore, end up with a lot of redundant CSS code.

I'd appreciate any advice that could be offered, thanks.
Regards
Nath.

Sign in to reply to this post

Jason ByrnesWebAssist

I dint suggest to use the checkout wizard.

I suggested creating the checkout form only.


you can remove any of the form elements that code is creating that you dont want to use.

"What is the difference between <%spCART_Index = spCART.DisplayIndex - 2%> and <%spCART_Index = spCART_Index + 1%>?"

none. it's a different way to do the same thing.

the 4 new variables that are created are used for passing variable data to paypal, if you dont need them, then you can remove them.

Sign in to reply to this post

Nathon Jones Web Design

oops

Sorry Jason, I read your post as Checkout Form which is, in actual fact at:
Insert > WebAssist > eCart > Insert Checkout Form, not, Insert -> eCart -> Checkout Form. My mistake.

What is WA eCart Validation?

Appreciate your help, thanks.
Regards
Nath.

Sign in to reply to this post

Jason ByrnesWebAssist

i assume you are referring to this code:

<% 'WA eCart Validation
if ((WA_eCart_FormatNumber(WA_eCart_DisplayInfo(spCAR T, "Price") - ((WA_eCart_DisplayInfo(spCART, "Price")/WA_eCart_TotalColumn(spCART, "TotalPrice")) * WA_eCart_GetDiscounts(spCART)), false, 2) > 0)) then
%>


it's a check to make sure that the price and total price are valid.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...