douglaswalker Posted March 2, 2016 Share Posted March 2, 2016 Could it be because I am using GOLD and not Edge would that make any difference? Doug Link to comment Share on other sites More sharing options...
Guest Posted March 2, 2016 Share Posted March 2, 2016 @@douglaswalker - I haven't tried it yet; however, make sure you have jquery loaded prior this code. Link to comment Share on other sites More sharing options...
Guest Posted March 2, 2016 Share Posted March 2, 2016 @@burt Once again nice bit of code. I just threw this on my test server. Only added one item to cart. Chrome has an issue. If you increment the qty using the arrows say change qty1 to qty 9, the qty only increases by one when leaving the page. Same goes for decreasing qty. Entering the qty works without an issue. Tested on ff and safari with no issues. Link to comment Share on other sites More sharing options...
burt Posted March 2, 2016 Share Posted March 2, 2016 Chrome has an issue. If you increment the qty using the arrows say change qty1 to qty 9, the qty only increases by one when leaving the page. Same goes for decreasing qty. Entering the qty works without an issue. Strange. The demo video shows the number spinner using Chrome...and it works OK for me. Link to comment Share on other sites More sharing options...
Guest Posted March 2, 2016 Share Posted March 2, 2016 Strange indeed. I'm running Version 48.0.2564.116. I'll throw it onto a fresh install and see if I uncover the cause. Link to comment Share on other sites More sharing options...
burt Posted March 2, 2016 Share Posted March 2, 2016 48.0.2564.116 m Exactly the same... Link to comment Share on other sites More sharing options...
Guest Posted March 2, 2016 Share Posted March 2, 2016 @@burt works on fresh install. It appears to have a conflict with Ship In Cart addon. I'll try to figure out the cause as with the estimator disabled, works like the rest. As always, the fun begins when only one browser displays the issue and the others don't. Link to comment Share on other sites More sharing options...
burt Posted March 2, 2016 Share Posted March 2, 2016 Bear in mind that the code I posted was cobbled together inside 2 minutes, and untested other than on a localhost machine using Chrome (hence my warning "not for production use"). It might very well have conflicts with other pieces of js, or not work in other browsers/devices... Link to comment Share on other sites More sharing options...
PiLLaO Posted March 2, 2016 Share Posted March 2, 2016 Why shopping_cart.php don't show unit price by default? Link to comment Share on other sites More sharing options...
Guest Posted March 2, 2016 Share Posted March 2, 2016 @@burt 10-4. For a few minutes, it works well. This is one of those issues that appears like the Loch Ness monster. I added the Ship In Cart to base install and it works well. At this point, I am going to have to fish around for the cause on my dev system. I've spent an hour with no errors to be found. On a side note, if you change the qty quickly up/down the system doesn't always get it right in ff as well. Most likely a customer won't be as pissed as I am clicking these buttons. If the qty is entered manually, always updates with no issue across browsers that I have tested. @@PiLLaO - that question isn't related to this topic. I'd suggest creating a new topic so people can chime in. Link to comment Share on other sites More sharing options...
PiLLaO Posted March 2, 2016 Share Posted March 2, 2016 @@marcello if you want a fast update quantity in shopping cart, you want to fast update the product price, no?maybe isn't the best site to speak this, but shopping_cart.php must update totally and not only the quantity.Anyway, I create a new topic :thumbsup: Edit: Sorry, my shop it's very modified and I forget that by default oscommerce don't show unit price in shopping_cart.php Link to comment Share on other sites More sharing options...
Guest Posted March 2, 2016 Share Posted March 2, 2016 Only because I find it easier to work with modules. I know this is only test code but figured I'd share what I have. Still having issues with my install on dev; however, this bit of code does work well in the testing I have done and addresses the issue nicely. As always, all credit goes to @@burt \includes\modules\header_tags\ht_shopping_cart_qty_ajax.php <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2016 osCommerce Released under the GNU General Public License */ class ht_shopping_cart_qty_ajax { var $code = 'ht_shopping_cart_qty_ajax'; var $group = 'footer_scripts'; var $title; var $description; var $sort_order; var $enabled = false; function ht_shopping_cart_qty_ajax() { $this->title = MODULE_HEADER_TAGS_SHOPPING_CART_QTY_AJAX_TITLE; $this->description = MODULE_HEADER_TAGS_SHOPPING_CART_QTY_AJAX_DESCRIPTION; if ( defined('MODULE_HEADER_TAGS_SHOPPING_CART_QTY_AJAX_STATUS') ) { $this->sort_order = MODULE_HEADER_TAGS_SHOPPING_CART_QTY_AJAX_SORT_ORDER; $this->enabled = (MODULE_HEADER_TAGS_SHOPPING_CART_QTY_AJAX_STATUS == 'True'); } } function execute() { global $PHP_SELF, $oscTemplate; if (basename($PHP_SELF) == 'shopping_cart.php') { $output = <<<EOD <script type="text/javascript"> $('input[name="cart_quantity[]"]').change(function() { var f = $('form[name="cart_quantity"]'); $.ajax({url : $(f).attr('action'), type: 'POST', data: $(f).serialize()}); });</script> EOD; $oscTemplate->addBlock($output, $this->group); } } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_HEADER_TAGS_SHOPPING_CART_QTY_AJAX_STATUS'); } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Shopping Cart Qty Ajax', 'MODULE_HEADER_TAGS_SHOPPING_CART_QTY_AJAX_STATUS', 'True', 'Do you want to enable the system to auto update shopping cart qty when customer leaves shopping cart without clicking the update button?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_HEADER_TAGS_SHOPPING_CART_QTY_AJAX_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_HEADER_TAGS_SHOPPING_CART_QTY_AJAX_STATUS', 'MODULE_HEADER_TAGS_SHOPPING_CART_QTY_AJAX_SORT_ORDER'); } } ?> \includes\languages\english\modules\header_tags\ht_shopping_cart_qty_ajax.php <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2016 osCommerce Released under the GNU General Public License */ define('MODULE_HEADER_TAGS_SHOPPING_CART_QTY_AJAX_TITLE', 'Shopping Cart Qty Ajax'); define('MODULE_HEADER_TAGS_SHOPPING_CART_QTY_AJAX_DESCRIPTION', 'Enable the system to auto update shopping cart quantity when customer leaves shopping cart without clicking the update button'); ?> Link to comment Share on other sites More sharing options...
douglaswalker Posted March 3, 2016 Share Posted March 3, 2016 @@marcello @@burt Hi there thanks guys I have this working with chrome with no issue I will test on other devices and get back. solves the problem nicely @@marcello was the loading before jquery that was the problem thank-you Link to comment Share on other sites More sharing options...
frankl Posted March 3, 2016 Share Posted March 3, 2016 @@burt the Ajax method is preferable, but IMO it should update totals on the shopping cart page and also update the quantities in the shopping cart header as well. I'll try and figure something out. osCommerce user since 2003! Link to comment Share on other sites More sharing options...
Guest Posted March 3, 2016 Share Posted March 3, 2016 @@douglaswalker Nope. I still haven't been able to find the exact cause regarding my issue with Chrome (narrowed it down to be a conflict with one addon). The module posted above uses footer_scripts to ensure jquery is loaded and also there isn't a need for it to be in loaded into head. (that mod is not official, just threw it up there to save others some time and makes it easier for me to test) For those having issues with totals, I have not seen any issues with both my dev and fresh install. Link to comment Share on other sites More sharing options...
douglaswalker Posted March 3, 2016 Share Posted March 3, 2016 Tested on Chrome, FireFox, IE all good so far Link to comment Share on other sites More sharing options...
♥Tsimi Posted March 3, 2016 Share Posted March 3, 2016 https://youtu.be/eJu6GIDYA7M Link to comment Share on other sites More sharing options...
douglaswalker Posted March 3, 2016 Share Posted March 3, 2016 Hi there I found the video a bit hard to see (forgot my glasses) but i think it was showing me the price updating ... woohoo Link to comment Share on other sites More sharing options...
♥Tsimi Posted March 3, 2016 Share Posted March 3, 2016 @@douglaswalker :D o:) Yeah it is kinda small isn't it. But you can watch it on youtube if you like there you can see it a tiny bit better. And yes you are seeing right it is updating the prices on the fly. Link to comment Share on other sites More sharing options...
douglaswalker Posted March 3, 2016 Share Posted March 3, 2016 Very cool :P :thumbsup: Link to comment Share on other sites More sharing options...
burt Posted March 3, 2016 Share Posted March 3, 2016 Updating totals is not something I set out to solve. I only wanted to solve what I see as a problem.But if anyone wants to extend the code to update totals: :pray: Is that possible without core change? Link to comment Share on other sites More sharing options...
douglaswalker Posted March 3, 2016 Share Posted March 3, 2016 Hi there, drop down is certainly one method that would be great for some shops but it requires a page refresh and also some people sell many many of one product and then 1 of another so having a drop down of say 100 would be annoying. (in my case anyway) Link to comment Share on other sites More sharing options...
azpro Posted March 3, 2016 Author Share Posted March 3, 2016 @@Tsimi Hi Lambros, Video looks good! Could you share your code? Regards! Link to comment Share on other sites More sharing options...
♥Tsimi Posted March 3, 2016 Share Posted March 3, 2016 @@azpro There are a couple reasons why I won't post the code here in this thread. 1.) Part of shopping cart code is very old, I guess from the 2.2 era. And it is based on table structure. 2.) Still very buggy. Many things don't work as they should. 3.) Core code need to be changed which is not in the interest of the current osC BS community project. I think the AJAX code is of interest though so if you want to take a look at it I could prepare a package with bug list and to do list and send it to you. Just send me your e-mail address, this goes for all the people that want to have a look at it. Link to comment Share on other sites More sharing options...
♥Tsimi Posted March 4, 2016 Share Posted March 4, 2016 @@azpro There are a couple reasons why I won't post the code here in this thread. 1.) Part of shopping cart code is very old, I guess from the 2.2 era. And it is based on table structure. 2.) Still very buggy. Many things don't work as they should. 3.) Core code need to be changed which is not in the interest of the current osC BS community project. I think the AJAX code is of interest though so if you want to take a look at it I could prepare a package with bug list and to do list and send it to you. Just send me your e-mail address, this goes for all the people that want to have a look at it. Reconsidered, it is easier if you guys can grab the package your self and do what you like with it. But be warned this is not meant to be used for live shops. This is for further development only! You want to get ideas or see how it would work then please go ahead but don't use this and think you get any support to get it running here. There is no support for this. That said here the package: Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.