Jump to content
delete13

jQuery/Ajax Shopping Cart

Recommended Posts

I've tried it. It's a great idea to map the attributes directly in the produckt_listing.

The buyer can immediately see where he can choose something or not. So far so good.

 

But unfortunately now the thumbs fly not more, when you press the "buy_now" button in the produkt_listing (whether for products with attributes or not).

Instead, you will be always connected to the shoping_cart after pressing it.

 

It would be really great if the thumbs in produkt_listing would now also fly to infobox_shopping_cart, regardless of whether the product has attributes or not.

Without always connecting to the shoping_cart. Because now the buyer has the overview already in the product_listing.

 

Thanks for your effort!

 

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 ( olivier@smartmarseille.com )
* 2010/07/14 - by delete ( olivier@smartmarseille.com ) - 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');
});

Share this post


Link to post
Share on other sites

So it is, you have changed something in the jquery-oscart.js. I have copied your code in the jquery-oscart.js and then everything worked fine. I am very grateful to you. I would probably need months to resolve it.

 

I have two more questions: Is it complicated to display the thumbnails also in the small shopping_cart_infobox (similar to the shopping_cart, only slightly smaller)?

Which part of the code in the jquery-oscart.js determine the flight direction of the thumbnails?

Share this post


Link to post
Share on other sites

So it is, you have changed something in the jquery-oscart.js. I have copied your code in the jquery-oscart.js and then everything worked fine. I am very grateful to you. I would probably need months to resolve it.

 

I have two more questions: Is it complicated to display the thumbnails also in the small shopping_cart_infobox (similar to the shopping_cart, only slightly smaller)?

Which part of the code in the jquery-oscart.js determine the flight direction of the thumbnails?

 

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

Share this post


Link to post
Share on other sites

Ok cool thing!

That sounds good. I'm looking forward to it!

 

I've searched for a long time after such an addon, but never found anything functioning properly.

Your addon is so far the best solution. I think that many other Oscommerce users will be pleased about it.

Share this post


Link to post
Share on other sites

Ok cool thing!

That sounds good. I'm looking forward to it!

 

I've searched for a long time after such an addon, but never found anything functioning properly.

Your addon is so far the best solution. I think that many other Oscommerce users will be pleased about it.

 

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

Share this post


Link to post
Share on other sites

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.

Edited by Dr. Rolex

Share this post


Link to post
Share on other sites

I found a bug on this latest version. This bug occurs on firefox and on google chrome. On internet explorer it is absolutely fine. Description below:

 

On firefox and google chrome whenever the user first visits the homepage, you can drag the products fine however the cart does not update unless you click another link. I used this version on the default store so the products are on the homepage which you can drag. So you can also test this. The user is not logged in when this happens. Also the user can either click another link before dragging the products off the homepage and then it will work.

 

I'll try find out myself why but you seem to be the expert ;)

Edited by Hussey07

Share this post


Link to post
Share on other sites

I found a bug on this latest version. This bug occurs on firefox and on google chrome. On internet explorer it is absolutely fine. Description below:

 

On firefox and google chrome whenever the user first visits the homepage, you can drag the products fine however the cart does not update unless you click another link. I used this version on the default store so the products are on the homepage which you can drag. So you can also test this. The user is not logged in when this happens. Also the user can either click another link before dragging the products off the homepage and then it will work.

 

I'll try find out myself why but you seem to be the expert ;)

 

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 } ?>

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

I tried that and it worked :D tried it yesterday before you asked now look who is an expert :P

 

Now onto the next problem. On all three browsers, firefox, chrome, and internet explorer. I tried this with the default store. The cart contents at the top does not change and the total price within the shopping cart box does not change when you first visit the page. You will have to click on another link for it to update. Once you have clicked on another link the first time you are then able to drag as many products you want and it works perfectly and then you will not have to click on another link for it to update.

 

I have put some pictures of the example to help you understand what i mean.

 

1st Image of when you first visit the store, once you close the browser and re-open the browser and first go to the store. Once you start adding products straight away and try delete the products from the shopping cart the cart contents and the total price does not update unless a new link is clicked. After than it is fine.

 

