Adli Posted July 24, 2012 Share Posted July 24, 2012 (edited) Bonjour, J'ai un soucis concernant le panier ajax, en effet lors de la première visite, il est ouvert, l'on peut alors ajouter des produits, l'animation vers le panier est OK, le calcul shipping+total est OK mais les produits ne s'affichent pas (il faut pour cela rafraichir la page), le deuxième soucis étant que lorsque l'on ferme ne serait-ce qu'une seule fois le panier on ne peut plus l'ouvrir ... Je n'arrive pas à comprendre d'ou ces deux problèmes viennent surtout que je n'ai pas modifié ajax-cart.js Merci d'avance de votre aide Adli PS: Le lien du site http://purenegoce.com/shop/ FR///EN Hi, I've a problem with the ajax cart, when you visit the website for the first time, it is open, so you can add some products inside, animation to cart is OK, calcul shipping+total is OK, but the products doesn't appear in the cart(you must reload the page to see them), the second problem is that when you close the cart just one time you cannot open it one more time... I don't understand this two bugs in according to I don't modify the ajax-cart.js file I hope you could help me Adli PS: The link : http://purenegoce.com/shop/ Edited July 24, 2012 by Adli (see edit history) Link to comment Share on other sites More sharing options...
Serios Posted September 21, 2012 Share Posted September 21, 2012 (edited) Hi, I hope you already find solution to the problem, but if you not, here it is: In ajax-cart.js find following: about line 96 ... // try to expand the cart expand : function(){ ... and about line 139 ... // try to collapse the cart collapse : function(){ ... These are the functions responsible for expanding/collapsing the cart block. Now look carefull in the rows after functions start, you must see the following in both functions: ... $('#header #cart_block ... on 2 places in each function what this code do is to tell javascript to look in div container with id=header for div container with id=cart_block and after that, to do something with it. This is no problem if you transplant cart block in header part of you theme, but if you put it in anywhere else (for example in right column) it will stop working, because cart_block div is no longer in header div. Just remove each #header instances in both functions and presto - cart block expand/collapse working sitewide P.S. I think this should be changed in new versions of prestashop by developers team, because there is no logic cart block expand/collapse option to work only in header of the theme Edited September 21, 2012 by Serios (see edit history) 2 Link to comment Share on other sites More sharing options...
Adli Posted September 22, 2012 Author Share Posted September 22, 2012 Thank's a lot guy that works you make my day happier !! have nice day Link to comment Share on other sites More sharing options...
sadlyblue Posted November 28, 2012 Share Posted November 28, 2012 Thanks Serios, it worked like a charm... Btw, i was looking for a way to limit the amount of items to display in cart (maybe the last 5) and some '...' before them. Is there a way to do this? Thanks again Pedro Link to comment Share on other sites More sharing options...
Serios Posted November 28, 2012 Share Posted November 28, 2012 Thanks Serios, it worked like a charm... Btw, i was looking for a way to limit the amount of items to display in cart (maybe the last 5) and some '...' before them. Is there a way to do this? Thanks again Pedro You wont list to be expandable with "View more..." link or just list with last five items added to cart? Link to comment Share on other sites More sharing options...
sadlyblue Posted November 28, 2012 Share Posted November 28, 2012 I want the list expanded to have the last 5 items. and beggining with a '... last products' if there are more than 5. Sometimes clients have a lot of products in cart, which a part from not looking that great, i think slows a little more the website. Having this limit on how many items can be seen in the left column, even when expanded, will improve it. I have found the file that needs to be changed, but don't know the variable to get the total number of products(items) in cart. Link to comment Share on other sites More sharing options...
Serios Posted November 28, 2012 Share Posted November 28, 2012 (edited) I want the list expanded to have the last 5 items. and beggining with a '... last products' if there are more than 5. Sometimes clients have a lot of products in cart, which a part from not looking that great, i think slows a little more the website. Having this limit on how many items can be seen in the left column, even when expanded, will improve it. I have found the file that needs to be changed, but don't know the variable to get the total number of products(items) in cart. Ok I'm not tested this, because i don't have access to my local server, but it should work: in file blockart.tpl around line 72 you have: {foreach from=$products item='product' name='myLoop'}.... after this put following code: {if $smarty.foreach.myLoop.index == 5} ... last products {break} {/if} what this code do, is to check "foreach" index. If it has value of 5, then we are getting 5-th element so break the foreach loop and continue with rest of the code. Also in this way you limiting foreach loop results to 5 not to last 5. I don't remeber well but think, that when adding products to cart the order is that the latest added became first in the list. If you don't pleased with results I can check and test later for more appopriate code. Edited November 28, 2012 by Serios (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now