Jump to content

Taven

Members
  • Content count

    17
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    Katie
  1. Taven

    One Page Checkout Support

    @steve: Thanks! I'll give that a shot. Everyone keeps saying this mod isn't ready for use... so I have to ask, What all is wrong with it? The only bug I've experienced is the Update problem, but that's not even an issue now. I understand there's a bug where items can be bought that are out of stock, but is that it? And that it doesn't work with a few other contributions? I really want to use this mod. ;)
  2. Taven

    One Page Checkout Support

    Strangely enough I'm not having this bug- unless you mean that if the product goes out of stock it is never removed from the basket and can be bought. As all of my products never go out of stock, I'll never have this problem, I think. I am thinking of removing the cart at the top as you suggested, simply because it seems to be causing too much trouble right now. I have about 2-3 weeks before my store goes live, so I'm not in a panic yet and I'm thinking if I keep working on the bugs they can be solved by then. :) Strangely enough this doesn't work for me. While qty is now an Array, I don't think it contains anything and id is still NULL no matter what I do. Perhaps you could take a look at this since you seem to really know your stuff- When outputting the raw query ajax data below: data: $('input', $('#shoppingCart')).serialize(), Using this line to debug it: errorMsg: $('input', $('#shoppingCart')).serialize() + ' There was an error updating shopping cart, please inform IT Web Experts about this error.' I get the following output: qty%5B28%5D=1 There was an error updating shopping cart, please inform IT Web Experts about this error. Does qty%5B28%5D=1 even look correct? Are there two arrays in there? I just can't make sense of it. ALSO: While I still get the error message and nothing updates, if I refresh the page after clicking the update button, the shopping cart actually updates with the correct numbers! Go figure. :angry:
  3. Taven

    One Page Checkout Support

    While that's somewhat true, I actually removed the leave comment / order summary at the bottom because I felt that was more redundant than the editable cart at the top. I prefer the one at the top as it allows you to still adjust your order in case you missed something, instead of going back to your cart to have to adjust it, which is REALLY nice- one less button to click. Customers may accidentally add more of an item without realizing it and then when they are double checking the order total they realize their mistake. Without having to go back to the shopping cart they can just modify their order at the top. The little summary down at the bottom (while for most it's a good idea, a final double check if you will) I felt it was only taking up space. :) So I'm really interested in a solution! :) Hope it gets solved soon.
  4. Taven

    One Page Checkout Support

    Awesome! I look forward to knowing the answer! :lol:
  5. Taven

    One Page Checkout Support

    Ok. Here's the problem with the "update cart button". The ajax call is not sending the correct data. It should be sending two arrays- one for quantities and one for Ids. Instead, it's sending a string with the value "Array" for quantities and absolutely nothing for Ids. Here's the debug code I used: case 'updateQuantities': //echo $onePageCheckout->updateCartProducts($_GET['qty'], $_GET['id']); echo "alert(' qty value: " . $_GET['qty'] . " and qty is a " . gettype($_GET['qty']) . ""; echo " | id value: " . $_GET['id'] . " and id is a " . gettype($_GET['id']) . "')"; break; Which outputs the following, regardless of what is in your cart: qty value: Array and qty is a string | id value: and id is a NULL As you can see, "qty" is always a string that says "array" while "id" is always nothing, and is "NULL" That means the problem lies in this code here: $('#updateCartButton').click(function (){ queueAjax({ url: '<?php echo fixSeoLink(tep_href_link(FILENAME_CHECKOUT, 'rType=ajax&action=updateQuantities', $request_type));?>', beforeSendMsg: 'Updating Product Quantities', dataType: 'json', data: $('input', $('#shoppingCart')).serialize(), success: updateCartView, errorMsg: 'There was an error updating shopping cart, please inform IT Web Experts about this error.' }); return false; }); Solution? I'm afraid I don't have one yet. I'm not too familar with json or jQuery ajax syntax- I only know the basics. I'll see if I can ask on a Javascripting forum and get an answer to this. If there are any javascripters out there hopefully they can take a look and provide an answer to this perplexing problem! - Taven
  6. Taven

    One Page Checkout Support

    I'm also having the same problem and have been working all night to try and debug the problem. I've given up for the night, but will try for a little bit tomorrow. Hopefully someone can look this over and help! Here's all the code that takes care of the Update Cart button: Inside 'Checkout.php' (javascript) $('#updateCartButton').click(function (){ queueAjax({ url: '<?php echo fixSeoLink(tep_href_link(FILENAME_CHECKOUT, 'rType=ajax&action=updateQuantities', $request_type));?>&qty=1&id=29', beforeSendMsg: 'Updating Product Quantities', dataType: 'json', data: $('input', $('#shoppingCart')).serialize(), success: updateCartView, errorMsg: 'There was an error updating shopping cart, please inform IT Web Experts about this error.' }); return false; }); Inside 'Checkout.php' (php) case 'updateQuantities': echo $onePageCheckout->updateCartProducts($_GET['qty'], $_GET['id']); break; Inside 'includes/classes/onepage_checkout.php' function updateCartProducts($qtys, $ids){ global $cart; foreach($qtys as $pID => $qty){ $cart->update_quantity($pID, $qty, $ids[$pID]); } $json = ''; if (isset($_GET['rType']) && $_GET['rType'] == 'ajax'){ $json .= '{ success: true }'; }else{ tep_redirect(tep_href_link(FILENAME_CHECKOUT)); } return $json; } Now here's what I've found so far: 1) When the button is clicked, this is the line of data that is ajaxed to the server: $('input', $('#shoppingCart')).serialize() What this JQuery code does is it finds the input fields within the shopping cart and stores it as a jQuery object ([object Object]) which is then serialized into post data. Whether this line is the problem line I'm not sure. It seems like it might be, from what I've observed below. Here's an example of data that is ajaxed to the server during one of my tests: qty%5B29%5D=1&qty%5B28%5D=1 That's for 2 products, one with an id of 29 and another 28. Both of their quantities were set to 1. Now I'm not familiar with sending arrays via post data, which is why I don't know if this is wrong, but I'll look into it tomorrow. (Anyone?) 2) The server then gets the post data successfully here: case 'updateQuantities': echo $onePageCheckout->updateCartProducts($_GET['qty'], $_GET['id']); break; I put a little debug line in there and found that the server is getting the post data correctly. BUT the post data might not be correct. My debugging found that $_GET['qty'] is an array, or at least the actual word "Array" as I can't for the life of me get the array to print out: echo "alert('"; $trythis = $_GET['qty']; print_r($trythis); echo "')"; But maybe I'm just being dumb. Anyway, the second part of the data is $_GET['id'], which from my debugging is always just a number- usually the first product in the cart- not an array. This doesn't sound right, as you'd need both an array of quantity values and an array of product IDs in order for this to work! In fact, the function updateCartProducts() to which those values are passed needs two arrays, one for the quantity values and product ids. Without them the function is screwed. 3) Those values are then passed to the updateCartProducts() function here: function updateCartProducts($qtys, $ids){ global $cart; foreach($qtys as $pID => $qty){ $cart->update_quantity($pID, $qty, $ids[$pID]); } $json = ''; if (isset($_GET['rType']) && $_GET['rType'] == 'ajax'){ $json .= '{ success: true }'; }else{ tep_redirect(tep_href_link(FILENAME_CHECKOUT)); } return $json; } Conclusion: The javascript line $('input', $('#shoppingCart')).serialize() does not seem to be sending the correct post data, which would be two arrays. As I mentioned, I'm not familar with sending arrays via post data, so here's that example again of what that line of code is sending to the server: qty%5B29%5D=1&qty%5B28%5D=1 That's for 2 products, one with an id of 29 and another 28. Both of their quantities were set to 1. Perhaps someone who is familiar with sending arrays in post data can look at this and see if the above line is correct? If it is, then it's not the javascript, but something in the php code, maybe even the final function the data is passed to. Hopefully someone can help me out here! :) Will look into this again in the morning. - Taven
×