http://imageshack.us/a/img594/4379/5mp.png

 

2nd picture is again the same situation of first visiting the store once closing and re-opening the browser. You can see the shopping cart does not update and nor does the total price.

 

http://imageshack.us/a/img109/3506/21i.png

 

Again i will try to find a solution before you do :D

Edited by Hussey07

Share this post


Link to post
Share on other sites

Oh in addition to this, unless the user clicks another link before they add products to the shopping cart or delete the products from the shopping cart the products which were originally there will still be there and will only be removed once they click another link and then edit the shopping cart.

 

They only have to click another link once, after that it works fine as long as they don't close the tab or store. I think this might be a session problem.

Share this post


Link to post
Share on other sites

Oh in addition to this, unless the user clicks another link before they add products to the shopping cart or delete the products from the shopping cart the products which were originally there will still be there and will only be removed once they click another link and then edit the shopping cart.

 

They only have to click another link once, after that it works fine as long as they don't close the tab or store. I think this might be a session problem.

 

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() {

Share this post


Link to post
Share on other sites

You sir are genius. It was because i had it as site.com, i had to edit it so i had an ssl connection because i had an ssl certificate. Thumbs up. Awesome add-on :D

Edited by Hussey07

Share this post


Link to post
Share on other sites

Everything works perfect except for one thing. If i was to use a ssl connection, e.g. https://www.mysite.com/account.php, everything with the jquery becomes dead. I get the error on the javascript console on google chrome: Uncaught Error: NETWORK_ERR: XMLHttpRequest Exception 101 .

 

:wacko:

Share this post


Link to post
Share on other sites

Everything works perfect except for one thing. If i was to use a ssl connection, e.g. https://www.mysite.com/account.php, everything with the jquery becomes dead. I get the error on the javascript console on google chrome: Uncaught Error: NETWORK_ERR: XMLHttpRequest Exception 101 .

 

:wacko:

 

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.

Share this post


Link to post
Share on other sites

Yup you understand it correctly. As long as i don't use an SSL connection everything works fine. I will try your solution and see what happens :) Thanks

Share this post


Link to post
Share on other sites

Path : shopping_cart.php?show_total=1&ajax=1&osCsid=c8b9c342190d1a81fd2383567c3e88c5

 

method: post

 

status: OK

 

type: text/html

 

initiator: jquery.min.js:6

 

this is what came up on the nextwork tab

Share this post


Link to post
Share on other sites

Path : shopping_cart.php?show_total=1&ajax=1&osCsid=c8b9c342190d1a81fd2383567c3e88c5

 

method: post

 

status: OK

 

type: text/html

 

initiator: jquery.min.js:6

 

this is what came up on the nextwork tab

 

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..

Share this post


Link to post
Share on other sites

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..

 

Some relatively good news. I have changed the version of jquery being used to 1-9-1, and that has got rid of the error, however in the console it just reads cookie_usage.php if i change the sessions in the admin page to true. However i am able to now drop the products into the shopping cart however the cart contents and the total price does not update, and if i click another link the item which you dragged into the shopping cart disappears.

Share this post


Link to post
Share on other sites

when you add products.

If i keep the jquery version as 2-0-2, then the source of the error seems to be line 6 of the googleapis file. This is the error i get on firefox.

 

 

 

Timestamp: 01/07/2013 09:19:04

Error: NS_ERROR_FAILURE: Failure

Source File: https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js

Line: 6

 

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.

Share this post


Link to post
Share on other sites

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.

 

I think the easiest thing to be would be to just not show any shopping cart or products on any of the pages which have a ssl connection, e.g. the checkout, the account page and login. This wouldn't solve the problem literally but still is viable solution as none of the pages which have an ssl connection need to have any products or shopping cart visual on them.

Share this post


Link to post
Share on other sites

I think the easiest thing to be would be to just not show any shopping cart or products on any of the pages which have a ssl connection, e.g. the checkout, the account page and login. This wouldn't solve the problem literally but still is viable solution as none of the pages which have an ssl connection need to have any products or shopping cart visual on them.

 

Sounds more like you're giving up!? :rolleyes:

 

Why don't you use SSL on all pages instead?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×