TonyBunney Posted January 4, 2011 Share Posted January 4, 2011 Well, I thought seeing as it is a new year, It is time to start learning AJAX/JQuery and one of my clients requirements looked to be satisfied with this contribution. I have now spent half the day applying the changes, with no luck and the rest of the day rolling back the changes to see if I can find where it is going wrong. Now I am no Ajax specialist to please excuse my ignorance. Having rolled everything out, the first thing I did was add the <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> to the catalog/shopping_cart.php and immediately I received a warning stating that Webpage error details Message: Object doesn't support this property or method Line: 8 Char: 1 Code: 0 URI: http://www.just-another-thought.info/shop/includes/jquery-oscart.js Please note that I have placed the jquery-oscart.js in the includes directory and not the js directory. I would imagine that this is a big problem but I am willing to be corrected if this is not the case. Thanks Quote Link to comment Share on other sites More sharing options...
mvrp350 Posted February 11, 2011 Share Posted February 11, 2011 Hi, this contri looks very nice. When testing your demo I found some minor issues: - start with an empty cart - go to subcategory (hardware) - click on 'matrox g400' - click 'add to cart' the product flies to the shopping cart (very nice) and the cart changes next - in categories click on 'mice' - new product-page appear with 'buy now' button - click on 'buy now' - the product is added to the cart, and the page reload to the shopping cart next - do the same as for mice with the 'matrox g400' - when you click 'buy now' it goes to the product page where you have to select 'add to cart' Besides this minor issue very nice add-on. btw, does it also work with seo as I've tried to install multiple ajax-shopping carts, but they all seem to have problems with seo enabled and/or ultimate seo urls 5 (contri 6768) Keep up the good work. Quote Link to comment Share on other sites More sharing options...
blr044 Posted March 2, 2011 Share Posted March 2, 2011 I was wondering if the current package is compatible with the new Version 2.3.1? I've tried looking for the lines to find and replace however I can't seem to locate them. It's probably that I'm just too new at this as well. Have tried incorporating this mod into OSC 2.3.1, but unable to alter code or understand it to get it added to store. Quote Link to comment Share on other sites More sharing options...
Simpel Posted March 15, 2011 Share Posted March 15, 2011 Hi, i was trying to setup this plugin again and i noticed few things: 1. this plugin only works on "product_info" page if there is a image of the product 2. this plugin is not working on "product_list" (for example, if i choose one category on the left menu), but i dont know if isnt working because REALLY isnt working or if is some "issue" like #1 any ideas? I just wondering or point two still not works? The product page works fine. Now I like to have this on the product list. Does anyone got suggestions? Quote Link to comment Share on other sites More sharing options...
Davefromcornwall Posted March 16, 2011 Share Posted March 16, 2011 I'd just like to add my voice to those asking if some kind person could possibly get this to work on 2.3.1 and then amend the installation instructions accordingly. It would be nice to be able to install this great-sounding add-on. Quote Link to comment Share on other sites More sharing options...
Simpel Posted April 1, 2011 Share Posted April 1, 2011 I have tried for hours now every combination of what you suggested. It is still not working :( If you are unable to test it, I can grant you full access to my site with a clean install of 2.2rc2 so you can try it. Also, on line 77 and 78, you are using 'form[name=cart_quantity]' Should it be 'form[name=boxcart_quantity]' ? Thanks D I got the same problem. When updating the whole page comes into the shoppingcart, also with the shoppingcart box. Did you already solved the problem? Quote Link to comment Share on other sites More sharing options...
Simpel Posted April 1, 2011 Share Posted April 1, 2011 For me it has something to do with "id=boxcart-total" the link will be generated in index.php etc. I want this to index2.php. Where is "id=boxcart-total" defined? thanks in advance. Quote Link to comment Share on other sites More sharing options...
gotcha5832 Posted April 2, 2011 Share Posted April 2, 2011 Hi eveyone, I tried to install it and I've different problem 1- already report, but i didn find the solution, is th problem of the total price being updated in the shopping-cart-box, a whole new oscommerce window opens INSIDE the shopping cart box. Does anyone have a solution? exept remove ('<span id=boxcart-total>' . $currencies->format($cart->show_total()) . '</span>' );) 2- If 1 have a product A with attribute in my basket, and i add a another, the boxe doesnt display 2xA but 1xa, i should change of page to see the good quantity 3-On my website I'm already working with Jquery_1.5, but this contribution doesnt work with jquery>=1.5, If i load jquery_1.5, i have a problem on product with attribute, which are added no stop until i'm stay on product_info. I mean, i'm on product page, i click on "add", the picture go to shopping_cart boxe, but the product aren't add to the boxe. I wait, go to shopping_cart.php, and i see the this product have been added 20-50times? Does anyone deal with jquery_1.5? Quote Link to comment Share on other sites More sharing options...
Simpel Posted April 4, 2011 Share Posted April 4, 2011 "GET /shopping_cart.php?ajax=1 HTTP/1.1" 200 2061 This is the second line which comes up in firebug when choose + or - quantity. Does anyone know where this as been programmed? The first line POST /~oscommerce/shopping_cart.php?action=update_product&ajax=1 seems to compare with shopping_cart.php arround line 60 <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?> I like to have this index2.php. But I don't know where to look. I hope somebody can help me with this great contribution. Quote Link to comment Share on other sites More sharing options...
Simpel Posted April 4, 2011 Share Posted April 4, 2011 Ok. it seems finnaly got shoppingcart box working. The problem I got with the shoppingcart itself is : instead of taken the part <div id="content1-body"> ... .. </div> it seems that he takes the whole file. Where will this be defined in jquery-oscart? The connection code to the content-body of the shoppingcar.phpt file? Quote Link to comment Share on other sites More sharing options...
gotcha5832 Posted April 5, 2011 Share Posted April 5, 2011 about my different problem. Finally I redesign the boxe and remove <span id=boxcart-total>' But i still have problem with jquery>1.5 If i load jquery_1.5, i have a problem on product with attribute, which are added no stop until i'm stay on product_info. I mean, i'm on product page, i click on "add", the picture go to shopping_cart boxe, but the product aren't add to the boxe. I wait, go to shopping_cart.php, and i see the this product have been added 20-50times? Does anyone deal with jquery_1.5? Quote Link to comment Share on other sites More sharing options...
Simpel Posted April 5, 2011 Share Posted April 5, 2011 about my different problem. Finally I redesign the boxe and remove <span id=boxcart-total>' But i still have problem with jquery>1.5 If i load jquery_1.5, i have a problem on product with attribute, which are added no stop until i'm stay on product_info. I mean, i'm on product page, i click on "add", the picture go to shopping_cart boxe, but the product aren't add to the boxe. I wait, go to shopping_cart.php, and i see the this product have been added 20-50times? Does anyone deal with jquery_1.5? Delete the second "<script type="text/javascript" src="js/jquery-oscart.js"></script>" in the shopping_cart.php. Maybe the problem solved. I got a similar problem, after delete the rule, problem solved. Quote Link to comment Share on other sites More sharing options...
Simpel Posted April 7, 2011 Share Posted April 7, 2011 You could change it by this one : if ( isset($_GET['ajax']) && (int)$_GET['ajax'] != 1 ) I tried before HTTP_X_REQUESTED_WITH, i like this method but seems to be uncompatible with some server and particulary with MSIE (...) To avoid page directly page call with ajax parameter (from a non ajax requester) i also modified tep_href_link in html_output.php but it is not needed in this contribution, but i still post the code : html_output.php / tep_href_link // Prevent non ajax loading / OLIVIER // $parameters = str_replace('&ajax=1', '', $parameters) ; $parameters = str_replace('?ajax=1', '?', $parameters) ; You also need to update <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> to <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"> </script> otherwise you get errors Quote Link to comment Share on other sites More sharing options...
Simpel Posted April 8, 2011 Share Posted April 8, 2011 You could change it by this one : if ( isset($_GET['ajax']) && (int)$_GET['ajax'] != 1 ) I tried before HTTP_X_REQUESTED_WITH, i like this method but seems to be uncompatible with some server and particulary with MSIE (...) To avoid page directly page call with ajax parameter (from a non ajax requester) i also modified tep_href_link in html_output.php but it is not needed in this contribution, but i still post the code : html_output.php / tep_href_link // Prevent non ajax loading / OLIVIER // $parameters = str_replace('&ajax=1', '', $parameters) ; $parameters = str_replace('?ajax=1', '?', $parameters) ; When changing this I got the following error: $(document).ready is not a function =>jquery-oscart.js (line 8) Quote Link to comment Share on other sites More sharing options...
Simpel Posted April 11, 2011 Share Posted April 11, 2011 In the installation instruction it says, "4) filename : catalog/index.php and other one where placed the shopping cart infobox Just place a call to the jquery API and the javascript contribution include file in the <head> section : <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="js/jquery-oscart.js"></script>" What do you mean by that? Quote Link to comment Share on other sites More sharing options...
Simpel Posted April 11, 2011 Share Posted April 11, 2011 Am I the only one who uses this contribution? I am still busy to get this 100% working. I am getting the following problem I get: "POST /shopping_cart.php?action=update_product&ajax=1 "GET /shopping_cart.php "GET /js/jquery-oscart.js "POST /shopping_cart.php?action=update_product&show_total=1?ajax=1 "GET /shopping_cart.php instead of "POST /shopping_cart.php?action=update_product&ajax=1 "GET /shopping_cart.php?ajax=1 "GET /js/jquery-oscart.js "POST /shopping_cart.php?action=update_product&show_total=1?ajax=1 "GET /shopping_cart.php?show_total=1&ajax=1 Where do I have to look to make the right link? Quote Link to comment Share on other sites More sharing options...
Simpel Posted April 12, 2011 Share Posted April 12, 2011 I have applied the AJAX/jQuery contribution #7477 (http://addons.oscommerce.com/info/7477) to a stock oscommerce 2.2rc2a over 4 times now and keep getting a big issue: Everything works but instead of the total price being updated in the shopping-cart-box, a whole new oscommerce window opens INSIDE the shopping cart box. In opera the whole thing just hangs or crashes. Ive tried on seveal PCs, but same issue. What you can do is change the line is jquery_oscart,js line: ~274 $("#content-body").html(data); to $("#content-body").load("shopping_cart.php #content-body > *"); Quote Link to comment Share on other sites More sharing options...
lifeisboost Posted April 14, 2011 Share Posted April 14, 2011 this contribution works great except for one area. When you are in your shopping cart and you want to update the QTY of each item if you use the plus or minus sign, It updates the prices and the QTYs in the info box and in the shopping cart. The problem is when you click checkout it drops everything to a QTY of 1. the only way the QTY is saving is if you enter a number and then press enter for the page to refresh. Quote Link to comment Share on other sites More sharing options...
Simpel Posted April 26, 2011 Share Posted April 26, 2011 My oscommmerce is not installed in the root of the domain. But in another map. when I installed this contribution. The programm takes the index.php from the root instead of the map. When I change in the shoppingcart.php the <?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?> to <?php echo tep_draw_form('cart_quantity', FILENAME_SHOPPING_CART, 'action=update_product'); ?> I get domain/shopping_cart.php otherwise I get domain/index.php tep_href_link => this should brings you to the right map, but it's not. it seems something in jquery_oscart.js. had to change. the .attr('action') on line 273 gives me the wrong link and of course no action from the shopping_cart.php file (action=update_product) the only action I can see in jquery_oscart.js = on line 216 : action = $(this).attr('class').split(' ').slice(-1) ; I don't know how to read this line. But it seems to bring me back to the root index.php instead of map/index.php hope someone can help me with this. Quote Link to comment Share on other sites More sharing options...
Simpel Posted April 28, 2011 Share Posted April 28, 2011 when changing the url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&ajax=1', To an url link made with shoppingcart, without .attr('action')etc. The POST in firebug goes always to the index.php file instead of the shopping_cart.php file. how come? What code in jquery-oscart.js makes this? Does somebody got a flying image from the listing.php working? Quote Link to comment Share on other sites More sharing options...
Simpel Posted May 11, 2011 Share Posted May 11, 2011 When I click plus or min in the shoppingcart I get in firebug "POST /shopping_cart.php?action=update_product&ajax=1 "GET /shopping_cart.php?ajax=1 "GET /js/jquery-oscart.js "POST /shopping_cart.php?action=update_product&show_total=1?ajax=1 "GET /shopping_cart.php?show_total=1&ajax=1 Where are these GET links from? "GET /shopping_cart.php?ajax=1 "GET /shopping_cart.php?show_total=1&ajax=1 Hope someone knows... Quote Link to comment Share on other sites More sharing options...
Simpel Posted May 14, 2011 Share Posted May 14, 2011 this contribution works great except for one area. When you are in your shopping cart and you want to update the QTY of each item if you use the plus or minus sign, It updates the prices and the QTYs in the info box and in the shopping cart. The problem is when you click checkout it drops everything to a QTY of 1. the only way the QTY is saving is if you enter a number and then press enter for the page to refresh. Did you change something in your jquery-oscart.js? The best way too discover is to look in firebug what the post and get links are. unfortunately there is almost no response in this forum for such great contribution. I am still busy and solved a lot bugs in my program. Quote Link to comment Share on other sites More sharing options...
Simpel Posted May 14, 2011 Share Posted May 14, 2011 after I have changed: url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&show_total=1&ajax=1', into url: encodeURI($(location).attr('href')) + '?show_total=1&ajax=1', it start working , and updating correctly when i'm using + / - but there is still problem with small remove icon in cartbox - I think that's not a solution. check your html_output.php it should be something like this: // Output a form function tep_draw_form($name, $action, $method = 'post', $parameters = '', $tokenize = false) { global $sessiontoken; $form = '<form name="' . tep_output_string($name) . '" action="' . tep_output_string($action) . '" method="' . tep_output_string($method) . '"'; if (tep_not_null($parameters)) $form .= ' ' . $parameters; $form .= '>'; if ( ($tokenize == true) && isset($sessiontoken) ) { $form .= '<input type="hidden" name="formid" value="' . tep_output_string($sessiontoken) . '" />'; } return $form; } and if you got something like this: function tep_draw_form($name, $action, $method = 'post', $parameters = '') { $action = str_replace('&', '&', $action); $parameters = str_replace('&', '&', $parameters); $action_url = preg_replace( '/\.*/?','',$action); delete . and ? for the right POST connection $action_par = preg_replace( '/.*\?/','',$action); Quote Link to comment Share on other sites More sharing options...
steffanih Posted May 17, 2011 Share Posted May 17, 2011 I think that's not a solution. check your html_output.php it should be something like this: // Output a form function tep_draw_form($name, $action, $method = 'post', $parameters = '', $tokenize = false) { global $sessiontoken; $form = '<form name="' . tep_output_string($name) . '" action="' . tep_output_string($action) . '" method="' . tep_output_string($method) . '"'; if (tep_not_null($parameters)) $form .= ' ' . $parameters; $form .= '>'; if ( ($tokenize == true) && isset($sessiontoken) ) { $form .= '<input type="hidden" name="formid" value="' . tep_output_string($sessiontoken) . '" />'; } return $form; } and if you got something like this: function tep_draw_form($name, $action, $method = 'post', $parameters = '') { $action = str_replace('&', '&', $action); $parameters = str_replace('&', '&', $parameters); $action_url = preg_replace( '/\.*/?','',$action); delete . and ? for the right POST connection $action_par = preg_replace( '/.*\?/','',$action); This is what I have. What do I need to change to make it function properly? When I click on the remove or + - quantities it opens a section of my footer which is my hosts SSL Site seal. I have to reload the page to reflect the update which occurs. // Output a form //+Auto SSL Links function tep_draw_form($name, $action, $method = 'post', $parameters = '', $connection = 'NONSSL') { //Make secure connection if applicable if ($connection == 'SSL' || $action == '') { $action = tep_auto_sll_link(tep_output_string($action)); } else { $action = tep_output_string($action); } $form = '<form name="' . tep_output_string($name) . '" action="' . $action . '" method="' . tep_output_string($method) . '"'; //-Auto SSL Links if (tep_not_null($parameters)) $form .= ' ' . $parameters; $form .= '>'; return $form; } Quote Link to comment Share on other sites More sharing options...
Simpel Posted June 2, 2011 Share Posted June 2, 2011 This is what I have. What do I need to change to make it function properly? When I click on the remove or + - quantities it opens a section of my footer which is my hosts SSL Site seal. I have to reload the page to reflect the update which occurs. // Output a form //+Auto SSL Links function tep_draw_form($name, $action, $method = 'post', $parameters = '', $connection = 'NONSSL') { //Make secure connection if applicable if ($connection == 'SSL' || $action == '') { $action = tep_auto_sll_link(tep_output_string($action)); } else { $action = tep_output_string($action); } $form = '<form name="' . tep_output_string($name) . '" action="' . $action . '" method="' . tep_output_string($method) . '"'; //-Auto SSL Links if (tep_not_null($parameters)) $form .= ' ' . $parameters; $form .= '>'; return $form; } change url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&show_total=1&ajax=1', in url: encodeURI($('form[name=cart_quantity]').attr('action')) +'&format=ajax'+ '&show_total=1&ajax=1', maybe it works, for me it does.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.