Jump to content

Cart block is not updating when enable Ajax add-to-cart


Recommended Posts

Hi,

 

I am using prestashop 1.5.3.

I have just install a fresh copy of PS v1.5.3 and just transplant block cart module to left column.

 

Now when I add a product to cart then Cart in header section is updated but cart block in left section

does not updated properly. it says "No products" but cart price is updated.

Same thing is happening while I delete products from cart.

Some times header section cart updated and some times left section.

 

 

I think this is Prestashop.

If anybody has solution for this. then please help me.

Link to comment
Share on other sites

Hello,

I was as well setting the cart for hours.... Just write to you my result.

The cart module should be hooked only in pages header, and top of pages.

Or should be hooked only in pages header, and left / or right culumns.

Than it works fine, showing no.of items , refreshing the total of products after deleting

one of items from the cart as well.

If the cart module is hooked in page header, top of pages and as well in left / or right culumns,

there will be some errors - like I have, refreshing update only after additional page refresh, or after

another "delete item" button.

This is my setting on fresh instal PS 1.5.4.1, will see how it goes with new template.

Miro.

post-336597-0-61278100-1368286292_thumb.jpg

Link to comment
Share on other sites

if we put block cart in two positions, then our front end have got two the same blocks with the same ID of elements.

 

So, javascript reload only first of them - in this case it's a block cart in header.

If we want to have got ajax block cart in one of the column - we must remove blockcart from top.

 

after that ajax will work properly.

 

regards

Link to comment
Share on other sites

you have to change ajax script located here: modules/blockcart/ajax-cart.js

 

you've got there:

 

$('.ajax_cart_total').text($.trim(jsonData.productTotal));

 

you may add new jquery, where you will change the values in right / left cart block

 

don't forget about other fields like product list, quantities etc.

Link to comment
Share on other sites

  • 4 months later...
  • 3 weeks later...

Well I did some changes at the theme by my own. So Im the theme creator.. but not yet that familiar with presta.

 

Did not do big changes and already tried to undo al of them but without any better result...

 

Is there no fix in the js File? There must be a solution....

Link to comment
Share on other sites

jep loading the page following errors come up:

 

But this errors are not related to my problem.. as I recognized now.. please continue to my next posting..


	
	



TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	




TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
				index....product (Zeile 36)
			
		
	



TypeError: offset is null


	
		
			
				
			
				 offset.top-50) {" class="errorSourceCode ">if ($(window).scrollTop() > offset.top-50) {
		
	


Edited by codefritz (see edit history)
Link to comment
Share on other sites

Oh this error is clear.. it has it's origin by an own modification from me in order to solve the problem, added the following lines of code at the end of the function "add"

 

 

        ajaxCart.updateCartInformation(jsonData, addedFromProductPage);

        ajaxCart.refresh();

        alert('dsd');

Link to comment
Share on other sites

  • 1 year later...

you have to change ajax script located here: modules/blockcart/ajax-cart.js

 

you've got there:

 

$('.ajax_cart_total').text($.trim(jsonData.productTotal));
you may add new jquery, where you will change the values in right / left cart block

 

don't forget about other fields like product list, quantities etc.

 

Great, it works on PS1562!

Link to comment
Share on other sites

×
×
  • Create New...