Simple Shopping Cart

I am trying to develop a simple shopping cart.
I have created an array of structures for this as follows.
<cfif not Isdefined("Session.ShoppingCart")>
<cfset SESSION.shoppingcart = ArrayNEW(1)>
</cfif>
<cfset additem = StructNew()>
<cfset additem.id = FORM.id>
<cfset additem.name = FORM.name>
<cfset additem.color = FORM.color>
<cfset arrayappend(session.shoppingcart, additem)>
I would like to delete a given entry in the array given a
particular FORM.id, say id = 220
Here is my code to try and delete the item
<cfloop from="1" to="#ArrayLen(SESSION.shoppingcart)#"
index="i">
<cfif SESSION.shoppingcart
.id eq FORM.id>
<cfset foo = structdelete(SESSION.shoppingcart,
id)>
<cfelse>
</cfif>
</cfloop>
This is not working. I guess perhaps I should delete the
array entry, but I can't figure out how to do this. Thanks in
advance. -Noah

Duh, I figured it out.
<cfset bar = arraydeleteat(SESSION.shoppingcart, i)>
I am having a problem when looping not sure why. I think
because I'm deleting an item in the array it tries to loop to that
index in the array. It will say "The element at position 3 cannot
be found". I guess I normally wouldn't have to delete multiple
positions in the array with a normal shopping cart unless they
selected two different id's. I'll work on a more advanced shopping
cart and post again.

