Jump to content


Photo

? for Ron (simple cart)


  • This topic is locked This topic is locked
8 replies to this topic

#1 GRS

GRS

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 06 April 2006 - 07:31 PM

Hi Ron,
Thanks so much for your truly invaluable and prolific info. regarding myriad workarounds and alternatives to "the generic PayPal cart"!
Like many, I'm an HTML & JS illiterate.
I have succeeded, however, in installing and personalizing your (simple) client side cart
on my GoLive CS site, (largely by pasting the whole works into my page, and then going through and removing the nonessential and modfying the rest-the "reductive method", one might say.
Only thing I haven't been able to accomplish is to modify the shipping values to simply
apply a flat rate of $3.95 to the entire cart regardless of # of items.
I'm guessing it should be quite simple, and would be quite grateful if you could advise of what changes (HTML and/or Java) would be required to acheive this.
Thanks again for your efforts!
GRS

#2 ron

ron

    Advanced Member

  • Members
  • 2,003 posts

Posted 07 April 2006 - 09:49 AM

GRS,

That is done by making a single into the set.js file to activate global shipping costs...

SetAmtSH (0, 0.01,3.95);

If the total of the items in Product Categotry zero is 1 penny or greater, then charge 3.95 for shipping.

Ron.

#3 GRS

GRS

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 08 April 2006 - 04:36 AM

Hi Ron,
Thanks for your reply/info.
I'm not sure whether it was clear from my first post that I'm working with the simplest cart
(concatinating selects) with only two drop-downs (design & size) and the quan. and price
boxes. All these elements are functioning perfectly, but, for reasons that will probably be obvious to you from the code (below) a shipping charge of $3.95 is added, in the PayPal checkout, for each change in size and/or design selection.
I have searched the js code (below) for a point of insertion for the " SetAmtSH (0, 0.01,3.95); ", but haven't been able to find one. I'm wondering if, perhaps, this is not the right place for this fix. I repeat...I am illiterate!
If you have the time to have a look at the copied js & html (below), and the charitable inclination to let me know how to modify them to assign the flat rate of $3.95 to any/all items in the cart, I would be extremely grateful!
Thanks again & best wishes,
GRS

The Java Scrpt:
<script type="text/javascript"><!--
function Dollar (val) { // force to valid dollar amount
var str,pos,rnd=0;
if (val < .995) rnd = 1; // for old Netscape browsers
str = escape (val*1.0 + 0.005001 + rnd); // float, round, escape
pos = str.indexOf (".");
if (pos > 0) str = str.substring (rnd, pos + 3);
return str;
}

function ReadForm (obj1) { // process selects
var i,j,amt=0,des="",obj,pos,tok,val;
var ary = new Array ();
if (obj1.baseamt) amt = obj1.baseamt.value*1.0; // base amount
if (obj1.basedes) des = obj1.basedes.value; // base description
for (i=0; i<obj1.length; i++) { // run entire form
obj = obj1.elements[i]; // a form element
if (obj.type == "select-one") { // just get selects
if (obj.name == "quantity" || // don't mess with these
obj.name == "amount") continue;
pos = obj.selectedIndex; // which option selected
val = obj.options[pos].value; // selected value
ary = val.split (" "); // break apart
for (j=0; j<ary.length; j++) { // look at all items
// first we do single character tokens...
if (ary[j].length < 2) continue;
tok = ary[j].substring (0,1); // first character
val = ary[j].substring (1); // get data
if (tok == "@") amt = val * 1.0;
if (tok == "+") amt = amt + val*1.0;
if (tok == "%") amt = amt + (amt * val/100.0);
if (tok == "#") { // record item number
if (obj1.item_number) obj1.item_number.value = val;
ary[j] = ""; // zap this array element
}
// Now we do 3-character tokens...
if (ary[j].length < 4) continue;
tok = ary[j].substring (0,3); // first 3 chars
val = ary[j].substring (3); // get data

if (tok == "s1=") { // value for shipping
if (obj1.shipping) obj1.shipping.value = val;
ary[j] = ""; // clear it out
}
if (tok == "s2=") { // value for shipping2
if (obj1.shipping2) obj1.shipping2.value = val;
ary[j] = ""; // clear it out
}
}
val = ary.join (" "); // rebuild val with what's left

if (obj.name == "on0" || // let these go where they want
obj.name == "os0" ||
obj.name == "on1" ||
obj.name == "os1") continue;

if (des.length == 0) des = val;
else des = des + ", " + val;
}
}
// Now summarize stuff we just processed, above
obj1.item_name.value = des;
obj1.amount.value = Dollar (amt);
if (obj1.tot) obj1.tot.value = "$" + Dollar (amt);
}
//-->
</script>

</head>

The HTML:
onsubmit="this.target = 'paypal';
ReadForm (this);">
<p><input type="hidden" name="cmd" value="_cart" /><input type="hidden" name="add" value="1" /><input type="hidden" name="business" value="triggerfish@reef-rainforest.com" /><input type="hidden" name="item_name" value="" /><input type="hidden" name="amount" value="" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="lc" value="US" /><input type="hidden" name="shipping" value="3.95" /><input type="hidden" name="shipping2" value="0" /><input type="hidden" name="baseamt" value="25.00" /><input type="hidden" name="on0" value="" /><input type="hidden" name="os0" value="" /><input type="hidden" name="on1" value="" /><input type="hidden" name="os1" value="" /><input type="hidden" name="item_number" value="" /><br />

<select onchange = "ReadForm (this.form);">
<option value="Wolf Trio ">Wolf Trio </option>
<option value="Coniferous Forest">Coniferous Forest</option>
<option value="Wolf">Wolf </option>
</select><select onchange="ReadForm (this.form);">
<option value="Sml. Adult @25.00">Sml. Adult $25</option>
<option value="Med. Adult @25.00">Med. Adult $25</option>
<option value="Lrg. Adult @25.00">Lrg. Adult $25</option>
<option value="XLrg. Adult @25.00">XLrg. Adult $25</option>
<option value="2XLrg. Adult @26.00">2XLrg. Adult $26</option>
<option value="Sml. Youth @18.00">Sml. Youth $18</option>
<option value="Med. Youth @18.00">Med. Youth $18</option>
<option value="Lrg. Youth @18.00">Lrg. Youth $18</option>
</select> <br />

<input type="text" name="quantity" size="3" value="1" />  <input class="nbor" type="text" name="tot" size="8" value="$25.00" /></p>
<input type="image" src="../../web-content/pages/add.jpg" name="submit" alt="cart add" /><a href="(EmptyReference!)"> <input type="image" src="../../web-content/pages/view.jpg" alt="cart view" onclick="document.forms.viewcart.target = 'paypal'; document.forms.viewcart.submit (); return false;" /></a>
</form>
</div>



#4 ron

ron

    Advanced Member

  • Members
  • 2,003 posts

Posted 08 April 2006 - 06:22 AM

OK, I think I understand, now...

1. Take all references to shipping out of your form (shupping and shipping2).

2. Go to your preferences in PayPal and uncheck the box that says to allow shipping overrides.

3. Go to the PayPal shipping by dollar amount chart and set every category to 3.95.

Ron.

#5 GRS

GRS

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 08 April 2006 - 08:23 PM

Ron,
Thanks for your reply.
The changing of PayPal shipping preferences would be a very simple fix. indeed, however, I am already using that set of shipping preferences for some other pages on my site.
That is why I had hoped to set up the override (for $3.95-entire cart) on the page(s) using
your "simpler cart", which, of course necessitates enabling override in my shipping preferences.
As things now stand, all the select functions in your cart are working perfectly, and it is also successfully overriding my shipping preferences, but is adding the $3.95 shipping
for each selection (instead of for the entire cart).
I'm thinking there's gotta be a way (hopefully simple) to set it up to apply the flat $3.95 shipping to the entire cart...Right?
Thanks and best wishes,
GRS

#6 ron

ron

    Advanced Member

  • Members
  • 2,003 posts

Posted 09 April 2006 - 06:20 AM

GRS,

I'll try one more - ad this line to every item in the cart (and take out shipping and shipping2)...

<input type="hidden" name="handling_cart" value="3.95" />

Ron.

#7 GRS

GRS

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 09 April 2006 - 07:00 PM

Hi Ron,
Still not working...whacky shipping charges that I can't figure, involving totals that, in some cases, are not evenly divisible by "$3.95"??!
My (albeit COMPLETELY UNEDUCATED) guess is that there may be something still in the java script in the <head> that may be mucking things up.
At any rate, I was led, by the comparative ease and efficiency with which every other function of the cart was performing, to the, apparently, mistaken assumption that it would be a simple matter to apply a flat rate shipping cost to the entire cart! Oh well.
Anyway, if, without wracking your brain, you can see an adjustment that should make it work, I would be extremely grateful to hear from you!
Otherwise, if you anticipate the need to "wrack your brain" in order to get this working, please don't hesitate to to contact me at "reefscene@yahoo.com" so we can discuss the best way (and the cost for your services), to acheive success.
Thanks again for your consideration! Ilook forward to hearing from you.
Best wishes,
GRS

#8 GRS

GRS

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 09 April 2006 - 09:59 PM

Hi Ron,
EUREKA! Sometimes "OCD" eventually acheives the goal.
Just couldn't stop fiddling with this, and I finally found a way to assign the flat rate ($3.95) to the entire cart by copying the html from a modified override PayPal add to cart button that I've been using on another product page on our site.
For anyone who may care, the modification-

<input type="hidden" name="shipping" value="0.00">
<input type="hidden" name="shipping2" value="0.00">
<input type="hidden" name="handling_cart" value="3.95">)

