Understanding the "Add to Cart" AJAX call...

  • webjocky
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 3 months ago #54796 by webjocky
From an EShop Product module, when clicking on "Add to Cart" and then selecting "Continue shopping" from the resulting popup - the Shopping Cart mini view is completely overwritten with new HTML for the updated cart information.
I need to modify the HTML that this AJAX call uses to overwrite the cart's mini view - where can I find it?

Please Log in or Create an account to join the conversation.

  • Giang Dinh Truong
  • Offline
  • Administrator
  • Administrator
More
9 years 3 months ago #54810 by Giang Dinh Truong
Replied by Giang Dinh Truong on topic Understanding the "Add to Cart" AJAX call...
Hello,
You can find the cart mini view in the file: components/com_eshop/themes/default/views/cart/mini.php
Sincerely, Giang

Please Log in or Create an account to join the conversation.

  • webjocky
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 3 months ago - 9 years 3 months ago #54843 by webjocky
Replied by webjocky on topic Understanding the "Add to Cart" AJAX call...
Yes, I already created a custom theme and I have edited that file - it looks great! However, every time you add an item to the cart, the mini view is overwritten with the default HTML again - until page refresh... this is what I need to fix

I guess the AJAX call is not pulling from the same file?
I found this in the eshop.js file:
Code:
Line 49: jQuery.ajax({ url: site + 'index.php?option=com_eshop&view=cart&layout=mini&format=raw'
Is there a variable missing to use the proper theme or something else?
Last edit: 9 years 3 months ago by webjocky.

Please Log in or Create an account to join the conversation.

  • Giang Dinh Truong
  • Offline
  • Administrator
  • Administrator
More
9 years 3 months ago #55061 by Giang Dinh Truong
Replied by Giang Dinh Truong on topic Understanding the "Add to Cart" AJAX call...
Hi again,
You should to update the mini cart module layout and the mini ajax layout from the EShop component:

1. components/com_eshop/themes/default/views/cart/mini.php
Sincerely, Giang
2. modules/mod_eshop_cart/tmpl/default.php

Hope that this will help.
Sincerely, Giang

Please Log in or Create an account to join the conversation.

  • webjocky
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 2 months ago - 9 years 2 months ago #56450 by webjocky
Replied by webjocky on topic Understanding the "Add to Cart" AJAX call...
I finally found the file I was looking for. It took me forever!

Once something is added to the cart, the same AJAX call I referenced above is also in the following file:
components/com_eshop/assets/js/eshop.js

So to clarify for anyone else that needs to modify the minicart layout/functionality, you must edit all three of these files:
1. components/com_eshop/themes/default/views/cart/mini.php
2. modules/mod_eshop_cart/tmpl/default.php
3. components/com_eshop/assets/js/eshop.js

Giang, can you consolidate these AJAX calls (add to cart, remove from cart) for the cart mini view into the same file? It seems very redundant to have the same exact code in three different files all called at different times for the same purpose. Very difficult to find and troubleshoot mini cart view problems.

Thank you for your great support!
Last edit: 9 years 2 months ago by webjocky.

Please Log in or Create an account to join the conversation.

  • Giang Dinh Truong
  • Offline
  • Administrator
  • Administrator
More
9 years 2 months ago #56514 by Giang Dinh Truong
Replied by Giang Dinh Truong on topic Understanding the "Add to Cart" AJAX call...
Hello,

Actually, with ajax call to update the cart so I must put them in mini layout of component. The mini cart is updated from ajax call from module, ajax call from component so we have no other way to put them all in module.

Sincerely, Giang

Please Log in or Create an account to join the conversation.

Moderators: Giang Dinh Truong