NOP Discount Cart

Completed modifications to the NOP Shopping Cart. Additions, modifications, and more.

Moderators: Koibito, Stefko, Randy, Rosey

Postby paq1200 » Mon Mar 28, 2005 10:50 pm

When I use the nop discount cart with paypal the total after the discount is not passed. The total before the discount is passed. How can I change this?

Thanks
Mike
paq1200
 
Posts: 15
Joined: Sun Jan 16, 2005 9:22 pm
Location: Texas

Postby Stefko » Tue Mar 29, 2005 4:02 am

What fields are you passing to PayPal?

Are you passing the cart or the final total?

Got a URL to checkout your configuration?
KFL Technologies
Web-Enabled Solutions
e-Commerence Solutions
Stefko
Contributor / Guru
 
Posts: 833
Joined: Wed Sep 18, 2002 1:11 am
Location: Wichita, KS

Postby paq1200 » Wed Mar 30, 2005 1:19 pm

Here are the fields I am passing on the checkout:

<INPUT type=hidden value="_cart" name="cmd">
<INPUT type=hidden value="1" name="upload">
<INPUT type=hidden value="orders@bhgdistributors.com" name="business">
<INPUT type=hidden value="USD" name="currency_code">
<INPUT type=hidden value="http://www.yourdomain.com/orderfrm/thanx.htm" name="return">

<input type=submit Value="Submit Order"> <INPUT type=RESET value=" Clear Form ">