-appears, in its context, below:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" onsubmit="this.target = 'paypal'; ReadForm (this);">
<p><input type="hidden" name="cmd" value="_cart" /><input type="hidden" name="add" value="1" /><input type="hidden" name="business" value="triggerfish@reef-rainforest.com" /><input type="hidden" name="item_name" value="" /><input type="hidden" name="amount" value="" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="lc" value="US" /><input type="hidden" name="shipping" value="0.00">
<input type="hidden" name="shipping2" value="0.00">
<input type="hidden" name="handling_cart" value="3.95"><input type="hidden" name="baseamt" value="25.00" /><input type="hidden" name="on0" value="" /><input type="hidden" name="os0" value="" /><input type="hidden" name="on1" value="" /><input type="hidden" name="os1" value="" /><input type="hidden" name="item_number" value="" /><br />
<img src="../../web-content/pages/select-design.jpg" alt="" height="20" width="145" border="0"/><select onchange="ReadForm (this.form);">
<option value="Wolf Trio ">Wolf Trio</option>
<option value="Coniferous Forest">Coniferous Forest</option>
<option value="Wolf">Wolf</option>
</select><img src="../../web-content/pages/ship-button.jpg" alt="" height="23" width="89" border="0"/><select onchange="ReadForm (this.form);">
<option value="Sml. Adult @25.00">Sml. Adult $25</option>
<option value="Med. Adult @25.00">Med. Adult $25</option>
<option value="Lrg. Adult @25.00">Lrg. Adult $25</option>
<option value="XLrg. Adult @25.00">XLrg. Adult $25</option>
<option value="2XLrg. Adult @26.00">2XLrg. Adult $26</option>
<option value="Sml. Youth @18.00">Sml. Youth $18</option>
<option value="Med. Youth @18.00">Med. Youth $18</option>
<option value="Lrg. Youth @18.00">Lrg. Youth $18</option>
</select> <br />
<input type="text" name="quantity" size="3" value="1" />  <input class="nbor" type="text" name="tot" size="8" value="$25.00" /></p>
<input type="image" src="../../web-content/pages/add.jpg" name="submit" alt="cart add" /><a href="(EmptyReference!)"><input type="image" src="../../web-content/pages/view.jpg" alt="cart view" onclick="document.forms.viewcart.target = 'paypal'; document.forms.viewcart.submit (); return false;" /></a>
</form>

