Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Dr. Rolex

Pioneers
  • Posts

    321
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by Dr. Rolex

  1. when you add products. If you expand this error (I think there is a little arrow to the top left of the error), can you see which the offending line in jquery-oscart.js are? Are you using a self-signed certificate or is it a e.g Verisign certificate? Have you tried putting https on both the HTTP_SERVER and HTTPS_SERVER setting in configure.php? Since you're having problem running the site with Force cookie usage I think the problem is your SSL configuration. With a correctly configured SSL you should always set everything to ON in Admin > Configuration > Sessions. This is the most secure way of running your site. You shouldn't be able to see the "osCsid=c8b9c342190d1a81fd2383567c3e88c5" when you add products.
  2. You can try to change the settings in Admin > Configuration > Sessions to this: Session Directory /var/sessions/ Force Cookie Use True Check SSL Session ID True Check User Agent True Check IP Address True Prevent Spider Sessions True Recreate Session True If you have a SSL connection this is the optimal settings. I don't know if it will do any difference, however..
  3. Did I understand this correct: Everything works as long as you don't use a SSL connection? When you use SSL you get this error? In Chrome, open the Developer toolbar and click on network. Clear the console and then try to add a product (do this exactly as you did when you got that error) and then reply with the information from the console (as in the network tab). It should be something like: products_id=17&action=add_product&show_total=1&ajax=1 Found shopping_cart.php?show_total=1&ajax=1 OK shopping_cart.php?count_contents=1&ajax=1 OK I still think it's something wrong with your settings in configure.php, this is how my file look like: <?php define('HTTP_SERVER', 'https://www.mysite.com'); define('HTTPS_SERVER', 'https://www.mysite.com'); define('ENABLE_SSL', true); define('HTTP_COOKIE_DOMAIN', '.mysite.com'); define('HTTPS_COOKIE_DOMAIN', '.mysite.com'); define('HTTP_COOKIE_PATH', '/'); define('HTTPS_COOKIE_PATH', '/'); define('DIR_WS_HTTP_CATALOG', '/'); define('DIR_WS_HTTPS_CATALOG', '/'); define('DIR_WS_IMAGES', 'images/'); define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/'); define('DIR_WS_INCLUDES', 'includes/'); define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/'); define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/'); define('DIR_MOBILE_CLASSES' , 'mobile/includes/classes/'); define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/'); define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/'); define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/'); define('DIR_FS_CATALOG', '/var/www/'); define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/'); define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/'); define('DB_SERVER', 'localhost'); define('DB_SERVER_USERNAME', 'USERNAME'); define('DB_SERVER_PASSWORD', 'PASSWORD'); define('DB_DATABASE', 'YOUR_DATABASE'); define('USE_PCONNECT', 'false'); define('STORE_SESSIONS', 'mysql'); define('CFG_TIME_ZONE', 'YOUR_ZONE'); ?> Remember that if you have registered your SSL certificate with www.mysite.com it has to be exactly that and if you registered it with mysite.com it has to be the same as that, always. What the error means, I think, is that it can't find the url. The server thinks that you are trying to POST to a remote website, so something is probably wrong with your http redirects.
  4. I can't reproduce this error so it has to be something on your server. One thing that I can think of is that you have a faulty (wrong word perhaps) SSL configuration. When you visit the site first, will you get a SSL connection right away or is that after you have clicked a link? If so, try to correct this so the customer always will be redirected to the https://www.yoursite.com from the start. You can try to manually go to the https address and see if you still get this problem. Also, look in the resources and see if all javascript files have been loaded when you enter the site for the first time. Lastly, you can try to change this code in the jquery-oscart.js file: $(document).ready(function() { To this code: $(window).load(function() {
  5. Also, could you check in the javascript console in Chrome for any errors and make sure that you can find accounting.min.js under the "Sources"-tab. While you are on it, look for the other javascript files as well (jquery-oscart.js, jquery-ui.min.js, jquery.bxGallery.1.1.min.js, jquery.fancybox-2.1.4.pack.js, jquery.min.js). But I think this is some kind of jQuery error you are getting so try changing the jQuery version and then, if that won't work, your jQuery-UI version as well.
  6. Hm, that's weird because it works for me. You mean that the products are actually added to the cart as they should but the shopping cart itself doesn't update visually? I other words, it's dead? What happens if you press the remove button in the cart, does it update correctly then? What do you mean drag the product off the homepage, doesn't the draggable image return to it's original position when dropped outside of the shopping cart box? You could try to change the jQuery version in template_top.php, so that you use the same version for Firefox/Chrome as Internet Explorer uses. Change this code: <?php if(!preg_match('/MSIE/i',$_SERVER['HTTP_USER_AGENT'])) { ?> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> <?php } else { ?> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <?php } ?> To this code: <?php if(!preg_match('/MSIE/i',$_SERVER['HTTP_USER_AGENT'])) { ?> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <?php } else { ?> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <?php } ?>
  7. OK, new update now available: - jQuery Shopping Cart 2.3.3 Rev 3 - http://addons.oscommerce.com/info/8790 New features for this Revision: - Drag & Drop function complete with Dramatic Explosions - jQuery Shopping Cart Animations when new product is added or old removed - Javascript Counter that automatically identifies currency and counts from old order total to new value - Shopping Cart Infobox is now 100% CSS - Tested successful with Attributes Support for those who need it - jQuery Dialog on Product Removal - Smoother Refresh on shopping cart page - Bug fixes and some style modifications Give me a reply if you run into any problems.
  8. I'm finally done with the new update, I have added Drag & Drop functionality. So now it's possible to just drag the products image/text to the cart from any box on the shop and it will be added to the cart, looks pretty good. Explodes on impact with shopping cart and the other products fades/slides down while dragging. =) Hopefully the customers will understand this and use it, I have added highlighting effects to both the products and the cart on Hover/Drag and so on.. The order total in the cart infobox will count from the old value to the new value when a product is added/removed. The cart infobox looks much nicer now and is without images. Minor animation effects added to it. I have tested that everything should work smoothly with attributes on all pages/boxes and fixed so attributes will be possible to select on the product listing. However, since I can't add this that easily to the What's new? / Specials / Reviews boxes, I have only fixed so it will add the product with the default attributes (if the product has any). Since attributes generate some unnecessary queries for those that don't use them I have put tags on where to comment out code to disable them. Fixed some bugs I found, hopefully didn't create any new ones.. A nicer jQuery Dialog instead of the ugly "Update cart?" box that appears when customer want to delete product. Smoother refresh on the shopping cart page - only refreshes the area with the products and the infobox when adding/removing products. Since I currently don't have access to a Windows machine I haven't been able to test this update with any Internet Explorer version. Everything has been tested and works smoothly with Chrome / Firefox / Safari. But that doesn't give any guarantees for that anything will work with the shitty cousin.. I only need to redo the damn instructions and after that I'll upload the new package, which hopefully will be tomorrow. Best regards, Dr. Rolex
  9. No problem at all, I'm using this Add-On myself so I would have done the work anyway. I'm working on a update which will make the shopping cart box only css and without the need for images, it looks way nicer and also I have fixed a couple of bugs and fixed so attributes works correctly. If I have time I'll see if I'm able to get a nice thumbnail in the box too. The code you are looking for is this one: 'top': newOffset.top, // How high we will fly 'left':newOffset.left, // How far we will fly
  10. Hm, that's weird because it's working for me. Maybe I did some more modifications to jquery-oscart.js Try the code I'm using again and see if it helps: /* jQuery Shopping Cart * * Published under GNU License * * 2010/07/01 - by delete ( [email protected] ) * 2010/07/14 - by delete ( [email protected] ) - Added Attributes support * 2013/05/31 - by Dr. Rolex - Added support for product listing and osCommerce 2.3.3 * 2013/06/03 - by Dr. Rolex - Supports multiple product images, Improved animation */ $(document).ready(function() { $('.buttonAction_oscart2').click(function() { // Partial Source code from : http://webresourcesdepot.com/wp-content/uploads/file/jbasket/fly-to-basket/ var productId = $(this).attr('id'); var $oldprod = $('#cart-image-' + productId ); //First we clone the image to the shopping cart and get the offset var $newprod = $oldprod.clone().appendTo('#boxcart-content'); var newOffset = $('#boxcart-content').offset(); //Get the old position var oldOffset = $oldprod.offset(); //Clone the old image for use in animation var $tempprod = $oldprod.clone().appendTo('body'); //Hide new image and set css attributes //Use big z-index, make sure to edit this to something that works with the page $tempprod .css('position', 'absolute') .css('left', oldOffset.left) .css('top', oldOffset.top) // .css('border', '1px dashed black'); //Optional dashed square around image .css('zIndex', 1000); $newprod.hide(); // $oldprod.hide(); //Optional hide image on start of animation (Uncomment $oldprod.show(); below together with this) //Animate the $tempprod to the position of $newprod $tempprod .animate({opacity: 0.4}, 40) //First value is how transparent image is at start of animation; Last value is millisec until animation starts .animate( { opacity: 0.0, // Transparency of image at end of animation 'top': newOffset.top, // How high we will fly 'left':newOffset.left, // How far we will fly width: $oldprod.width() / 3, // Resize image width on animation height: $oldprod.height() / 3 // Resize image height on animation }, 1000, function(){ // Value is total time for animation to finish //Callback function, we remove $newprod and $tempprod $newprod.remove(); $tempprod.remove(); // $oldprod.show(); //Optional show image on end of animation (Uncomment $oldprod.hide(); above together with this) products_id = productId ; qty = parseInt($('#pq-' + productId).html()); if ( qty ) qty = qty + 1 ; else qty = 1 ; // Look for attributes // products_attributes = '' ; $('form[name=cart_quantity]').find('select option:selected').each(function() { products_attributes += '{' + $(this).parent().attr('name').replace(/[^0-9]/g, '') + '}' + $(this).val() ; }); if ( products_attributes != '' ) products_id = products_id + products_attributes; // Delete button in shopping cart infoboxe // new_button = $('#boxcart-button-remove').clone() ; new_button.find('a').attr('id', 'bcr' + $('input[name="products_id"]').val()) ; new_button.find('a').attr('rel', products_id) ; // Products details in shopping cart infoboxe // product_name = '<tr id="pc-' + products_id + '"><td align="right" valign="top"><span class="newItemInCart">'; product_name += '<span id="pq-' + products_id + '">' + qty +'</span> x </span></td><td valign="top"><span class="newItemInCart">' ; product_name += $('#pi-product-info-' + productId).html() ; product_name += '</span>' ; product_name += new_button.html() ; product_name += '<input type="hidden" name="products_id[]" value="' + products_id + '" />' ; product_name += '<input type="checkbox" name="cart_delete[]" value="' + products_id + '" style="display:none;" />' ; product_name += '</td></tr>' ; // Updating infobox content Ta bort Dubblering $("#boxcart-total-area").show(); $.ajax({ type: 'POST', url: encodeURI($('form[name=cart_quantity-' + productId + ']').attr('action')) + '&show_total=1&ajax=1', data: $('form[name=cart_quantity-' + productId + ']').serialize(), success: function(data) { $('#boxcart-total').html(data); update_cart(); } }); // Remove product from infobox list // $(document.getElementById('pc-' + products_id)).remove() ; // Product count // count = $('tr[id^="pc-"]').size() ; if ( count == 0 ) $('#boxcart-content').html('') ; //update_cart(); // Append product to the list $('#boxcart-content').append( product_name ) ; $('#' + new_button.find('a').attr('id') ).click(function() { return($(this).boxcart_remove()); }); }); return(false) ; }); // Add to cart for product_info page // $('.buttonAction_oscart').click(function() { // Partial Source code from : http://webresourcesdepot.com/wp-content/uploads/file/jbasket/fly-to-basket/ var productId = $(this).attr('id'); var $oldprod = $('#cart-image-' + productId ); //First we clone the image to the shopping cart and get the offset var $newprod = $oldprod.clone().appendTo('#boxcart-content'); var newOffset = $('#boxcart-content').offset(); //Get the old position var oldOffset = $oldprod.offset(); //Clone the old image for use in animation var $tempprod = $oldprod.clone().appendTo('body'); //Hide new image and set css attributes //Use big z-index, make sure to edit this to something that works with the page $tempprod .css('position', 'absolute') .css('left', oldOffset.left) .css('top', oldOffset.top) // .css('border', '1px dashed black'); //Optional dashed square around image .css('zIndex', 1000); $newprod.hide(); // $oldprod.hide(); //Optional hide image on start of animation (Uncomment $oldprod.show(); below together with this) //Animate the $tempprod to the position of $newprod $tempprod .animate({opacity: 0.4}, 40) //First value is how transparent image is at start of animation; Last value is millisec until animation starts .animate( { opacity: 0.0, // Transparency of image at end of animation 'top': newOffset.top, // How high we will fly 'left':newOffset.left, // How far we will fly width: $oldprod.width() / 3, // Resize image width on animation height: $oldprod.height() / 3 // Resize image height on animation }, 1000, function(){ // Value is total time for animation to finish //Callback function, we remove $newprod and $tempprod $newprod.remove(); $tempprod.remove(); // $oldprod.show(); //Optional show image on end of animation (Uncomment $oldprod.hide(); above together with this) products_id = productId ; qty = parseInt($('#pq-' + productId).html()); if ( qty ) qty = qty + 1 ; else qty = 1 ; // Look for attributes // products_attributes = '' ; $('form[name=cart_quantity]').find('select option:selected').each(function() { products_attributes += '{' + $(this).parent().attr('name').replace(/[^0-9]/g, '') + '}' + $(this).val() ; }); if ( products_attributes != '' ) products_id = products_id + products_attributes; // Delete button in shopping cart infoboxe // new_button = $('#boxcart-button-remove').clone() ; new_button.find('a').attr('id', 'bcr' + $('input[name="products_id"]').val()) ; new_button.find('a').attr('rel', products_id) ; // Products details in shopping cart infoboxe // product_name = '<tr id="pc-' + products_id + '"><td align="right" valign="top"><span class="newItemInCart">'; product_name += '<span id="pq-' + products_id + '">' + qty +'</span> x </span></td><td valign="top"><span class="newItemInCart">' ; product_name += $('#pi-product-info-' + productId).html() ; product_name += '</span>' ; product_name += new_button.html() ; product_name += '<input type="hidden" name="products_id[]" value="' + products_id + '" />' ; product_name += '<input type="checkbox" name="cart_delete[]" value="' + products_id + '" style="display:none;" />' ; product_name += '</td></tr>' ; // Updating infobox content Ta bort Dubblering $("#boxcart-total-area").show(); $.ajax({ type: 'POST', url: encodeURI($('form[name=cart_quantity-' + productId + ']').attr('action')) + '&show_total=1&ajax=1', data: $('form[name=cart_quantity-' + productId + ']').serialize(), success: function(data) { $('#boxcart-total').html(data); update_cart(); } }); // Remove product from infobox list // $(document.getElementById('pc-' + products_id)).remove() ; // Product count // count = $('tr[id^="pc-"]').size() ; if ( count == 0 ) $('#boxcart-content').html('') ; //update_cart(); // Append product to the list $('#boxcart-content').append( product_name ) ; $('#' + new_button.find('a').attr('id') ).click(function() { return($(this).boxcart_remove()); }); }); return(false) ; }); // Update cart infobox // function update_cart() { $.ajax({ type: 'POST', url: encodeURI($('form[name=boxcart_quantity]').attr('action')) + '&count_contents=1&ajax=1', data: $('form').serialize(), success: function(data) { $('#headercart').html(data); } }); return(false); } // Remove from cart infobox // $.fn.boxcart_remove = function() { products_id = $(this).attr('rel') ; if ( ! confirm( $('#boxcart-text-remove').html() + ' ?' ) ) return false ; $('input[value="' + products_id + '"][name=\"cart_delete[]\"]').attr('checked', true) ; // Refresh entire page if current page is shopping_cart.php ! // url = $(location).attr('href').split("/"); filename = url[url.length - 1]; filename = filename.split('\?')[0] ; if ( filename == 'shopping_cart.php' ) { $('form[name=boxcart_quantity]').submit(); } // Updating cart total // $.ajax({ type: 'POST', url: encodeURI($('form[name=boxcart_quantity]').attr('action')) + '&show_total=1&ajax=1', data: $('form[name=boxcart_quantity]').serialize(), success: function(data) { $('#boxcart-total').html(data); update_cart(); } }); $(document.getElementById('pc-' + products_id)).remove() ; // Product count // count = $('tr[id^="pc-"]').size() ; if ( count == 0 ) { $("#boxcart-total-area").hide(); $('#boxcart-content').html('<tr><td align="right" valign="top">' + $('#boxcart-text-empty').html() + '</td></tr>') ; } return(false); } $('.boxcart-remove').click(function() { return($(this).boxcart_remove()); }); // Remove from cart // $.fn.cart_remove = function() { products_id = $(this).attr('rel') ; $(document.getElementById('pc-' + products_id)).remove() ; ; $('input[value="' + products_id + '"][name=\"cart_delete[]\"]').attr('checked', true) ; $.ajax({ type: 'POST', url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&show_total=1&ajax=1', data: $('form').serialize(), success: function(data) { $('#boxcart-total').html(data); } }); $.ajax({ type: 'POST', url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&ajax=1', data: $('form[name=cart_quantity]').serialize(), success: function(data) { $("#content-body").html(data); update_cart(); }, dataType: 'html' }); return(false); } $('.cart-remove').click(function() { return($(this).cart_remove()); }); // Plus or Minus function // $('.update-qty').click(function() { products_id = $(this).attr('rel') ; val = parseInt( $('input[id="pl' + products_id + '"][name=\"cart_quantity[]\"]').val() ) ; action = $(this).attr('class').split(' ').slice(-1) ; if ( action == 'plus' ) { val = val + 1 ; } else if ( action == 'moins' ) { if ( val <= 0 ) return(false) ; val = val - 1 ; } else { return(false) ; } // $('input[id="pl' + products_id + '"][name=\"cart_quantity[]\"]').val(val) ; $(document.getElementById('pl' + products_id)).val(val) // osCommerce default shopping cart infoboxe product line : // product_name = '<tr id="pc-' + products_id + '"><td align="right" valign="top"><span class="newItemInCart">'; product_name += '<span id="pq-' + products_id + '">' + val + '</span> x </span></td><td valign="top"><span class="newItemInCart">'; product_name += $(document.getElementById('pn-' + products_id)).html() ; product_name += '</span>'; product_name += $('#boxcart-button-remove').html() ; product_name += '<input type="hidden" name="products_id[]" value="' + products_id + '" />' ; product_name += '<input type="checkbox" name="cart_delete[]" value="' + products_id + '" style="display:none;" />' ; // Look for attributes // products_attributes = '' ; $('form[name=cart_quantity]').find('select option:selected').each(function() { products_attributes += '{' + $(this).parent().attr('name').replace(/[^0-9]/g, '') + '}' + $(this).val() ; }); if ( products_attributes != '' ) products_id = products_id + products_attributes; product_name += '</td></tr>' ; // Updating infobox content // // Remove product from infobox list // $(document.getElementById('pc-' + products_id)).remove() ; // Append product to the list // $('#boxcart-content').append( product_name ) ; $.ajax({ type: 'POST', url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&ajax=1', data: $('form[name=cart_quantity]').serialize(), async:false, success: function(data) { $("#content-body").html(data); update_cart(); }, dataType: 'html' }); // Updating cart total // $.ajax({ type: 'POST', url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&show_total=1&ajax=1', data: $('form').serialize(), success: function(data) { $('#boxcart-total').html(data); } }); return(false); }); $('.update-qty').css('visibility', 'visible'); $('.cart-remove').css('visibility', 'visible'); $('.boxcart-remove').css('visibility', 'visible'); $('input[name=\"cart_delete[]\"]').css('display', 'none'); });
  11. Try with replacing your ./includes/modules/product_listing.php with this (and reply if it worked): <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id'); ?> <div class="contentText"> <?php if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) { ?> <div> <span style="float: right;"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></span> <span><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></span> </div> <br /> <?php } $prod_list_contents = '<div class="ui-widget infoBoxContainer">' . ' <div class="ui-widget-header ui-corner-top infoBoxHeading">' . ' <table border="0" width="100%" cellspacing="0" cellpadding="2" class="productListingHeader">' . ' <tr>'; for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { $lc_align = ''; switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_text = TABLE_HEADING_MODEL; $lc_align = ''; break; case 'PRODUCT_LIST_NAME': $lc_text = TABLE_HEADING_PRODUCTS; $lc_align = ''; break; case 'PRODUCT_LIST_MANUFACTURER': $lc_text = TABLE_HEADING_MANUFACTURER; $lc_align = ''; break; case 'PRODUCT_LIST_PRICE': $lc_text = TABLE_HEADING_PRICE; $lc_align = 'right'; break; case 'PRODUCT_LIST_QUANTITY': $lc_text = TABLE_HEADING_QUANTITY; $lc_align = 'right'; break; case 'PRODUCT_LIST_WEIGHT': $lc_text = TABLE_HEADING_WEIGHT; $lc_align = 'right'; break; case 'PRODUCT_LIST_IMAGE': $lc_text = TABLE_HEADING_IMAGE; $lc_align = 'center'; break; case 'PRODUCT_LIST_BUY_NOW': $lc_text = TABLE_HEADING_BUY_NOW; $lc_align = 'center'; break; } $columns = sizeof($column_list); if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) { $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text); } $prod_list_contents .= ' <td' . (tep_not_null($lc_align) ? ' align="' . $lc_align . '"' : '') . '>' . $lc_text . '</td>'; } $prod_list_contents .= ' </tr>' . ' </table>' . ' </div>'; if ($listing_split->number_of_rows > 0) { $rows = 0; $listing_query = tep_db_query($listing_split->sql_query); $prod_list_contents .= ' <div class="ui-widget-content ui-corner-bottom productListTable">' . ' <table border="0" width="100%" cellspacing="0" cellpadding="2" class="productListingData">'; while ($listing = tep_db_fetch_array($listing_query)) { $rows++; $prod_list_contents .= ' <tr>'; for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $prod_list_contents .= ' <td>' . $listing['products_model'] . '</td>'; break; case 'PRODUCT_LIST_NAME': if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) { $prod_list_contents .= ' <td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a></td>'; } else { $prod_list_contents .= ' <td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a></td>'; } break; case 'PRODUCT_LIST_MANUFACTURER': $prod_list_contents .= ' <td><a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a></td>'; break; case 'PRODUCT_LIST_PRICE': if (tep_not_null($listing['specials_new_products_price'])) { $prod_list_contents .= ' <td align="right"><del>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span></td>'; } else { $prod_list_contents .= ' <td align="right">' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</td>'; } break; case 'PRODUCT_LIST_QUANTITY': $prod_list_contents .= ' <td align="right">' . $listing['products_quantity'] . '</td>'; break; case 'PRODUCT_LIST_WEIGHT': $prod_list_contents .= ' <td align="right">' . $listing['products_weight'] . '</td>'; break; case 'PRODUCT_LIST_IMAGE': if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) { // jQuery osCart START $prod_list_contents .= ' <td align="center"><div id="piGal_img-' . $listing['products_id'] . '"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'id="cart-image-' . (int)$listing['products_id'] . '"') . '</a></div></td>'; } else { $prod_list_contents_attributes = ''; $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'"); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$listing['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name"); $cols = 0; while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $products_options_array = array(); $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$listing['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'"); while ($products_options = tep_db_fetch_array($products_options_query)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); if ($products_options['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($listing['products_tax_class_id'])) .') '; } } if (is_string($listing['products_id']) && isset($cart->contents[$listing['products_id']]['attributes'][$products_options_name['products_options_id']])) { $selected_attribute = $cart->contents[$listing['products_id']]['attributes'][$products_options_name['products_options_id']]; } else { $selected_attribute = false; } if ($cols == 0) $prod_list_contents_attributes .= '<tr class="alt">'; $cols++; $prod_list_contents_attributes .= '<td>' . $products_options_name['products_options_name'] . ':' . tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute) . '</td>'; if ($cols == 0) { $prod_list_contents_attributes .= '</tr>'; } if ($cols == $columns) $cols = 0; } $prod_list_contents_attributes = '' . $prod_list_contents_attributes . ''; for ($n=$cols; $n<$columns; $n++) { $prod_list_contents_attributes .= '<td class="tester"></td>'; } $prod_list_contents_attributes .= ''; } $prod_list_contents .= ' <td align="center"><div id="piGal_img-' . $listing['products_id'] . '"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'id="cart-image-' . (int)$listing['products_id'] . '"') . '</a></div></td>'; } // jQuery osCart END break; case 'PRODUCT_LIST_BUY_NOW': // jQuery osCart START $prod_list_contents .= tep_draw_form('cart_quantity-' . $listing['products_id'] . '', tep_href_link(FILENAME_DEFAULT, 'products_id='.$listing['products_id'] . '&action=add_product')) . ' <td align="center">' . '<span id="pi-product-info-'. (int)$listing['products_id'].'" style="display:none"><a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'products_id=' . (int)$listing['products_id']) . '" title="' . $listing['products_name'] . '">' . $listing['products_name'] . '</a></span>' . '<span class="buttonAction_oscart2" style="float:none;" id="'.(int)$listing['products_id'].'">' . tep_draw_hidden_field('products_id', $listing['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary') . '</span></td>' . $prod_list_contents_attributes . '</form>'; // jQuery osCart END break; } } $prod_list_contents .= ' </tr>'; } $prod_list_contents .= ' </table>' . ' </div>' . '</div>'; echo $prod_list_contents; } else { ?> <p><?php echo TEXT_NO_PRODUCTS; ?></p> <?php } if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) { ?> <br /> <div> <span style="float: right;"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></span> <span><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></span> </div> <?php } ?> </div>
  12. No problem at all, after years of leeching from other contributors I want to give something back to the oscommerce community now when I can. :) It seems to be working for me and I'm also testing on a fresh 233 install, here is my jquery-oscart.js code, try to replace your entire code with mine: /* jQuery Shopping Cart * * Published under GNU License * * 2010/07/01 - by delete ( [email protected] ) * 2010/07/14 - by delete ( [email protected] ) - Added Attributes support * 2013/05/31 - by Dr. Rolex - Added support for product listing and osCommerce 2.3.3 * 2013/06/03 - by Dr. Rolex - Supports multiple product images, Improved animation */ $(document).ready(function() { // Add to cart for product_info page // $('.buttonAction_oscart').click(function() { // Partial Source code from : http://webresourcesdepot.com/wp-content/uploads/file/jbasket/fly-to-basket/ var productId = $(this).attr('id'); var $oldprod = $('#cart-image-' + productId ); //First we clone the image to the shopping cart and get the offset var $newprod = $oldprod.clone().appendTo('#boxcart-content'); var newOffset = $('#boxcart-content').offset(); //Get the old position var oldOffset = $oldprod.offset(); //Clone the old image for use in animation var $tempprod = $oldprod.clone().appendTo('body'); //Hide new image and set css attributes //Use big z-index, make sure to edit this to something that works with the page $tempprod .css('position', 'absolute') .css('left', oldOffset.left) .css('top', oldOffset.top) // .css('border', '1px dashed black'); //Optional dashed square around image .css('zIndex', 1000); $newprod.hide(); // $oldprod.hide(); //Optional hide image on start of animation (Uncomment $oldprod.show(); below together with this) //Animate the $tempprod to the position of $newprod $tempprod .animate({opacity: 0.4}, 40) //First value is how transparent image is at start of animation; Last value is millisec until animation starts .animate( { opacity: 0.0, // Transparency of image at end of animation 'top': newOffset.top, // How high we will fly 'left':newOffset.left, // How far we will fly width: $oldprod.width() / 3, // Resize image width on animation height: $oldprod.height() / 3 // Resize image height on animation }, 1000, function(){ // Value is total time for animation to finish //Callback function, we remove $newprod and $tempprod $newprod.remove(); $tempprod.remove(); // $oldprod.show(); //Optional show image on end of animation (Uncomment $oldprod.hide(); above together with this) products_id = productId ; qty = parseInt($('#pq-' + productId).html()); if ( qty ) qty = qty + 1 ; else qty = 1 ; // Look for attributes // products_attributes = '' ; $('form[name=cart_quantity]').find('select option:selected').each(function() { products_attributes += '{' + $(this).parent().attr('name').replace(/[^0-9]/g, '') + '}' + $(this).val() ; }); if ( products_attributes != '' ) products_id = products_id + products_attributes; // Delete button in shopping cart infoboxe // new_button = $('#boxcart-button-remove').clone() ; new_button.find('a').attr('id', 'bcr' + $('input[name="products_id"]').val()) ; new_button.find('a').attr('rel', products_id) ; // Products details in shopping cart infoboxe // product_name = '<tr id="pc-' + products_id + '"><td align="right" valign="top"><span class="newItemInCart">'; product_name += '<span id="pq-' + products_id + '">' + qty +'</span> x </span></td><td valign="top"><span class="newItemInCart">' ; product_name += $('#pi-product-info-' + productId).html() ; product_name += '</span>' ; product_name += new_button.html() ; product_name += '<input type="hidden" name="products_id[]" value="' + products_id + '" />' ; product_name += '<input type="checkbox" name="cart_delete[]" value="' + products_id + '" style="display:none;" />' ; product_name += '</td></tr>' ; // Updating infobox content Ta bort Dubblering $("#boxcart-total-area").show(); $.ajax({ type: 'POST', url: encodeURI($('form[name=cart_quantity-' + productId + ']').attr('action')) + '&show_total=1&ajax=1', data: $('form[name=cart_quantity-' + productId + ']').serialize(), success: function(data) { $('#boxcart-total').html(data); update_cart(); } }); // Remove product from infobox list // $(document.getElementById('pc-' + products_id)).remove() ; // Product count // count = $('tr[id^="pc-"]').size() ; if ( count == 0 ) $('#boxcart-content').html('') ; //update_cart(); // Append product to the list $('#boxcart-content').append( product_name ) ; $('#' + new_button.find('a').attr('id') ).click(function() { return($(this).boxcart_remove()); }); }); return(false) ; }); // Update cart infobox // function update_cart() { $.ajax({ type: 'POST', url: encodeURI($('form[name=boxcart_quantity]').attr('action')) + '&count_contents=1&ajax=1', data: $('form').serialize(), success: function(data) { $('#headercart').html(data); } }); return(false); } // Remove from cart infobox // $.fn.boxcart_remove = function() { products_id = $(this).attr('rel') ; if ( ! confirm( $('#boxcart-text-remove').html() + ' ?' ) ) return false ; $('input[value="' + products_id + '"][name=\"cart_delete[]\"]').attr('checked', true) ; // Refresh entire page if current page is shopping_cart.php ! // url = $(location).attr('href').split("/"); filename = url[url.length - 1]; filename = filename.split('\?')[0] ; if ( filename == 'shopping_cart.php' ) { $('form[name=boxcart_quantity]').submit(); } // Updating cart total // $.ajax({ type: 'POST', url: encodeURI($('form[name=boxcart_quantity]').attr('action')) + '&show_total=1&ajax=1', data: $('form[name=boxcart_quantity]').serialize(), success: function(data) { $('#boxcart-total').html(data); update_cart(); } }); $(document.getElementById('pc-' + products_id)).remove() ; // Product count // count = $('tr[id^="pc-"]').size() ; if ( count == 0 ) { $("#boxcart-total-area").hide(); $('#boxcart-content').html('<tr><td align="right" valign="top">' + $('#boxcart-text-empty').html() + '</td></tr>') ; } return(false); } $('.boxcart-remove').click(function() { return($(this).boxcart_remove()); }); // Remove from cart // $.fn.cart_remove = function() { products_id = $(this).attr('rel') ; $(document.getElementById('pc-' + products_id)).remove() ; ; $('input[value="' + products_id + '"][name=\"cart_delete[]\"]').attr('checked', true) ; $.ajax({ type: 'POST', url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&show_total=1&ajax=1', data: $('form').serialize(), success: function(data) { $('#boxcart-total').html(data); } }); $.ajax({ type: 'POST', url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&ajax=1', data: $('form[name=cart_quantity]').serialize(), success: function(data) { $("#content-body").html(data); update_cart(); }, dataType: 'html' }); return(false); } $('.cart-remove').click(function() { return($(this).cart_remove()); }); // Plus or Minus function // $('.update-qty').click(function() { products_id = $(this).attr('rel') ; val = parseInt( $('input[id="pl' + products_id + '"][name=\"cart_quantity[]\"]').val() ) ; action = $(this).attr('class').split(' ').slice(-1) ; if ( action == 'plus' ) { val = val + 1 ; } else if ( action == 'moins' ) { if ( val <= 0 ) return(false) ; val = val - 1 ; } else { return(false) ; } $('input[id="pl' + products_id + '"][name=\"cart_quantity[]\"]').val(val) ; // osCommerce default shopping cart infoboxe product line : // product_name = '<tr id="pc-' + products_id + '"><td align="right" valign="top"><span class="newItemInCart">'; product_name += '<span id="pq-' + products_id + '">' + val + '</span> x </span></td><td valign="top"><span class="newItemInCart">'; product_name += $(document.getElementById('pn-' + products_id)).html() ; product_name += '</span>'; product_name += $('#boxcart-button-remove').html() ; product_name += '<input type="hidden" name="products_id[]" value="' + products_id + '" />' ; product_name += '<input type="checkbox" name="cart_delete[]" value="' + products_id + '" style="display:none;" />' ; // Look for attributes // products_attributes = '' ; $('form[name=cart_quantity]').find('select option:selected').each(function() { products_attributes += '{' + $(this).parent().attr('name').replace(/[^0-9]/g, '') + '}' + $(this).val() ; }); if ( products_attributes != '' ) products_id = products_id + products_attributes; product_name += '</td></tr>' ; // Updating infobox content // // Remove product from infobox list // $(document.getElementById('pc-' + products_id)).remove() ; // Append product to the list // $('#boxcart-content').append( product_name ) ; $.ajax({ type: 'POST', url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&ajax=1', data: $('form[name=cart_quantity]').serialize(), async:false, success: function(data) { $("#content-body").html(data); update_cart(); }, dataType: 'html' }); // Updating cart total // $.ajax({ type: 'POST', url: encodeURI($('form[name=cart_quantity]').attr('action')) + '&show_total=1&ajax=1', data: $('form').serialize(), success: function(data) { $('#boxcart-total').html(data); } }); return(false); }); $('.update-qty').css('visibility', 'visible'); $('.cart-remove').css('visibility', 'visible'); $('.boxcart-remove').css('visibility', 'visible'); $('input[name=\"cart_delete[]\"]').css('display', 'none'); });
  13. Hello Mr. Baumfist, I think I have solved your problems. I don't use attributes myself so that's why I never cared to see if they worked. Could you please make the following modifications to jquery-oscart.js and report back if it worked for you: Find: $('form[name=cart_quantity-' + productId + ']').find('select option:selected').each(function() { Replace with: $('form[name=cart_quantity]').find('select option:selected').each(function() { Find & Replace ALL occurrences of (I think there is 4 in total): $('tr[id=pc-' + products_id + ']').remove() ; With: $(document.getElementById('pc-' + products_id)).remove() ;
  14. New version uploaded: http://addons.oscommerce.com/info/8790 Added Features on Rev 1.1: Supports multiple product images on the "product_info" page Improved jQuery animation Added some comments on how to customize the animation
  15. OK people! I've solved the multiple pictures problem and also managed to improve the animation itself. I'll upload the new version as soon I'm done with the damn instructions for it. :thumbsup: Also, I'll add some info in the jquery-oscart.js file for easy understanding if you want to modify some part of the animation. Best regards, Dr. Rolex
  16. Hello Nico! I'm glad you appreciate the work. I have easily used up more than 100 hours in total to "perfect" this contribution. But it has been a great project to learn more php and javascript. All credit goes to the original contributor delete13 of course. I hadn't notice the problem with multiple images, but I'm working on a solution. I just need to recode the animation javascript. The problem is that all the images gets the same id tags. I'll post the solution as soon as I have it. Best regards, Dr. Rolex
  17. Couldn't edit my post... Correct code is: Replace with: }) .slideUp(); return(false) ; });
  18. Another minor update to make the cloned product picture slideup after the animation completes: (Without this the cloned image will still be clickable to the right of the shopping cart even if it's hidden) In ./ext/modules/shopping_cart/jquery-oscart.js On line 115 Find: }); return(false) ; }); Replace with: }) .slideUp(); return(false) ; Also, if you have a modified product listing (e.g. "CSS product lists"), you can post your code here and I'll try to help you modify it.
  19. How do you mean localhost? Did you copy the files from catalog/ or did you modifiy the ones you already have? Also, the jquery-oscart.js was in the wrong directory. Make sure that it's located under ./ext/modules/shopping_cart/jquery-oscart.js
×
×
  • Create New...