Add To Cart Button Issues

  • Posts: 9
  • Thank you received: 0
12 years 7 months ago #25428

I'm having trouble getting our 'Add to Cart' button working. I click it and nothing happens.

I'm not sure exactly when it stopped working (we had some server issues and we also had to swap out our SQL files yesterday and flush our expired cache today) so it may or may not be a result of either of those, but I just inherited the site from another webmaster and am not that familiar with Joomla to make any big changes to try and troubleshoot in the blind.

Any help would be very much appreciated. The product having the issue is here .

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
12 years 7 months ago #25442

That's strange.

Here is the URL ued by HikaShop in AJAX:
energytrainingresources.com/videos-world...xpbmcvY2hlY2tvdXQ%3D
If you open it, you will see that it returns the content of the cart with the correct HTML. However, the HTTP return code is 404 and not 200. That's really strange as it should not return the HTML in that case and moreover not the correct one.

I don't have a perfect solution for you. What you should start with is to turn off the option "Use AJAX when possible for add to cart buttons" of the config of HikaShop. That will remove the AJAX call and use instead a normal form submit. That might help circumvent the problem.

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

  • Posts: 9
  • Thank you received: 0
12 years 7 months ago #25446

Thank you for the help. The button now at least is executing some HTML, but it no longer adds anything to the cart. It just says the cart is empty and brings me to my default product category as opposed to before where items would be added to the cart, but you would have to refresh the page for it to update.

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
12 years 7 months ago #25455

Please deactivate the joomla cache of your configuration and the cache plugin. Caching will interfere with the execution of HikaShop pages so you should have it disabled.

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

  • Posts: 1
  • Thank you received: 0
12 years 7 months ago #25495

After deactivating it..Is it ok then..

Last edit: 12 years 7 months ago by nicolas.

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

  • Posts: 9
  • Thank you received: 0
12 years 7 months ago #25575

No it hasn't. My cache was already disabled so unfortunately that didn't anything.

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
12 years 7 months ago #25582

The cache plugin is also disabled ?

Could you turn on the joomla debug mode in the joomla config and try again ? Do you get any error at that point ?

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

  • Posts: 9
  • Thank you received: 0
12 years 7 months ago #25644

I'm not exactly sure what I should be looking for in debug mode. But to answer your question, yes, both the system cache are turned off in the global config and plugins.

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

  • Posts: 9
  • Thank you received: 0
12 years 7 months ago #25645

All I need is when you click on the "Add to Cart" button, that it takes you to the checkout. With Ajax disabled, the HTML works, but quantities do not update correctly. When I have Ajax buttons enabled, the quantities perform correct queries but do not bring me to the write pages. Could I possibly hard code something into the button so when it scripts, the button has the HTML build into the PHP instead of trying to reference other values?

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
12 years 7 months ago #25647

Once the debug mode is turned on in joomla, if there is a mysql error during the process of adding the product to the cart, you will see an error message with all the necessary information for us to tell you what to do. That's why I told you to do that.

Did you do ? Did you get any error ?

What I proposed was a way to circumvent the problem that you have on your website where the HTTP status returned by the add to cart page is 404 instead of 200. What you could try is the remove the tmpl parameter of the URL which might be the reason why the website doesn't produce a 200 return code. For that, you could try to add the line below after the first <?php tag of the file "cart" of the view "product" that you can edit via the menu Display->Views:
JRequest::setVar('tmpl','');

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

  • Posts: 9
  • Thank you received: 0
12 years 7 months ago #25653

The code in PHP only partially worked in Firefox (Qtys were still unchangeable in checkout) and didn't work in IE. As for the debug, everything looks normal, I don't see any errors, but I don't know what I'm looking for really. I can send you the debug(s).

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
12 years 7 months ago #25661

That code was to try to avoid the 404 error when adding a product to the cart. It has no link to the quantity update of the cart. Note that this is a bug no one had so far, so I'm only guessing solutions here.
Since you also seems to have a similar problem on the checkout, I would say that there is something interfering with HikaShop on you website. What are the system plugins installed on your website ? What are the options of your template ?
It's either coming from an extension on your website or the way your server is configured.

If you didn't see anything particular with the debug mode on, it means that you don't have any mysql error and that rules out a problem of database setup during the install/update process of HikaShop. So it reinforces my idea of something else interfering with HikaShop on your website...

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

  • Posts: 9
  • Thank you received: 0
12 years 6 months ago #25755

Ok, I figured it out. I had SEF turned on, and that's what was causing all the issues. Is there a way to enable it however and have the two work together?

Thanks again for all this help.

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
12 years 6 months ago #25756

Well, SEF is working fine with hikashop on lots of websites... Could you give more info on your SEF ? Do you use joomla SEF? which version of joomla ? What SEF options did you set ?

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

  • Posts: 9
  • Thank you received: 0
12 years 6 months ago #25757

I have 1.5.23 and was just using the standard built in SEF. My current settings are now:

Search Engine Friendly URLs: No
Use Apache mod_rewrite: Yes
Add suffix to URLs: No

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
12 years 6 months ago #25759

Then you should not have these problems.

It works on our end with such setup. We even have that setup on our own website.

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

  • Posts: 9
  • Thank you received: 0
12 years 6 months ago #25760

Is there code I could put in the SEF php that would tell it to bypass if making an ajax request or something like that which would be specific to Hikashop's url pattern?

Edit: Ok, so I've resolved everything. The .htaccess file needed some alterations. Basically I needed to have added a period in front of htaccess which is why none of my SEF changes were being made correctly. Everything (to my knowledge) now works.

Thank you lots for the help.

Last edit: 12 years 6 months ago by apt915.

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

Time to create page: 0.090 seconds
Powered by Kunena Forum