Similar Messages

  • Develop simple shopping cart using ADDT

    Hi, I'm new here.I just wondering if its possible to develop a very simple shopping cart application using ADDT?Anyone have any ideas?
    I'm thinking to develop a very simple shopping cart with no shipping cost,tax details and all that.Just an image,description of the product and price.All the orders with be send to 1 or many emails.No payment gateway needed.That's it.And of course got basic common shopping cart features like 'Add to cart','Remove item',session, that's all.Any ideas guys?
    Thanks

    Duh, I figured it out.
    <cfset bar = arraydeleteat(SESSION.shoppingcart, i)>
    I am having a problem when looping not sure why. I think
    because I'm deleting an item in the array it tries to loop to that
    index in the array. It will say "The element at position 3 cannot
    be found". I guess I normally wouldn't have to delete multiple
    positions in the array with a normal shopping cart unless they
    selected two different id's. I'll work on a more advanced shopping
    cart and post again.

  • SImple... REALLY simple shopping cart.... order form with out payment gateway.... home delivery only

    Hi there me again......
    Yet another really interesting post.......
    I know that everyone is always asking for a shopping cart sollution for their web sites.... and I have looked into a few myself.... So then I discovered oscommerce WOW what an amazing thing all my problems answered....... well...... I wish is a great opensource shopping cart program.... really great but still cant fine tune it to how I want..... namely because I cannot edit it easily .... I have to get into the php code and change stuff...... CSS as well...... TOOOO much for me to take in.... I still struggling with DW and ADDT...... So.....
    In the end I still want to use DW to create my site and ADDT to control it......
    I decided that I wanted people who are looking at my site to be able to contact me directly ... on yahoo messenger and order whatever they liked..... not very professional I know but is a start..... but I stil want to have a functioning cart.... just an easy cart.....
    I could go the other way and just use an existing oscommerce template with the whole shopping cart and payment gateways set up..... but that's defies the point of learning how to do things myself..... and getting there is half the fun so...... I want to design my own sites with my own feel....
    So..... I found a site that has a simple shopping cart that works the same as all the other carts but has no paymant gateway..... only the products that you have added to your cart and a total at the bottom and a space to enter your address and phone number etc..
    So does anyone know how I can go about making such a simple cart....
    Or is there a program that can do it ..... or a DW extention......?
    Anyway any help or ideas would be great
    Have a nice day

    Hi sorry to answer my own post but I cam across the answer to my post
    I found a great tutorial an the interakt web site
    http://www.interaktonline.com/Documentation/MXKollection/#0916000_manage_m2m_rel.htm
    Seems to do everything I wanted and more....
    Have not completed it yet
    will see how it goes and maybe post results... maybe someone's interested
    Have a nice day

  • Hi, JSP Shopping Cart??

    Hi, i need to make a very simple shopping cart using JSP,
    Can anyone show me the way forward or does anyone have any sample coding for me to look at?
    I need it to be simple as all i want to do is send items to a shopping cart and then feed to a database...
    I can do the database bit... and i can list the items... but i dont have a clue how to store the items in a session... any help is appreciated

    You are falling into a trap here friend. You are trying to do it the easy way by asking for help, that is not going to help you at all because that gap of missing knowledge will stay, you want to fill it on your own. The only thing to do is sit down and put some idea's on paper, using well known techniques such as UML preferably, and keep thinking until you have something that you can work with. But you can use what you know. For example, you know how to store the information in a database, so you have a data structure. Is it so hard for you to translate that data structure into an object structure? I can image...
    1) a ShoppingCart class
    2) some kind of data storage inside it
    3) methods to store and retrieve the information
    the data storage will be the biggest problem. If it is very simple then a HashMap could even work, otherwise you will need to create some beans that can hold your data (or even a combination of a HashMap and beans). Most likely the beans will have attributes that directly match your database tables.
    when you have your ShoppingCart class with its logic to store and retrieve information, you can put that object in the session. I'm sure you can find a tutorial about using the session in java web environments, we are talking about the HttpSession object, that should get you started.

  • Need help on getting started with shopping cart!!

    hi guys,
    i want to build a fairly simple shopping cart with servlets and jsps.. can you please point me to a starting point.. a tutorial or a general road map for it.. i am pretty okay with servlets and jsps and currently using them for a web-app..
    any help would be greatly appreciated..thanks..

    go to http://www.moreservlets.com, download the free pdf book "Core Servlets and Java Server Pages", there is a example program on section 9.4 talks about shopping cart.
    Hope it helps.

  • Please help me to develop a shopping cart in java

    I want to develop a simple shopping cart application where a particulart owner can add the items, and the user have to select the item code and the quantity he needs. These are the things i need.
    Implement a shopping cart with following features.
    1. Create items with required attributes.
    2. Define shopping cart parameters
    3. define stock values
    4. Create an order
    5. add to cart
    6. Copy cart
    7. remove item from cart
    8. Check out
    9. Print history.
    i'm so cunfused. Please help me.

    /* This program will add the product code,name,and the price of the items
    import java.io.*;
    import java.util.*;
    public class AddingItems
         public String code,name;
         public static float price;
         LinkedList olist=null;
         public AddingItems(String code,String name,float price)
         this.code=code;
         this.name=name;
         this.price=price;
         public Object getUserInput()
         System.out.println();
         GetInput gi=new GetInput();
         int number=gi.getInteger(" Enter the number of items you want to add to the system : ");
         System.out.println();
         System.out.println();
         olist=new LinkedList(); //declaring the array length according to the user input
              for(int i=0;i<number;i++)
                   System.out.println(" **** Enter The Product Details *** ");
                   System.out.println();
                   GetInput gicode=new GetInput();
                   code=gicode.getString("\t Enter the product code : ");
                   GetInput giname=new GetInput();
                   name=giname.getString("\t Enter the name of the product :");
                   GetInput giprice=new GetInput();
                   price=giprice.getInteger("\t Enter the product price in Rs. :");
                   // creating an object of the AddingItems class
                   AddingItems items=new AddingItems(code,name,price);
                   // the value input from the user to the system is now assigned to the array created with the length given by the user
                   olist.add(items);
              return olist;
              public void display()
              System.out.println();
              System.out.println("\t\t\t*** These are the products in the system **** ");
              System.out.println();
              System.out.println("\t\t\t Product Code \t\t\t Product Name \t\t\t Price in Rs.");
              System.out.println();
              for(int i=0;i<olist.size();i++)
              AddingItems items=(AddingItems)olist.get(i);
              System.out.println("\t\t\t "+items.code+"\t\t\t\t "+items.name+"\t\t\t\t "+items.price);
              System.out.println();
              /*public void addItemsToCart()
              System.out.println();
              GetInput input=new GetInput();
              System.out.println();
              String selection=input.getString("Do you want to continue adding the products to your shopping cart ? [y]es,[N]o : ");
              System.out.println();
              switch(selection.charAt(0))
                   case 'y':
                   case 'Y':
                   System.out.println();
                   System.out.println("Enter the products and the quantities you want to add to your shopping cart :");
                   System.out.println("........................................................................... ");
                   LinkedList myList=null;
                   break;
                   case 'n':
                   case 'N':
                   System.out.println();
                   String message=" You are about to log off from the system: ";
                   System.out.println(message);
                   break;
                   default:
    public static void main(String[] args)
    AddingItems items=new AddingItems("code","name",price);
    //AddingItems[] additems=(AddingItems)items.getUserInput();
    items.getUserInput();
    items.display();
         /*GetInput input=new GetInput();
         System.out.println();
         String selection=input.getString("Do you want to continue adding the products to your shopping cart ? [Y]es,[N]o : ");
         System.out.println();
         switch(selection.charAt(0))
              case 'y':
              case 'Y':
              System.out.println();
              System.out.println(" Enter the code of the product and the quantity you want to add to the shopping cart ");
              String code=null;
              int quantity=0;
              double total=0.0;
              LinkedList myList=new LinkedList();
              GetInput itemc=new GetInput();
              String itemcc=itemc.getString();
              //GetInput list=new GetInput();
              Scanner sc=new Scanner(System.in);
              System.out.println(" .............. Enter the code and the quantity you wamt to add to your shopping cart");
              System.out.println();
              System.out.println();
              //while(sc.equals(item.code))
              Scanner c=nextString();
              //GetInput list=new GetInput();
              //AddingItems items=new AddingItems("code");
              //String listcode=list.getString("Enter the item code :");
              if(listcode==olist.contains(true))
              myList.add(listcode);     
              GetInput list2=new GetInput();
              //int listquantity=list2.getInteger("Enter the quantity :");
              //myList.add(listquantity);     
              System.out.println("Do you want to continue ");
              break;
              case 'n':
              case 'N':
              System.out.println();
              String message=" You are about to log off from the system: ";
              System.out.println(message);
              GetInput select=new GetInput();
              System.out.println();
              String need=select.getString("Do you want to proceed ? [o]k ,gnore : ");
              case 'o':
              case 'O':
              System.exit(1);
              break;
         default:
              //GetInput input=new GetInput();
         //code=
    this is i did using the linked list to add the items to the shopping cart but now i'm so stuck that i can't search for the product code where the user adds is there in the list which is added by the owner. pls help

  • JSF Shopping Cart

    Hi,
    I'm new to JSF and can somebody give me a link to a documentation which describes how to create a simple shopping cart? I only want adding/removing to and from the cart.
    I'm using eclipse with xhtml for development.
    Thanks in advance
    Shana

    shana10 wrote:
    Hi,
    Thanks for your info.
    I downloaded the tutorial bundle and unzipped it to my local drive and created a project with eclipse to run the source code. But the java files have lot of errors in it. Have I done anything not correct?
    Have you used the example bundle in the link you sent be before? Does it work?
    Thanks for your help.Most likely you are missing library dependencies.

  • I need  a simple example of shopping cart(newbie)

    Has any one come across a simple example of shopping cart and the process
    behind it i.e. from jsp to ejb. So far I have looked at the buybeans example
    and it still is not clear the approach that was used.
    I would be greatful for any assistance thank you
    Kenneth A-Adjei

    Take a look at:
    http://java.sun.com/docs/books/tutorial/servlets/overview/example.html
    "Ken Adjei" <[email protected]> wrote in message
    news:3960a901$[email protected]..
    Has any one come across a simple example of shopping cart and the process
    behind it i.e. from jsp to ejb. So far I have looked at the buybeansexample
    and it still is not clear the approach that was used.
    I would be greatful for any assistance thank you
    Kenneth A-Adjei

  • Shopping Cart/Wish List

    I have been a long time iTunes store shopper, and traditionally I've always looked forward to the updates, but one of the changes in the most recent version really irks me. I absolutely cannot stand the new wish list feature. In my opinion, it's a buggier, worse version of the shopping cart, and I seriously wish they would just bring the old one back.
    But, since that probably isn't going to happen, I have some questions in hopes of making the new "feature" a little easier to deal with:
    1) Is there any way to make the wish list sort by genre? It used to be really nice with the shopping cart when I could sort through whatever music I had in it by the kind of music I was in the mood for. This is one of many features which, as far as I can tell, is gone.
    2) Is there any way to make it so the wish-list page doesn't reset each time you buy a song? Every time I buy a song, the page refreshes back to the top of the page with all my previous sorting set back to default. This is HIGHLY annoying when I want to buy more than one song, and I have to re-search for the next one after buying the first.
    3) Is there any way to see all your wish-list music on one page rather than having to sort through the 4-5 pages I currently have?
    I really appreciate what Apple was trying to do with the Wish List, but unless I'm missing something, they took out more features than they added. Simple ones that make a big difference. I think they aimed it more for people who want to go through and pick a lot of music, and then buy it all at once. They took out a lot of what made large shopping carts easy and quick to navigate and buy from. I for one used the shopping cart more as a place to store all the music I EVENTUALLY wanted to buy rather than a more immediate place to chuck my upcoming purchases. Every time I saw a song on iTunes that I liked, regardless of my immediate intent of buying it, it went in the shopping cart. I may not get to it for months, but it would stay there, and I could get to it easily when I wanted to.
    I highly doubt I'm the only person who used it like that, and for those of us who did, I think the wish-list is a crappy alternative.

    Well after my post on this very issue was removed (because it was deemed more feedback than a question - which I'm fine with), it would likely have helped.
    As far as I can tell, there is only ONE WAY to get to your shopping cart, er, wish list.
    1) Login
    2) On the left bar (the section where your shopping cart used to be, along with your playlists), you have to click on iTunes Store. You'll see your Wish List in the Quick Links section...
    Thats it. Clicking anywhere else, like the 'Home' link or whatever, will not help you...if this is all too crazy, yeah, it is. I mean, making it difficult to purchase sounds really, um, crazy, particularly if you shop by shopping cart - which means you actually spend money on more music than "single buy". Ugh!
    On the other question on how to "Add to Wish List". In the section where songs are listed (with fixed sized columns that you can't adjust in this version - had to rub that in), you'll see a button to "BUY SONG". To the right of that text is an arrow (in the button, not another column) that if clicked gives you more options. One of them is to add to your wish list. Can't tell if the fixed sized columns are also affecting your view (maybe you're not seeing the entire button?).
    Message was edited by: EdSF

  • Process Improvement for Shopping Cart

    I would like to have the availability to contact customer service regarding a recommended process improvement for Verizon customers.  I have been a loyal Verizon since 2003, but my most recent experience is enough to drive me straight into the arms of T-Mobile and take them up on their offer to buy me out of all 6 contract agreements on my Verizon account.
    I recently attempted to upgrade my device online.  It was a relatively seamless process until I reached the end and got to the shopping cart.  I elected to pick my phone up in the nearest store but to do so you have to pay online with a credit or debit card.  You do not have the option to bill your account or pay in the store.  As it turns out, the billing zip code that is associated with your credit card MUST match the service address zip code on your Verizon account.  I am an identity theft victim and because of this all of my mail goes to a Post Office Box for security reasons.  I obviously do not live in a Post Office Box, so my service address will never match the zip code on my billing address.
    I am keenly aware that this is probably done for security reasons.  Verizon doesn't want people obtaining a compromised account and sending a phone just anywhere.  However, I was not opting to have anything shipped to me.  I was picking up in the store so it should not matter what my billing zip code is.
    The part that was most frustrating was the customer service individuals that I spoke with suggested things like (1) I should contact my bank and all of my bank statements and credit/debit card statements come to my house or (2) update my Verizon service address to the physical address of the Post Office even though I don't live there.  When I was told to do option 2 listed above, I was told I had to log out of my account for the change to take effect and then re-log back in only to lose my entire order.  All of this just to place an order and pick it up in a store.  All I needed to do was just pay for my phone.
    I next gave up and went in to the store.  After an hour of waiting and trying to figure out where the problem was, the Verizon store couldn't take the coupon code that the customer service person had given me online.  Translation - after all of this frustration with a dead-end result, I learned I was going to have to pay about $100 more for my phone.  I walked away.
    I went back online and the only option I had was to go back to square one and re-order online and this time, elect to have the phone shipped and billed to my account.  I chose overnight shipping and just learned that the phone was shipped UPS ground and will be delivered after 5 days.
    Needless to say, this has all been extremely disappointing and the most frustrating part is that it is all avoidable with a simple programming change.  All of this was totally unnecessary.  As an identity theft victim, I will NEVER have my mail delivered to the mailbox in my neighborhood.  Does Verizon really want to offer that as a suggestion for people who want to buy a phone?  Do they want to be responsible for the results?  With identity theft being the fastest growing crime in America, somehow I just don't see that as a viable solution.  There are many, many people just like me who don't have the same physical and billing addresses.
    Finally, I will leave you with this question... Have you ever had this much trouble placing an order and paying for that order online?  If I went to a store and purchased a phone in the store, would Verizon's payment processor care that the billing address on my credit card was different from the physical address where I live?  NO!  Companies are typically ready to take your money!  It shouldn't be this hard to just pay someone for a phone.
    If anyone can point me in the direction of how to make sure someone from Verizon Corporate is aware of this problem and that this is taken under consideration for future enhancements/changes to their eCommerce system it would be much appreciated.

    Hi,
      I think your process level evaluation id is not true, that is the reason system skips the process level.. Can you check your evaluation event-expression code. What do you see in SLG1?  For testing purpose change the evaluation id to 0EV000 and check. Make Sure you debug through the user(requester) that you are creating the SC. Please test and let me know...
    Saravanan

  • Print-out of shopping carts - add additional informations

    Hi SRM-experts,
    one simple question. Is it possible without modification to add in the print-out of the shopping cart additional informations such as the purchase order number. Is there a possibility to customize that function ? Thanks for yours replies.
    AW

    Hello,
    This will need small enhancement in the smatform. You will find it easy.
    Use T-Code SMARTFORMS and copy the standard smartform for SC layout "BBP_SC"  and create a Z-one and use that by implementing the BADI BBP_CHANGE_SF_SC.
    You can get the PO value from the table BBP_PDBEI.
    Hope this solves the issue.
    Thanks
    Ashu

  • Flash shopping cart..... Help Please

    Hi Guys,
    I Would like to add a shopping cart to my flash website. The
    current website is working with actionscript 2. selling 10+ items
    Anyone knows of a good tutorial, book, program or advise that
    would help me from start to finish? should i use xml or php? Any
    open source codes with instructions? what can i use to processes
    credit cards inside of flash?
    Really need the help, thanks

    quote:
    because of the questions you're asking, you should off-load
    the handling of secure transactions to a third party. paypal is the
    most well-known of these. check their website for details on how
    you can accept a variety of payments, including credit cards. it's
    relatively simple (compared to creating your own secure shopping
    cart).
    Thank you kglad, What would u recommend i do for the coding
    of the shopping cart before the total amount is sent to a 3rd
    party? Like the add to cart, remove from cart, total etc.

  • Verify page in shopping cart?

    Hi - I'd like to add a verify page to the checkout process where a customer can review, edit and verify their purchase information before clicking 'submit'. Does anyone know how to do this?
    Thanks

    I'm guessing you want a page with all the infomation, including their shipping details, names, address etc, plus the shopping cart info and a big confirm button sort of deal. You can do it two ways.
    1. Client side with a "confirm page" that is generated via javascript, basically you are switching out the content of the page.
    Pro's: Easier to implement, total client side.
    Con's: Simple solution, but sometimes that is all you need.
    Example:
    http://jsfiddle.net/AMjkN/
    take from:
    http://forums.adobe.com/message/5612324#5612324
    2. Creating your own checkout using the API.
    Pro's you can control everything with regards to the checkout process and easier intergration with other systems you might have in place.
    Con's: More of an enterprise solution. Requires external hosting and has monthly fees (hosting) plus inital development costs.

  • Adding existent (not custom!) fields to shipping adress in shopping cart

    Hey community,
    we want to show some more shipping adress fields in the shopping cart (SRM 7.13).
    Quite simple, we thought... only the existent fields "NAME_3" and "NAME_4" should be displayed. But we were not able to do that.
    We tried the following steps:
    - in the WD component /SAPSRM/WDC_UI_DO_SHIPTO view V_DODC_SHIPTO we added the existent attributes NAME_3 and NAME_4 from structure /SAPSRM/S_CLL_SHIPTO to the context node SHIP_TO.
    - we added corresponding labels and input fields to the layout and bind them to the context attributes.
    But the two new fields are not displayed in the shopping cart. Normally, we have to announce new fields and metadata in SPRO - SAP Supplier Relationship Management - SRM Server - Cross-Application Basic Settings - Extensions and Field Control (Personalization)... to extend the structure of customer enhancement for the shopping cart. But there is no chance to maintain fields for shipping adress, because this is neigther header nor item data. Adding them to the INCL_EWW_PD_ITEM_CST_SC structure will display the fields on the positiondata tab.
    Adding fields to the table view "/sapsrm/v_mdfsbc" also doesn't work.
    Any ideas?
    Thanks in advance,
      Steffi

    Hello Werner,
    check in V_DODC_SHIPTO view from /SAPSRM/WDC_UI_DO_SHIPTO Web Dynpro Component if field exists in layout.
    In SRM 7.0, 'NAME_3' is not used. Maybe it is the reason of your problem...
    Regards.
    Laurent.

  • Custom field display as a checkbox in SRM - Shopping Cart

    Hi Friends,
    I added a new field on SRM Screen.
    Field details are as follows
    Field Name : ZZPCARD_ORDER
    Domain     : char_x (<b>Checkbox</b>)
    When I see BASIC DATA screen on Shopping Cart, I am getting this field as a simple character field but <b>NOT</b> as a <b>CHECKBOX</b>. Can anyone help me to display this as CHECKBOX ? FYI,I have tried with different data elements / domain available as checkbox. Customer fields are displayed dynamically in subscreen so it is bit difficult to find field attributes.
    Thanks and Warm Regards.
    Pras Durafe

    Hi
    Pls refer to the following thread for more details
    Custom fields not display in SRM5.5 Basic Data Frame
    Hope it helps.
    Pls reward suitable points.
    Regards
    - Atul

Maybe you are looking for

  • Can't get back to my mac to work

    I am guessing that this problem belongs somewhere in the server section. I am very crossed about this, as I have been calling apple support twice, they told me to chip on all the remote functions in sharing, and since remote management chips off scre

  • How to attach a logo to a selection screen?

    I needed to show the logo on the selection screen of a report. So I went through several postings on this topic, created and uploaded the logo via OAER against the PICTURES object. Per the posting, it tells to pass the value C:\logo.gif' as the url I

  • CANT READ ITUNES GIFTCARD NUMBER!! PLEASE HELP!!

    THE NUMBER ON MY ITUNES CARD IS ILLEGIBLE!! I NEEED HELP! I TYPED IN ALL THAT I COULD READ, AND I ENTERED THE SERIAL NUMBER...AND FOR SOME REASON THE SERIAL NUMBER ISNT CORRECT!! !

  • Adobe Library Elements in Web Dynpro

    Hi, I cannot see the Web Dynpro tab elements under the library palette, even though I have defined the check and submit actions for the interactive form. My NWDS is SP12, and Adobe Reader is 7.0.5. Can anyone point me in the right direction? Thanks,

  • Business Objects Planning Database Upgrade

    I have attempting to upgrade Business Objects Planning from version 11.2 to 11.6.  The upgrade appears to run successfully, however, when I attempt to start the Planning Application Services, the service fails to start up, stating the current DB vers