Phew!
It did seem like it should be easy, and it is (with the right code!).
I thank you, again, for your patience and perserverence, and for a much needed cart to expand the frustrating limts of the "PayPal generic".
I'm sure I'll probably be pestering you again with some issue. Perhaps you should consider
a "hidden" incognito identity!
Meanwhile...Have Fun & best wishes,
GRS

#9 scrtadmr8

scrtadmr8

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 01 October 2007 - 10:19 PM

Hi Ron,

Quote> I have succeeded, however, in installing and personalizing YOUR
Quote > (simple) client side cart
Quote > on my GoLive CS site,

From above post and above quote, I concluded that Ron has a simple cart. If there is such a cart, can someone please tell where is the link?

I am looking for a PHP GNU/GPL Db(mysql) simple shopping cart with IPN paypal interface. I have been searching for quite a while and I found one simple cart with paypal toolkit v.50 and while researching interface, I discovered v.51 overcomes some security issues. While researching, I also discovered this informative site. Any and all cart info welcome. Appreciate a comparison for SIMPLE cart Tx.

No AFCommerce tx
NO SunShop Tx
Saw os, virtual/virtue cart, zen cart. No tx.

Just a very simple cart to sell 2 items to support site.
Provide delivery info with $3.USD paypal payment. Max 5 items sale to emphasize simplicity rather than donate to support site. Viewer can select any combination of items. Site for a good cause.
The first cart I research was in web development text but installing paypal interface led me to research for cart with paypal. How much for installing paypal interface to cart?





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users