Guest Posted December 7, 2019 Share Posted December 7, 2019 Hello @JcMagpie This is one of the best contributions I have ever installed, been using it for months now. Question: Do I need to upgrade to your latest version or is that something related to Phoenix? I'm using this on 2.3.4.1 CE with no issues. And...your messages inbox is full. 😯 JcMagpie 1 Quote Link to comment Share on other sites More sharing options...
♥JcMagpie Posted December 7, 2019 Author Share Posted December 7, 2019 (edited) 2 hours ago, puggybelle said: Do I need to upgrade to your latest version or is that something related to Phoenix No if your's is working fine then no need to update, It's just using hooks now so will only apply to phoenix. Lastupdat ewas just to add some notes. I'll clear out my inbox 😊 thank's All credit for this add-on goes to @tgely All I have done is update it for Frozen and Phoenix and change it to use hooks. Edited December 7, 2019 by JcMagpie Quote Link to comment Share on other sites More sharing options...
hugo_064 Posted December 13, 2019 Share Posted December 13, 2019 15 hours ago, hugo_064 said: Hi all I try to develop this module with remove (and update quantity) product without close modal. Actualy i can delete product, but I need help to update "total cart" case and quantity in the button => "Your shopping cart (qty)". If you want to try it : Create new file 'ajax.php' in catalog : require('includes/application_top.php'); if($_POST["action"] == "Delete"){ if(isset($_POST["id"])){ $cart->remove($_POST["id"]); } } in 'cm_footer_modal_cart.php' after image add : $cart_contents_string .= '<td><span class="delete" id="del_'.$products[$i]['id'].'"><i class="fas fa-times-circle"></i></span></td>'; in 'tpl_cm_modal_cart.php' after </style> add : <script> $(document).ready(function(){ // Delete product $('.delete').click(function(){ var el = this; var id = this.id; var splitid = id.split("_"); // Delete id var deleteid = splitid[1]; var action = "Delete"; //Define action variable value Delete // AJAX Request $.ajax({ url: 'ajax.php', type: 'POST', data: { id:deleteid, action:action }, success: function(response){ // Removing row from HTML Table $(el).closest('tr').css('background','tomato'); $(el).closest('tr').fadeOut(800, function(){ $(this).remove(); }); } }); }); }); </script> That all. Thank you for your contribution. See u soon. Quote Link to comment Share on other sites More sharing options...
hugo_064 Posted December 13, 2019 Share Posted December 13, 2019 51 minutes ago, hugo_064 said: to update total cart case: create new file : ajax_shopping_cart_total.php and add <?php require('includes/application_top.php'); echo '<p style="text-align: right; padding: 1px;"><strong>Total '. $currencies->format($cart->show_total()).'</strong></p>'; ?> In "tpl_cm_footer_modal_cart.php" change : <p style="text-align: right; padding: 1px;"><strong><?php echo MODULE_CONTENT_FOOTER_MODAL_CART_TOTAL . $currencies->format($cart->show_total()); ?></strong></p> to <div id="randomdiv"></div> <script> $(document).ready(function(){ $("#randomdiv").load("ajax_shopping_cart_total.php"); }); </script> and in remove script find // Removing row from HTML Table $(el).closest('tr').css('background','tomato'); $(el).closest('tr').fadeOut(800, function(){ $(this).remove(); }); and add after : $("#randomdiv").load("ajax_shopping_cart_total.php"); That all 51 minutes ago, hugo_064 said: Quote Link to comment Share on other sites More sharing options...
hugo_064 Posted December 13, 2019 Share Posted December 13, 2019 For "Your shopping cart (x)" button : in "tpl_cm_footer_modal_cart.php" hide : <?php /* <div class="modal-footer"> <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button><?php echo tep_draw_button(MODULE_CONTENT_FOOTER_MODAL_CART_HEADING_TITLE . ($cart->count_contents() > 0 ? ' (' . $cart->count_contents() . ')' : ''), 'cart', tep_href_link('shopping_cart.php')) . tep_draw_button(IMAGE_BUTTON_CHECKOUT, 'fas fa-angle-right', tep_href_link('checkout_shipping.php', '', 'SSL')); ?> </div> */?> and in "ajax_shopping_cart_total.php" add after ?> : <div class="modal-footer"> <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button><?php echo tep_draw_button(MODULE_CONTENT_FOOTER_MODAL_CART_HEADING_TITLE . ($cart->count_contents() > 0 ? ' (' . $cart->count_contents() . ')' : ''), 'cart', tep_href_link('shopping_cart.php')) . tep_draw_button(IMAGE_BUTTON_CHECKOUT, 'fas fa-angle-right', tep_href_link('checkout_shipping.php', '', 'SSL')); ?> </div> Quote Link to comment Share on other sites More sharing options...
hugo_064 Posted December 21, 2019 Share Posted December 21, 2019 Hi all, Forget my 3 previous post. i'm back with new code for update and delete products in modal shopping cart. This add-on work only on products without attributes. 1/ create 2 files : 1-A/ ajax_shopping_cart.php <?php require("includes/application_top.php"); $page_content = $oscTemplate->getContent('shopping_cart'); require('includes/languages/' . $language . '/shopping_cart.php'); require('includes/languages/' . $language . '/modules/content/footer/cm_footer_modal_cart.php'); ?> <table class="table" style="margin-bottom: 0;"> <thead> <tr> <th class="d-none d-md-table-cell"> </th> <th><?php echo MODULE_CONTENT_SC_EST_PRODUCT_LISTING_HEADING_PRODUCT; ?></th> <th><?php echo MODULE_CONTENT_SC_EST_PRODUCT_LISTING_HEADING_AVAILABILITY; ?></th> <th><?php echo MODULE_CONTENT_SC_EST_PRODUCT_LISTING_HEADING_QUANTITY; ?></th> <th class="text-right"><?php echo MODULE_CONTENT_SC_EST_PRODUCT_LISTING_HEADING_PRICE; ?></th> </tr> </thead> <tbody> <?php if ($cart->count_contents() > 0) { // register country_id for tax if ( isset($_POST['country_id']) ) { $customer_country_id = $_POST['country_id']; tep_session_register('customer_country_id'); $customer_zone_id = isset($_POST['zone_id'])? $_POST['zone_id'] : null; tep_session_register('customer_zone_id'); } $any_out_of_stock = 0; $products = $cart->get_products(); $products_name = NULL; $products_field = NULL; for ($i=0, $n=sizeof($products); $i<$n; $i++) { // Push all attributes information in an array if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { foreach($products[$i]['attributes'] as $option => $value) { $products_field .= tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value); $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from products_options popt, products_options_values poval, products_attributes pa where pa.products_id = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'"); $attributes_values = tep_db_fetch_array($attributes); $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name']; $products[$i][$option]['options_values_id'] = $value; $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name']; $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price']; $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix']; } } } for ($i=0, $n=sizeof($products); $i<$n; $i++) { $products_name .= '<tr>'; $products_name .= '<td class="d-none d-md-table-cell"><a href="' . tep_href_link('product_info.php', 'products_id=' . $products[$i]['id']) . '">' . tep_image('images/' . $products[$i]['image'], htmlspecialchars($products[$i]['name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>'; $products_name .= '<th><a href="' . tep_href_link('product_info.php', 'products_id=' . $products[$i]['id']) . '">' . $products[$i]['name'] . '</a>'; if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) { foreach($products[$i]['attributes'] as $option => $value) { $products_name .= '<small><br><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>'; } } $products_name .= '</th>'; if (STOCK_CHECK == 'true') { $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']); if (tep_not_null($stock_check)) { $any_out_of_stock = 1; $products_name .= '<td>' . $stock_check . '</td>'; } else { goto in_stock; } } else { in_stock: $products_name .= '<td>' . MODULE_CONTENT_SC_EST_PRODUCT_LISTING_TEXT_IN_STOCK . '</td>'; } $products_name .= '<td><div class="input-group">'; $products_name .= tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'style="width:65px;" min="0" id="qty'.$products[$i]['id'].'" ', 'number'); $products_name .= tep_draw_hidden_field('products_id[]', $products[$i]['id']); $products_name .= '<span class="update" onclick="update('.$products[$i]['id'].')">' . tep_draw_button(MODULE_CONTENT_SC_PRODUCT_LISTING_TEXT_BUTTON_UPDATE, null, NULL, NULL, NULL, 'btn-info') . '</span>'; $products_name .= '<span class="delete" id="'.$products[$i]['id'].'">'.tep_draw_button(MODULE_CONTENT_SC_PRODUCT_LISTING_TEXT_BUTTON_REMOVE, null, NULL, NULL, NULL, 'btn-danger') . '</span>'; $products_name .= '</div></td>'; $products_name .= '<td class="text-right">' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</td>'; $products_name .= '</tr>'; } } echo $products_name; ?> </tbody> </table> <?php echo '<p style="text-align: right; padding: 1px;"><strong>'. MODULE_CONTENT_FOOTER_MODAL_CART_TOTAL . $currencies->format($cart->show_total()).'</strong></p>'; ?> <div class="modal-footer"> <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button><?php echo tep_draw_button(MODULE_CONTENT_FOOTER_MODAL_CART_HEADING_TITLE . ($cart->count_contents() > 0 ? ' (' . $cart->count_contents() . ')' : ''), 'cart', tep_href_link('shopping_cart.php')) . tep_draw_button(IMAGE_BUTTON_CHECKOUT, 'fas fa-angle-right', tep_href_link('checkout_shipping.php', '', 'SSL')); ?> </div> <script> function update(data){ var temp="#qty"+data; var Qty=$(temp).val(); var action = "Update"; //Define action variable value Delete $.ajax({ url : "ajax_shopping_cart_action.php", method : "POST", data : {qty:Qty, id:data, action:action}, success : function(data){ $("#ajax_shopping_cart").load("ajax_shopping_cart.php"); } }) } $(document).ready(function(){ // Delete product $('.delete').click(function(){ var el = this; var id = this.id; // Delete id var action = "Delete"; //Define action variable value Delete // AJAX Request $.ajax({ url: 'ajax_shopping_cart_action.php', type: 'POST', data: { id:id, action:action }, success: function(response){ // Removing row from HTML Table $(el).closest('tr').css('background','tomato'); $(el).closest('tr').fadeOut(800, function(){ $(this).remove(); }); $("#ajax_shopping_cart").load("ajax_shopping_cart.php"); } }); }); }); </script> 1-B/ ajax_shopping_cart_action.php <?php require('includes/application_top.php'); if($_POST["action"] == "Delete"){ if(isset($_POST["id"])){ $cart->remove($_POST["id"]); } } if($_POST["action"] == "Update"){ if(isset($_POST["id"])){ $cart->add_cart($_POST['id'], $_POST['qty'], $attributes, false); } } ?> 2/ Modify tpl_cm_footer_modal_cart.php 2-A/ Hide <?php echo $cart_contents_string; ?> <p style="text-align: right; padding: 1px;"><strong><?php echo MODULE_CONTENT_FOOTER_MODAL_CART_TOTAL . $currencies->format($cart->show_total()); ?></strong></p> <div class="modal-footer"> <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button><?php echo tep_draw_button(MODULE_CONTENT_FOOTER_MODAL_CART_HEADING_TITLE . ($cart->count_contents() > 0 ? ' (' . $cart->count_contents() . ')' : ''), 'cart', tep_href_link('shopping_cart.php')) . tep_draw_button(IMAGE_BUTTON_CHECKOUT, 'fas fa-angle-right', tep_href_link('checkout_shipping.php', '', 'SSL')); ?> </div> 2-B/ Add after <div class="modal-body"> <div id="ajax_shopping_cart"></div> <script> $(document).ready(function(){ $("#ajax_shopping_cart").load("ajax_shopping_cart.php"); }); </script> That all If someone can help me to update products with attributes it will be nice. Quote Link to comment Share on other sites More sharing options...
Pedros Posted December 21, 2019 Share Posted December 21, 2019 On 12/6/2019 at 12:30 PM, LeeFoster said: I have that set. I think it might be something to do with where the hook is called, I might be wrong, but I edited the Upcart file to being the jquery back in and it works. I think that being able for the customer to see their shopping cart after they have added a product is a really useful feature so I decided to try this add-on. Still, I cannot get it working on my Phoenix 1.0.4.0 installations. I have even just set up a fresh installation to eliminate any possible conflicts with other add-ons but it's still a no-go. Checked on Firefox and Chrome (also freshly installed). I have changed nothing in the out-of-the-box installation. I only set "Display Cart After Adding Product" to "false" after I had installed this add-on. Still no modal popping up. The "Display Cart After Adding Product" in the Admin Tool / Configuration / My Store/ is also set to "false" (by default). I have also tried to un-comment the jquery call in the hook and then reinstalling the add-on but it's still not working. What am I doing wrong? Quote Link to comment Share on other sites More sharing options...
Howmessages Posted February 25, 2020 Share Posted February 25, 2020 On 12/6/2019 at 12:42 PM, JcMagpie said: Updated to: Add note about disabling stock cart and potability of conflict with js code in hook reported by @LeeFoster Update to an old add-on, all credit to original author: Gergely V1.0 18/07/2015 JcM Footer Modal Cart V1.6 After installing, I still had a problem with the modal not showing up. After reviewing the working code from @LeeFoster and V1.6, I saw that V1.6 has changed the var $afterfooter to var $Upcart. But the commented JS script still was using $this->afterfooter and not $this->Upcart. Changing this solved the problem. JcMagpie 1 Quote Link to comment Share on other sites More sharing options...
♥JcMagpie Posted February 25, 2020 Author Share Posted February 25, 2020 (edited) 43 minutes ago, Howmessages said: Changing this solved the problem Thank's @Howmessages clearly missed that as it was commeted out! Has been updated JcM Footer Modal Cart V1.6.1 It has also been tested on Phoenix 1.0.5.1 and works fine. On a fresh install the js code was needed in the foooter so has been activated in update. Edited February 25, 2020 by JcMagpie Quote Link to comment Share on other sites More sharing options...
hungryfrank Posted February 26, 2020 Share Posted February 26, 2020 thank you very much a great add-on indeed Quote you can cut up to 4 pages of your checkout by using my three add_ons login create account in one page Express checkout login pop up modal Link to comment Share on other sites More sharing options...
♥JcMagpie Posted March 3, 2020 Author Share Posted March 3, 2020 JcM Footer Modal Cart V1.6.2 Updated to: To fix class error “PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP” Smoky Barnable 1 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.