here is what i have in nop.js:
if ( PaymentProcessor == 'pp' ) {
//Process hidden values for PayPal.
strOutput += "<input type=hidden name=\"item_number_" + strFooter + "\" value=\"" + fields[0] + "\">";
strOutput += "<input type=hidden name=\"quantity_" + strFooter + "\" value=\"" + fields[1] + "\">";
strOutput += "<input type=hidden name=\"amount_" + strFooter + "\" value=\"" + fields[2] + "\">";
strOutput += "<input type=hidden name=\"item_name_" + strFooter + "\" value=\"" + fields[3] + "\">";
strOutput += "<input type=hidden name=\"shipping_" + strFooter + "\" value=\"" + fields[4] + "\">";
strOutput += "<input type=hidden name=\"on0_" + strFooter + "\" value=\"" + fields[5] + "\">";
if (i == iNumberOrdered) {
strOutput += "<input type=hidden name=\"shipping_" + strFooter + "\" value=\"" + fShipping + "\">";
}

Thanks
Mike
paq1200
 
Posts: 15
Joined: Sun Jan 16, 2005 9:22 pm
Location: Texas

Postby Stefko » Wed Mar 30, 2005 2:48 pm

The Discount Cart does the math after Subtotal is figured!
You are passing the correct amounts to PayPal, if PayPal cannot accept DISCONTS then you will need to discount he Product Cost before data is sent to them. This will discount the Product Price directly that is sent to PayPal.



Code: Select all
 if ( PaymentProcessor == 'pp' ) {
//Process hidden values for PayPal.
strOutput += "<input type=hidden name=\"item_number_" + strFooter + "\" value=\"" + fields[0] + "\">";
strOutput += "<input type=hidden name=\"quantity_" + strFooter + "\" value=\"" + fields[1] + "\">";
strOutput += "<input type=hidden name=\"amount_" + strFooter + "\" value=\"" + (fields[2]*.9) + "\">";
strOutput += "<input type=hidden name=\"item_name_" + strFooter + "\" value=\"" + fields[3] + "\">";
strOutput += "<input type=hidden name=\"shipping_" + strFooter + "\" value=\"" + fields[4] + "\">";
strOutput += "<input type=hidden name=\"on0_" + strFooter + "\" value=\"" + fields[5] + "\">";
if (i == iNumberOrdered) {
strOutput += "<input type=hidden name=\"shipping_" + strFooter + "\" value=\"" + fShipping + "\">";
}
KFL Technologies
Web-Enabled Solutions
e-Commerence Solutions
Stefko
Contributor / Guru
 
Posts: 833
Joined: Wed Sep 18, 2002 1:11 am
Location: Wichita, KS

Postby paq1200 » Wed Mar 30, 2005 8:50 pm

if I use (fields[2]*.9) I get an error:
The link you have used to enter the PayPal system contains an incorrectly formatted item amount.


If I use fields[2] the full price gets passed to paypal with no errors.

Done more testing and the only one that works is (fields[2]*.6) which actualy gives you a 40% discount.

not sure how to fix it.

Thanks
Mike
paq1200
 
Posts: 15
Joined: Sun Jan 16, 2005 9:22 pm
Location: Texas

Postby Stefko » Fri Apr 01, 2005 1:16 am

try this:

Code: Select all
 if ( PaymentProcessor == 'pp' ) {
//Process hidden values for PayPal.
strOutput += "<input type=hidden name=\"item_number_" + strFooter + "\" value=\"" + fields[0] + "\">";
strOutput += "<input type=hidden name=\"quantity_" + strFooter + "\" value=\"" + fields[1] + "\">";
ppitem = (fields[2] * .9) ;
strOutput += "<input type=hidden name=\"amount_" + strFooter + "\" value=\"" + ppitem + "\">";
strOutput += "<input type=hidden name=\"item_name_" + strFooter + "\" value=\"" + fields[3] + "\">";
strOutput += "<input type=hidden name=\"shipping_" + strFooter + "\" value=\"" + fields[4] + "\">";
strOutput += "<input type=hidden name=\"on0_" + strFooter + "\" value=\"" + fields[5] + "\">";
if (i == iNumberOrdered) {
strOutput += "<input type=hidden name=\"shipping_" + strFooter + "\" value=\"" + fShipping + "\">";
}
KFL Technologies
Web-Enabled Solutions
e-Commerence Solutions
Stefko
Contributor / Guru
 
Posts: 833
Joined: Wed Sep 18, 2002 1:11 am
Location: Wichita, KS

Postby pixclinic » Fri Apr 01, 2005 2:49 pm

maybe this can help: Paypal only accepts prices in the form of integers or 2 decimal numbers. One decimal numbers don't work. If your error is "amount sensitive", that might be the result of your calculation. Reformat your result in money format after the multiplication.
PIXCLINIC
< Web Design >
< eCommerce Photo Studio >
pixclinic
Guru
 
Posts: 88
Joined: Sun Mar 13, 2005 12:05 am
Location: Seattle

Postby Stefko » Fri Apr 01, 2005 5:31 pm

this snippet uses the moneyFormat!!



Code: Select all
if ( PaymentProcessor == 'pp' ) {
//Process hidden values for PayPal.
strOutput += "<input type=hidden name=\"item_number_" + strFooter + "\" value=\"" + fields[0] + "\">";
strOutput += "<input type=hidden name=\"quantity_" + strFooter + "\" value=\"" + fields[1] + "\">";
ppitem = (fields[2] * .9) ;
strOutput += "<input type=hidden name=\"amount_" + strFooter + "\" value=\"" + moneyFormat(ppitem) + "\">";
strOutput += "<input type=hidden name=\"item_name_" + strFooter + "\" value=\"" + fields[3] + "\">";
strOutput += "<input type=hidden name=\"shipping_" + strFooter + "\" value=\"" + fields[4] + "\">";
strOutput += "<input type=hidden name=\"on0_" + strFooter + "\" value=\"" + fields[5] + "\">";
if (i == iNumberOrdered) {
strOutput += "<input type=hidden name=\"shipping_" + strFooter + "\" value=\"" + fShipping + "\">";
}
KFL Technologies
Web-Enabled Solutions
e-Commerence Solutions
Stefko
Contributor / Guru
 
Posts: 833
Joined: Wed Sep 18, 2002 1:11 am
Location: Wichita, KS

Postby pixclinic » Fri Apr 01, 2005 6:01 pm

if fields[2] is in money format,

is

ppitem = (fields[2] * .9)

in money format too ?
PIXCLINIC
< Web Design >
< eCommerce Photo Studio >
pixclinic
Guru
 
Posts: 88
Joined: Sun Mar 13, 2005 12:05 am
Location: Seattle

Postby paq1200 » Fri Apr 01, 2005 6:50 pm

that works great. The only thing is that you have to put the opposite discount that you want.

if you want to have a 10 percent discount you have to put
ppitem = (fields[2] * .90) ;

and for some reason the total between nop cart and paypal are a couple of cents different.

Thanks
Mike
paq1200
 
Posts: 15
Joined: Sun Jan 16, 2005 9:22 pm
Location: Texas

Postby Stefko » Fri Apr 01, 2005 10:05 pm

Send me a URL so I see what and where, I'm sure I can fine tune it so both NOP and PP show the same amounts

NOP discounts the subtotal

PP is discounting each product purchased

that is were the difference of a few cent happens!
KFL Technologies
Web-Enabled Solutions
e-Commerence Solutions
Stefko
Contributor / Guru
 
Posts: 833
Joined: Wed Sep 18, 2002 1:11 am
Location: Wichita, KS

Postby Jardry » Mon Jan 02, 2006 2:06 am

For some reason I can't get the ManageCart function to display when using the Discount Cart straight from the zip file.

I've checked line by line my working nopcart.js and the discount nopcart.js. I haven't changed anything in my previously working managecart page, however when I revert back to my original nopcart.js managecart page works.

Here is my nopcart.js code:

Code: Select all
CODE REMOVED - Code not the problem


My nopcart.js does have the Custom Shipping http://www.nopdesign.com/forum/viewtopic.php?t=556 modification in it, but I wouldn't have thought removing it would have created the problem. I can't recall making any other changes tgo my nopcart.js.

The discount nopcart.js is the one obtained by downloading the zip file.

Can anyone identify why I can't implement the discount modification?

Your support is appreciated.
Last edited by Jardry on Mon Jan 02, 2006 4:04 am, edited 1 time in total.
-------------------------------

Regards


Gary O
Jardry
 
Posts: 14
Joined: Sat Oct 01, 2005 6:27 am

Postby Stefko » Mon Jan 02, 2006 3:19 am

If you post a test URL, I'll be able to say what it is for sure!

My best guess would be failing to add the additional vars to the language-en.js
KFL Technologies
Web-Enabled Solutions
e-Commerence Solutions
Stefko
Contributor / Guru
 
Posts: 833
Joined: Wed Sep 18, 2002 1:11 am
Location: Wichita, KS

Postby Jardry » Mon Jan 02, 2006 4:08 am

Stefko,

You were right. Thanks for the answer.

Now that I've got nopcart.js to display on managecart and checkout pages, I notice that the CHARGES are not showing before the discount is applied on those pages.

Here is my test url: http://www.neon.riverlandpages.com/temp.shtml

(I'm also trying to get image rollovers working for the buttons)
-------------------------------

Regards


Gary O
Jardry
 
Posts: 14
Joined: Sat Oct 01, 2005 6:27 am

Postby Jardry » Mon Jan 02, 2006 9:55 am

The following code displays the charges:

Code: Select all
   //---------ADDED-----------||
   if ( bDisplay ) {
     if ( fDiscount > 0 ) {
         strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=4><B>"+ OutputOrderPresub +"</B></TD>";
         strOutput += "<TD CLASS=\"noptotal\" COLSPAN=2 ALIGN=RIGHT><B>"+ MonetarySymbol + strPresub + "</B></TD></TR>";      
         strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=4><B>"+ DiscountRate +"%" + strSpace + strDIS +"</B></TD>";
         strOutput += "<TD CLASS=\"noptotal\" COLSPAN=2 ALIGN=RIGHT><FONT COLOR=RED><B>"+ strMINUS + MonetarySymbol + strDiscount + "</FONT></B></TD>";
         strOutput += "</TR>";

     }
     }
     //---------STOP ADDED-----------||
-------------------------------

Regards


Gary O
Jardry
 
Posts: 14
Joined: Sat Oct 01, 2005 6:27 am

PreviousNext

Return to Modifications

Who is online

Users browsing this forum: No registered users and 1 guest

cron