Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Items not getting added to the Cart
 
mdumka
Member
 
Avatar
Total Posts:  56
Joined:  2008-02-28
 

Hello ...

I have a few items that once I click add to the cart nothing happens ... If there is something in the cart already I get the message product XXX was added to cart successfully ... even though nothing is there.

If there is nothing in the cart I am taken to your cart is empty screen, continue shopping.

Any one know what is going on?

Mike

 
Magento Community Magento Community
Magento Community
Magento Community
 
mdumka
Member
 
Avatar
Total Posts:  56
Joined:  2008-02-28
 

Hello ...

Here is a link to a product that works

http://western.basefront.net/square-cut-laser-sheets/ls.html

Here is a link to one that does not ...

http://western.basefront.net/die-cut-laser-sheets/ld-1.html

I really need some help ... Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
lisali
Enthusiast
 
Avatar
Total Posts:  889
Joined:  2008-04-28
London, UK
 

Hey,

I see what you mean...have you tried deleting the problematic items and re-creating them? Does that help?

 
Magento Community Magento Community
Magento Community
Magento Community
 
mdumka
Member
 
Avatar
Total Posts:  56
Joined:  2008-02-28
 

All of the products that can not be added were imports ... that is just great.

To fix this I just have to go in and manually click save (not do anything) just click save like 500 times and it will fix the problems.

MIke

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  481
Joined:  2008-07-11
New Haven, CT
 

your add to cart URLs are not showing up...it looks like it’s is only placing a pound sign...so either there is a missing item in the database for product URL or someone forgot to output the add to cart URL in the template code.

A typical add to cart URL might look like this:

http://western.basefront.net/index.php/checkout/cart/add/uenc/aHR0cDovL2xvY2FsaG9zdC9tYWdlbnRvL2luZGV4LnBocC9ldmVudHM=/product/8/

while yours looks like this:

http://western.basefront.net/square-cut-laser-sheets/ls.html#

Additionally, there seems to be (at some points...like from product view vs catalog view) times when the Add to Cart button is controlled by off page javascript (catalog view is controlled by on-page javascript while product view seems to be controlled by off-page). This is in a stock build - not sure how changed your templates are

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  481
Joined:  2008-07-11
New Haven, CT
 

Upon further inspection, you are always using

<a href="#" onclick="productAddToCartForm.submit()"><img src="http://western.basefront.net/skin/frontend/default/modern/images/btn_add_to_cart.gif" alt="Add to Cart" class="v-middle" style="margin:0 10px 0 5px;"/></a>

the problem is that javascript is attempting to follow the “#” links instead of doing the onclick action. You need to change this to:

<a href="#" onclick="productAddToCartForm.submit(); return false;"><img src="http://western.basefront.net/skin/frontend/default/modern/images/btn_add_to_cart.gif" alt="Add to Cart" class="v-middle" style="margin:0 10px 0 5px;"/></a>

You’ll notice that your code is slightly different than the stock build of magento - you are using a link (<a> tag) while stock Magento build uses a <input type="image".../> button - links act a little differently, and you’ll need to add that “return false;” line in there to make it act properly.

You’re solution to click save a billion times is probably only working because your code happens to run the javascript before it goes to a next page or something really random to that affect (perhaps its working in catalog view but not in page view...depends how your template code is)

 
Magento Community Magento Community
Magento Community
Magento Community
 
mdumka
Member
 
Avatar
Total Posts:  56
Joined:  2008-02-28
 

Hey NikeFido ...

Thanks for all of the work you put in ... but I have not changed anything in the template other then images as I wanted to keep the theme as ‘stock’ as possible.

All of the products I have in the website are Grouped Products. So all of the simple products associated with these groups do not show up. All of the simple products were imported as there were over 600.

To explain what I mean by ‘saving’ to get a product to be able to add it it to the cart ... I navigate to the product in the admin section and click save. No edits.

So this has to be a DB thing and not a Template thing because if I try to add ‘PRODUCT A’ and it will not add to the cart, I navigate to ‘PRODUCT A’ and re-save it and it works ... with out touching anything in the template.

Strange, eh?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  481
Joined:  2008-07-11
New Haven, CT
 

that’s not a stock theme, correct?

 
Magento Community Magento Community
Magento Community
Magento Community
 
mdumka
Member
 
Avatar
Total Posts:  56
Joined:  2008-02-28
 

Nope ... not a stock theme ... I am sorry to be a pain ... but what would that have to do with it?

 
Magento Community Magento Community
Magento Community
Magento Community
 
pepipe
Jr. Member
 
Total Posts:  7
Joined:  2008-07-04
 

mdumka I think nikefido was in the right path.

I got that problem (the items not getting add to the cart) and also when I was seeing the product adding products work but in listing pages not.

Go to app\design\frontend\your_page\your_theme\template\catalog\product\view\addtocart.phtml you should look for something like this (you don’t have a default theme):

<button class="form-button" onclick="productAddToCartForm.submit()"><span><?php echo $this->__('Add to Cart'?></span>/button>
This is the correct “onclick” code. Now search in: app\design\frontend\your_page\your_theme\template\catalog\product\list.phtml for the same <button> class. If you got on the “onclick” the same then you got an error! You have to put:
onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"

See if this help: http://www.magentocommerce.com/boards/viewthread/20545/

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top