I get this error when clicking on Add to Cart, and only while using Panels. There is a similar issue here: http://drupal.org/node/1257670 where a form isn't found. That error is solved by using the latest dev version (which I am doing), but doesn't fix my issue.

In amazon_store_item_offers.tpl.php I have the line: module_load_include('inc', 'amazon_store', 'amazon_store.pages'); at the top. That's where amazon_store_addcart_form_validate() lives, so the error is surprising to me.

I've cleared cache, reinstalled the module, etc.

Comments

rfay’s picture

Status: Active » Needs review
StatusFileSize
new501 bytes

Please try this. I see that the addcart form is also called in the search results.

SnackBucket’s picture

StatusFileSize
new170.01 KB

I still get the error with the patch applied.

If I have time today I'll step through the code and see if I can figure out what's up.

For reference, I've attached a screenshot of exactly what I'm getting.

rfay’s picture

Thanks - I didn't know it was in the AJAX callback. That's interesting information.

What we need is a definitive description of how to recreate this.

SnackBucket’s picture

I am able to reproduce this error with a fresh install of Drupal 7 with only ctools, panels, amazon, and amazon_store installed.

Enabling the panels page page-amazon_item and clicking on Add to Cart gives me the same error as I posted in #2.

While playing around, I also found I get the same error if I just insert

module_load_include('inc', 'amazon_store', 'amazon_store.pages'); //Doesn't matter if this is here or not	  		
print drupal_render(drupal_get_form('amazon_store_addcart_form', $anyAsinHere)); 

into a template file.

rfay’s picture

if you add a

drupal_set_message(print_r(debug_backtrace(), TRUE));

at the point of failure, it will show you what the call trace is.

Thanks for your work on this!

Gamesbro’s picture

subscribe.

I do not receive the error on the main page of the Amazon store here when I add to the cart.
No Error in cart

I do receive the error message here when I try to add to cart on the products pages.
Error in cart

http://img252.imageshack.us/img252/1998/capturexx.jpg

chien_fu’s picture

Version: 7.x-1.x-dev » 7.x-1.0
StatusFileSize
new69.29 KB

Not sure if the error I'm getting is related to this thread or not. I've attached a screen shot.

I'm getting the error at the same time, when the Add to Cart button is pressed, but it is an AJAX HTTP Error 500.

Please let me know what this might be related to.
Thanks.

rfay’s picture

@chien_fu, if you get a 500 error, it probably means there's an error in your apache or php logs. Take a look there. Does the patch in #1 solve the problem for you?

chien_fu’s picture

The patch didn't seem to do anything.
The error I get in apache log is:
PHP Fatal error: Call to undefined function amazon_store_addcart_form_validate() in /var/www/martialartstop/includes/form.inc on line 1432

Line 1432 is the "else" portion of this function:

 foreach ($handlers as $function) {
    // Check if a previous _submit handler has set a batch, but make sure we
    // do not react to a batch that is already being processed (for instance
    // if a batch operation performs a drupal_form_submit()).
    if ($type == 'submit' && ($batch =& batch_get()) && !isset($batch['id'])) {
      // Some previous submit handler has set a batch. To ensure correct
      // execution order, store the call in a special 'control' batch set.
      // See _batch_next_set().
      $batch['sets'][] = array('form_submit' => $function);
      $batch['has_form_submits'] = TRUE;
    }
    else {
      $function($form, $form_state);
    }
chien_fu’s picture

I still haven't been able to fix this error. Any suggestions?

kingdee40’s picture

A couple things that might help reproduce this.
1. I have page managers "/amazon_store/item/%asin" enabled so the store is displaying through a panel.
2. Look up a product in "Amazon API -> Test" page and add to cart.

Once I disable "/amazon_store/item/%asin" path everything works.

manuelmp’s picture

Does anyone have a solution for this problem Amazon Store? It is exactly the same when you press the Add Cart

Thanks

rfay’s picture

Has anybody tried #1 ?

rfay’s picture

Status: Needs review » Fixed

Fixed in http://drupalcode.org/project/amazon_store.git/commitdiff/8b77a9f

I wasn't able to figure out a really satisfactory solution. I'm not sure if this is a problem with AJAX, FAPI, or ctools, but *one* of them isn't getting the right file loaded at the right time, and I couldn't figure out any solution but to always load amazon_store.pages.inc.

But I believe this will solve the problem. Please test the dev version when it updates.

manuelmp’s picture

Excuse my ignorance rfay, as I can try the # 1?

Thanks

rfay’s picture

@manuelmp, a fix has been committed. #14. Please update to the dev release.

manuelmp’s picture

rfay, once installed the # 14 has solved the original problem "Call to undefined ..." but now after adding the product to the cart, when you press the "view cart" message "There are no items in you cart" and the "Continue Shopping". Why can this happen? thanks

rfay’s picture

@manuelmp, I can't replicate that.

Please open a new issue with complete details. And I recommend that you start without panels. Also make sure you mention what the ASIN is of the item you're having trouble with.

manuelmp’s picture

rfay after some checking, actually works, although in some article and not for any MP3 donwload.

Thank you very much for your help

rfay’s picture

yeah, the Amazon API doesn't support any downloadable products.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.