Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Regular Coder
    Join Date
    Feb 2005
    Posts
    136
    Thanks
    0
    Thanked 0 Times in 0 Posts

    shopping cart remove item - compare

    I am using the webforcecart.com shopping cart.

    The items that I add to the cart can be the same item with different variables. For example, T-Shirt can come in blue, red, white. So, if buy a blue one and a red one, the cart will display them seperately (normal functionality of a shopping cart).

    My problem is that when I am removing items from the cart, I am identifying them in the array by their ID... so when I remove one, it's actually removing all occurances of that ID (so both the blue and red one get removed, even though I only wanted to remove the red one). That's the basics, there are actually 6 different item options that come into play.

    line1, line2, line3, line4, font_style, icon --- they are stored in an array called $iteminfo.

    So, I need the cart to remove only the item where the product i tell it to remove matches those 6 options.

    The current delete function is this:
    PHP Code:
        function del_item($itemid){ // removes an item from cart
            
    $ti = array();
            
    $this->itemqtys[$itemid] = 0;
            foreach(
    $this->items as $item){
                if(
    $item != $itemid){
                    
    $ti[] = $item;
                }
            }
            
    $this->items $ti;
            
    $this->_update_total();
        } 
    //end of del_item 
    All the product info is being stored in these arrays:
    PHP Code:
        var $total 0;
        var 
    $itemcount 0;
        var 
    $items = array();
            var 
    $itemprices = array();
            var 
    $itemnames = array();
        var 
    $itemqtys = array();
            var 
    $iteminfo = array(); 
    I'm trying to extend the functionality of webforcecart (http://webforcecart.com/). I think if I can figure out how to complete the delete function to work the way I need it, I can figure out the other functions for updating the cart.

    Thanks for any input or help you can provide.
    Last edited by bphein1980; 07-08-2007 at 12:06 AM. Reason: rewording the problem because of no response

  • #2
    New to the CF scene
    Join Date
    Jan 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi - I am doing practically the same thing with clothes sizes, colours using the webforce class, did you find a solution in the end?

    I'm half way there with it, passes an array with the colour, size to the $cart->add_item function fine, just need to work out the best way to show multiple products which come from the same product_id they just have different selected attributes such as Colour, Size etc..

    Thanks in advance any help would be appreicated

  • #3
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    To be honest the class is very outdated now. You should consider creating your own class based upon the wfcart class
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)

  • #4
    New to the CF scene
    Join Date
    Jan 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by JAY6390 View Post
    To be honest the class is very outdated now. You should consider creating your own class based upon the wfcart class
    It is an old one, I was hoping somebody else might have already done this already :-)

    Oh well, looks like I will just have to do like you say and rewrite this from scratch based on the original wfcart code - wish me luck :P

    Thanks anyway :-)

  • #5
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    Other than add, remove and edit methods, I don't really see what you would need tbh. I'd start the whole thing from scratch again
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)

  • #6
    New to the CF scene
    Join Date
    Jan 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm just gonna use wfCart as a guide, rather than write the 'new' cart based on that, touch wood it goes well either way it will be a new learning experience for me

  • #7
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    Yup. Any difficulties you can always post back
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)

  • #8
    New to the CF scene
    Join Date
    Jan 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Cheers will do! Nice Pagination Class by they way! I could see myself using that in the future soon too!

  • #9
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    Thanks. I don't even paginate results all that often, but when I do it takes 2 mins
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)

  • #10
    New to the CF scene
    Join Date
    Jan 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Shopping cart - all done! Your comments inspired me to rewrite it and it does the job now.. will make a mini tutorial for this at some point for others to use/learn from.

    Had another look at the pagination script - looks really good! Might try to implement this into one of my personal projects


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •