timot Posted October 11 Share Posted October 11 Hello, I would like my cart button to show the whole ajax blockcart modal instead of showing a dropdown menu. On the cart button I've tried to change data-toggle="dropdown" to data-toggle="blockcart-modal" with no success... onclick="prestashop.blockcart.showModal()" doesn't work either, with no javascript error. I can't find any info on how to trigger the cart modal show up. Would anyone have any idea ? Link to comment Share on other sites More sharing options...
timot Posted October 12 Author Share Posted October 12 (edited) If think I should have mentioned it, is use the falcon starter theme, with its is_blockcart module. The modal block get triggered by this function : https://github.com/Oksydan/is_shoppingcart/blob/731b7ba31ab7e05747c98b4c197046384886cd3e/_theme_dev/src/js/theme/index.js#L74 Then I guess I should find a way to trigger this prestashop.on('updateCart') event ? (do you think this is possible without updating the cart content ?) nothing happens with : onclick="prestashop.updateCart" or copy and adapt the whole function... Edited October 12 by timot (see edit history) Link to comment Share on other sites More sharing options...
ps8modules Posted October 12 Share Posted October 12 Hi. If you have a template other than classic installed, how can we advise you if we don't see what you need and we don't even know your version of Prestashop. Please give us a screenshot of what you have now and what you need. Link to comment Share on other sites More sharing options...
timot Posted October 12 Author Share Posted October 12 (edited) Thanks for your answer @ps8modules Sorry I try to keep it simple as much as possible... It's true I use is_shoppingcart and I don't really know how much it differs from ps_shoppingcart... My question might be misplaced ? Then I try to copy this ajax function but no matter what, I can't get this modal content : I'm trying to keep it short : const refreshURL = document.querySelector('.js-blockcart').dataset.refreshUrl; let requestData = {}; requestData = { ajax: 1, }; requestData = Object.keys(requestData).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(requestData[key])}`).join('&'); fetch(refreshURL, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, body: requestData, }) .then((resp) => resp.json()) .then((resp) => { if (resp.modal) { showModal(resp.modal); } }) refreshURL is set to /module/is_shoppingcart/ajax With this code I do have a resp.preview but I don't get any resp.modal Whereas in the orginal function the only difference (I think) was that requestData were more populated (because of the updating of the cart) : requestData = { id_customization: event.reason.idCustomization, id_product_attribute: event.reason.idProductAttribute, id_product: event.reason.idProduct, action: event.reason.linkAction, ajax: 1, }; And resp.modal was filled. Would you think of any way to force this modal setting while fetching /module/is_shoppingcart/ajax ? Edited October 12 by timot (see edit history) Link to comment Share on other sites More sharing options...
timot Posted October 12 Author Share Posted October 12 ok I think I get the problem : modal is only set for add-to-cart action on this line : https://github.com/Oksydan/is_shoppingcart/blob/731b7ba31ab7e05747c98b4c197046384886cd3e/controllers/front/ajax.php#L21 I'm sorry if I'm polluting the forum, I didn't thought it would be so specific to this theme and this plugin. I hope it might be helpful to anyone. 1 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