smiler99 Posted July 29, 2011 Posted July 29, 2011 Hi I have looked high and low, far and wide, read a bibles worth of posts but alas cannot find an answer to my strange problem. When i add an item to my cart it appears ok, if i try to delete the item, nothing happens, if i add a second item this can be deleted ok, but the original item cannot be, if i try to delete the original item whilst keeping the 2nd item in the cart it still will not delete. When also changing the quanitity of an item, say from 1 to 2, a duplicate item appears in my cart with the new quantity, so i end up with 1 item at 1 quantity and 1 item at 2 quantity. this is driving me mad!! - any ideas? To add to this i am in mid upgrade from rc2a to 2.3, and have got as far as the updates listed below and thought i would test a few things before going any further. •(A) (SEC) Administration Tool Log-In Update — Importance: High | Difficulty: Easy •(SQL) (UP) Update Database Field Lengths — Importance: High | Difficulty: Easy •(AC) (COMPAT) Fix Timezone Warning Messages for PHP v5.3 — Importance: Medium | Difficulty: Easy •(AC) (COMPAT) Use Perl-Compatible Regular Expressions for PHP v5.3 — Importance: Medium | Difficulty: Hard •© (SEC) Add Customer Session Token to Forms — Importance: Medium | Difficulty: Medium •© (BUG) Validate Removal of Customer Address — Importance: High | Difficulty: Easy •(AC) (BUG) Sanitize Parameters — Importance: High | Difficulty: Medium •(A) (UP) Add Support for Basic HTTP Authentication — Importance: High | Difficulty: Medium •© (UP) Generate a New Shopping Cart ID When Restoring Products — Importance: Medium | Difficulty: Easy •© (BUG) Fix Navigation History Session Content — Importance: High | Difficulty: Easy •(AC) (UP) Improve Validation of E-Mail Addresses — Importance: Medium | Difficulty: Medium •(AC) (UP) Code Cleanup — Importance: High | Difficulty: Easy •(A) (UP) Update Define Languages Page — Importance: Medium | Difficulty: Medium •© (BUG) Verify Shopping Cart Product Attribute Combinations — Importance: High | Difficulty: Easy •(AC) (UP) Remove PHP3 Compatibility Code — Importance: Low | Difficulty: Easy Thanks in advance for anyones help S/\/\iler
Guest Posted July 29, 2011 Posted July 29, 2011 Chris, Complete the update before trying to test anything. Although some of the remaining edits will appear unrelated to the current issues, that could be in fact the exact reason for the failure. Chris
smiler99 Posted July 31, 2011 Author Posted July 31, 2011 Hi Chris, I have completed rc2a to 2.3 but still have issues with cart, as above i can add items with no issue, but cannot remove them, set them to 0, change their quantity without some unusual changes occuring. 1. add item to Cart 2. try to remove item (will not remove) 3. add another item 4. try to delete either of the 2 items (a 3rd item gets created which is a duplicate of the first!) 5. try deleting any of the 3 items (none will remove) 6.select all 3 items to remove (only one of the items removes) driving me mad. Have tried with both sessions, forced cookies TNA, checked, double checked, tripple checked shopping cart.php and Application top (switch ($HTTP_GET_VARS['action'] - Case update products etc etc), shopping cart class (remove function) all seem ok i get the feeling that this part is not working correctly, maybe some variables not coming through the Post_Vars switch ($HTTP_GET_VARS['action']) { // customer wants to update the product quantity in their shopping cart case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) { if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) { $cart->remove($HTTP_POST_VARS['products_id'][$i]); any help would be much appreciated
satish Posted August 1, 2011 Posted August 1, 2011 $cart->remove($HTTP_POST_VARS['products_id'][$i]); this code part should do. Just echo or use some other debug technique to make sure you are reaching here and getting needed product Id. Also you need to check code of remove function and then check if its something coming from session or is that part stored in data base. In all possibilities it appears that your code was modified so needs to be debugged with focus around following function: $cart->remove($HTTP_POST_VARS['products_id'][$i]); Satish Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site. Check My About US For who am I and what My company does.
♥bruyndoncx Posted August 1, 2011 Posted August 1, 2011 while you are at it, if you can change $HTTP_POST_VARS to $_POST and the same with $_GET as these long constructs are depreciated http://php.net/manual/en/reserved.variables.post.php I'm not sure if all PHP versions still support the long form, satish probably knows best as a pro-coder ... KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
satish Posted August 1, 2011 Posted August 1, 2011 while you are at it, if you can change $HTTP_POST_VARS to $_POST and the same with $_GET as these long constructs are depreciated http://php.net/manua...iables.post.php I'm not sure if all PHP versions still support the long form, satish probably knows best as a pro-coder ... With register globals patches in place this sould not hamper but always good to use $_POST and the same with $_GET instead of $HTTP_POST_VARS Satish Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site. Check My About US For who am I and what My company does.
smiler99 Posted August 1, 2011 Author Posted August 1, 2011 $cart->remove($HTTP_POST_VARS['products_id'][$i]); this code part should do. Just echo or use some other debug technique to make sure you are reaching here and getting needed product Id. Also you need to check code of remove function and then check if its something coming from session or is that part stored in data base. In all possibilities it appears that your code was modified so needs to be debugged with focus around following function: $cart->remove($HTTP_POST_VARS['products_id'][$i]); Satish Hi Satish, i have been trying to use Echo to debug long before my post, but as this code is within application_top and is called through functions i dont believe echo will work in this capacity; i bow to your far greater knowledge if i am incorrect (even tried simple echo 'here i am'; but i dont even see that, i never see the result of my echo (ps. i use STS so unsure if this strips anything out?) I have even tried placing javascript inside application top just to try to 'Alert' some variables, but got nothing there either)... i have just tried echo 'here - ' . sizeof($HTTP_POST_VARS['products_id']) within shopping_cart.php itself the result of which is always 'here - 0' bit stuck.. if you can help me create a breakpoint or force the display of $http_post_vars etc it would be appreciated. on the side note i was aware that the full post vars was becoming depricated and will be fully removed within php 6, i assumed that OSC would have an internal custom function to replace it that converted all $http_Post_vars request to their short form otherwhise wont we have major issues in the future (and why was thisupdate not included in 2.3.1 with other depricated functions ??) cheers Chris.
satish Posted August 1, 2011 Posted August 1, 2011 after echo "blah blah.... "; place exit(); That will for sure echo on page if that code part is getting executed. Satish Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site. Check My About US For who am I and what My company does.
smiler99 Posted August 2, 2011 Author Posted August 2, 2011 after echo "blah blah.... "; place exit(); That will for sure echo on page if that code part is getting executed. Satish Hi Satish, After tracing through the code immediatly after i click the update button in the shopping cart ieverything seemed to pass variables as they should but the remove function in the shopping_cart.php class file did not remove the product, the unset command had no effect, after several trial and errors i have however made some progress.... at this point i should advise that i have ZAPPO options types v2 contrib installed which just prior to the unset command runs this function //BOF - Zappo - Option Types v2 - ONE LINE - Add call to tep_get_uprid to correctly format product ids containing quotes $products_id = tep_get_uprid($products_id, $attributes); now if i comment out the row that converts the product id then items do get removed from cart correctly, however other issues do remain, such as if i click update whilst in shopping cart and have not ticked remove box or have not changed the product quanity then the products in the cart get duplicated. the debug code i used shows the contents of the array passed to shopping_cart.php which show a strange array with differeng methods of storing the product and attribute data. the debug output below shows the contents of $this->contents before passing through the unset command (followed by the product_id used in the unset command), then followed by the $this->contents after the unset command. This debug extract is when i have left the Zappo options type v2 uprid funtion commented out (i.e. it seems to work) any thoughts, advice etc (other than this issue now seems to be related to Zappo options contrib and therefore this issue would probably best sit in the relevant forum for that contrib and that the first item in my cart always appears to have curly brackets in its id and and subsequent products dont. $this->contents before using unset ($this->contents[$products_id]) Array ( [10069{2}33{3}4{4}6] => Array ( [qty] => 1 [attributes] => Array ( [2] => 33 [3] => 4 [4] => 6 ) ) [10042{2}1{3}4{4}5] => Array ( [qty] => 1 [attributes] => Array ( [2] => 1 [3] => 4 [4] => 5 ) ) [10069] => Array ( [qty] => 1 [attributes] => Array ( [2] => 33 [3] => 4 [4] => 6 ) ) [10042] => Array ( [qty] => 1 [attributes] => Array ( [2] => 1 [3] => 4 [4] => 5 ) ) ) $products_id contained 10069 $this->contents after using unset ($this->contents[$products_id]) Array ( [10069{2}33{3}4{4}6] => Array ( [qty] => 1 [attributes] => Array ( [2] => 33 [3] => 4 [4] => 6 ) ) [10042{2}1{3}4{4}5] => Array ( [qty] => 1 [attributes] => Array ( [2] => 1 [3] => 4 [4] => 5 ) ) [10042] => Array ( [qty] => 1 [attributes] => Array ( [2] => 1 [3] => 4 [4] => 5 ) ) ) $products_id contained 10069
FridayNight Posted April 20, 2012 Posted April 20, 2012 Hi smiler99, I just got the same problem with Option Types V2, did you find out how to solve this issue at the end?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.