-
Senior Member
its no problem..and really not hard... a 'key' piece of sending & loading data (like text or variables for example)..is using a loadVar Object. there is a link in my footer that explains how to create & use a loadVar Object (the link is called varObject)..
its only a few lines of code..and once you read it it will be clear on hwo to use it.
3 basic steps.
1.) create/define the new varObject (name it)
2.) tell it what to do ONCE the data 'is' loaded...
3.) finally make the call to the 'data'..(so if it loads correctly..do #2 above)
once you understand that..you use it for PayPal..
-
Flash and PayPal
Check out my Flash Shopping Cart and PayPal system.
This URL has been considered spam.
Enjoy.
Last edited by gerbick; 07-26-2006 at 03:34 PM.
Reason: Spammy spam spam...
-
Wow. Superb!
I don't suppose you feel like sharing the source do you?
-
Senior Member
you have all the resources here do make your own...
granted I didnt really check it out in depth...but I dont see could be unique to any other one.
And hes trying to sell it... (so I doubt source code will be free)
-
Wait, I thought this was a "flash help" forum, not free advertising space...
Well then, that's the sort of "flash help" I'd rather do without
And resources are only beneficial to people who have the tools to make use of them.
(Like a knowledge of actionscript, which I myself do not possess :P )
-
Flashmatics
you can download my flash-paypal shopping cart from my library..hope it helps..
-
Dude zain, dog's bollocks! Thank you a thousand times for your contribution to the flash community. It really gives me something to get my hands into, and see how the mechanics of the whole process work. Of course, I'm going to be modifying it quite a bit, but I'll be sure to give credit where credit is due.
Cheers
Last edited by relicpro; 07-13-2006 at 11:36 AM.
-
We're going to provide screenshots, video f.a.q., and a user forum up in the next two weeks.
FYI: You only have to change the variables "price, product name, and an image" to begin selling/using this FlashCart.
BTW: Nice drag n drop FlashMatics.
-
Flashmatics
yw guys glad i could help
-
Hey, I have been trying to create a flash cart now for a few weeks, it is so hard! I tried to download your one silentweed from your library, but it wont open in my flash!
Is there something wrong with the link?
-
Senior Member
what version of Flash are you using?? and whats the error your getting..
-
It says something like this:
Failed to open document.MacintoshHDesktop:Shoppingcart
I am using Flash MX 6.0
-
Senior Member
-
-
Is the file corrupt? Can anyone email it to me? candy@candyxcarousel dot com
-
Originally Posted by marshdabeachy
Okay, here's the function I have. Bear in mind that this is being handled the way I'm storing records internally within Flash; you'll very likely have to loop through your cart differently.
Code:
function checkout() {
checkMC = new LoadVars();
checkMC.rand = random(99999);
checkMC.cmd = "_cart";
checkMC.upload = "1";
checkMC.business = "sendto@email.com";
checkMC.currency_code = "USD";
checkMC.amount = total.text.substr(1, total.text.length-1); //amount in decimal (eg 32.45)
for (var i = 0; i<cartRef.records.length; i++) {
var num = i+1;
checkMC["item_name_"+num] = cartRef.records[ i].part; // part name
checkMC["quantity_"+num] = cartRef.records[ i].quantity; // part quantity
checkMC["amount_"+num] = cartRef.records[ i].price; // part price
checkMC["on0_"+num] = "Unit price: $"+cartRef.records[ i].price; // optional field 1
checkMC["on1_"+num] = "Count: "+cartRef.records[ i].count; // optional field 2
}
checkMC.send("https://www.paypal.com/cgi-bin/webscr", "_blank", "POST");
}
Basically, item_name_X, quantity_X, and amount_X are the important things for each item. X must start at 1 and increase sequentially.
I appreciate the code below. Helped alot. But now I have a question. While the customer is on my website and adding products to the cart, I am obviously saving the data. Once the customer clicks on "CheckOut", I have the data sent to Paypal (no problem), however, I want to know when and how do I ClearOut the cart Locally on my website? The only way I would want to clear my Local Cart, is if the customer successfully purchased my product. Is there a return code that Paypal sends back to my site stating that the customer successful purchased my product, which in turn, I would clear the cart on my site?
I don't want to clear the customers cart unless they went through all the motions of buying the product. Any ideas?? Thanks!
-
Senior Member
Are you using the regular PayPal option? Or are you using the PayPal Pro that is now available?
if you want a return, or check out without leaving yoru site..you need to use Pro.. otherwise.. I believe in standard mode you can give a return URL to go to after check out.. however I doubt you'll be able to keep the users data locally and clear this way.
-
I don't know yet since I have not upgraded my account to a business account. I haven't purchased a domain yet... therefore everything is being done locally on my PC. In any case, how would I specify the code for the return URL?
would it be something like...
checkMC.return = "http://www.mywebsite.com/successCOut.html"
and send this to PayPal along with all my other LoadVars?
Thanks!
-
Senior Member
you'll have to check paypal site and go over the parameters you can send.. one of the is the return URL.. Im not sure what it is off the top of my head.
-
I've read this whole thread and checked out a ton of sites only to discover this is NOT an easy thing for the newbie. There are really no simple tutorials out there.
Nevertheless, I downloaded silentweed's fla from his site entitled "Flash/Paypal Shopping Cart". Here's the URL: http://www.experiments.flashmatics.co.uk/#
It's very easy to plug into my own site and change images and such, but I want to change some of the functionality. Rather than drag the product icon onto the basket I want users to click a "buy now" button of my own creation and have the same effect. (Table is populated with info.) I'm guessing this is quite easy for someone who knows their way aroung actionscript. He's made it pretty clear as to what parts are for the drag function, but after removing those I don't know what to ADD to create the desired functionality. Take a look at his file- here's the script:
//------------------------------------- CUSTOMISE THE FOLLOWING -------------------------//
var lvSend:LoadVars = new LoadVars();//do not change
lvSend.business = "email@email.com"; //your paypal email address here
lvSend.currency_code = "USD"; //the currency you would like to use
//define items, their prices, quantity in basket and there associated movieclips
var aItem:Array = new Array();
aItem["book"] = {instance:mcBook, price:15, quantity:0};
aItem["clapper"] = {instance:mcClapper, price:58, quantity:0};
aItem["drum"] = {instance:mcDrum, price:22, quantity:0};
aItem["shield"] = {instance:mcShield, price:13, quantity:0};
aItem["feather"] = {instance:mcFeather, price:2, quantity:0};
//-----------------------DO NOT CHANGE UNLESS FAMILIAR WITH ACTIONSCRIPT--------------------//
var totalPrice:Number;
//define drag and drop functionality
for (var i in aItem) {
var currentProduct:String = i;
aItem[i].instance.id = currentProduct;
aItem[i].instance.onPress = function() {
this.swapDepths(_root.getNextHighestDepth());
this.origX = this._x;
this.origY = this._y;
this.startDrag();
};
aItem[i].instance.onRelease = function() {
this.stopDrag();
if (checkDropLocation(this)) {
//it has been added to basket so increase quantity in basket
aItem[this.id].quantity++;
//update datagrid
updateDatagrid();
//also send it back to its original position and fade it in
this._alpha = 0;
reposition(this);
fadeIn(this);
//let user know it has been added to basket
} else {
//not in basket so send it back to its original position
reposition(this);
}
};
aItem[i].instance.onReleaseOutside = aItem[i].instance.onRelease;
}
mcPaypal.onRelease = function():Void{
//send variables to paypal
//CONSTANTS
lvSend.cmd = "_cart";
lvSend.upload = "1";
var j:Number = 1;
for (var i in aItem) {
if(aItem[i].quantity > 0){
lvSend["item_name_"+j] = aItem[i].instance.id;
lvSend["amount_"+j] = aItem[i].price;
lvSend["quantity_"+j] = aItem[i].quantity;
j++;
}
}
lvSend.send("https://www.paypal.com/cgi-bin/webscr", "_self", "POST");
}
//--------------------------------------- functions ----------------------------------------------//
function checkDropLocation(movie:MovieClip):Boolean {
if (movie.hitTest(mcBasket)) {
return true;
}
return false;
}
function reposition(movie:MovieClip):Void{
movie._x = movie.origX;
movie._y = movie.origY;
}
function fadeIn(movie:MovieClip):Void{
movie.onEnterFrame = function():Void{
this._alpha +=10 ;
if(this._alpha == 100){
delete this.onEnterFrame;
}
}
}
function updateDatagrid():Void{
totalPrice = 0;
var aBasket:Array = new Array();
for (var i in aItem) {
if(aItem[i].quantity > 0 ){
aBasket.push({Product: aItem[i].instance.id, Quantity: aItem[i].quantity, Price: aItem[i].price * aItem[i].quantity });
totalPrice += aItem[i].quantity * aItem[i].price;
}
}
basketInfo.dataProvider = aBasket;
basketInfo.vScrollPolicy = "auto";
tTotal.text = totalPrice;
}
THANKS!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|