Hi.

Using drupal 7.56, and Ubercart 3.10.

When this module is enabled, after I fill the order and when I press the button to fulfill it, I get this error message.

EntityMalformedException: Propiedad de paquete que falta en la entidad de tipo node. en entity_extract_ids() (línea 7929 de /web/htdocs/www.calzadossantaclara.com/home/includes/common.inc).

I have read lots of threads about similar errors for orphaned taxonomy items and some other related issues. But nothing seems to apply here, or I am not smart enough to figure what's going on.

When I disable this module, the error goes away.

Could someone enlighten me on how to go about debugging this? My drupal-module-foo is non-existant. I can find my way around php, though. Some pointers on what to look for would be fantastic.

It's worth mentioning that I modified uc_attribute_stock.module to change this line:
$email_from = _uc_stock_send_mail($form_state['uc_order'], $obj);
to:
$email_from = _uc_stock_send_mail($form_state['uc_order'], $obj, $stock);

Because that was causing another error due to an incorrect number of parameters being passed.

I doubt that has anything to do with the issue at hand. But I though I'd mention it just in case.

Any help will be much appreciated. Right now, my online shop isn't able to complete orders so it's as good as closed.

Thanks for any help!

CommentFileSizeAuthor
#3 uc_attribute_stock.module.txt12.47 KBi92guboj

Comments

i92guboj created an issue. See original summary.

i92guboj’s picture

Rrright.

This seems to work, so after all my "fix" above was the one that was creating the problem. I misread the argument list for that func.

--- uc_attribute_stock.module.orig      2017-07-06 12:28:30.862000359 +0200
+++ uc_attribute_stock.module   2017-07-06 12:28:07.088794927 +0200
@@ -286,7 +286,7 @@
                 $stock_obj['treshold'] = $item['treshold'];
                 $obj = (object) $stock_obj;

-                $email_from = _uc_stock_send_mail($form_state['uc_order'], $obj);
+                $email_from = _uc_stock_send_mail($form_state['uc_order'], $form['node'], $obj);
               }

               // Update attribute stock
@@ -308,7 +308,7 @@
                 $stock_obj['sku'] = $value->model;
                 $stock_obj['stock'] = $stock;
                 $stock_obj = (object) $stock_obj;
-                $email_from = _uc_stock_send_mail($form_state['uc_order'], $stock);
+                $email_from = _uc_stock_send_mail($form_state['uc_order'], $form['node'], $stock);
               }
             }
           }
@@ -410,4 +410,4 @@
   db_delete('uc_attribute_stock')
     ->condition('nid', $node->nid)
     ->execute();
-}
+}

This probably changed only recently, since I have used this module in the past without any problem, and older API docs match the original 2 args syntax. Now, it requires 3.

I hope this will help the next one stumping into this problem. I have no idea how this could be pushed upstream though. First thing would be to locate from which drupal version this syntax changed.

Cheers!

i92guboj’s picture

StatusFileSize
new12.47 KB

I had to make some more modifications to avoid some silly warnings when purchasing more than one product. In case it's useful to someone and for future reference I'll just attach the module file here.

MPeli’s picture

MPeli’s picture

Thank you for your help, i92guboj. I have committed your changes in file uc_attribute_stock.module.txt.

MPeli’s picture

Status: Active » Fixed

It should be fixed now. See the commit #f7257ca.

i92guboj’s picture

Hi, and thanks for that.

I have one question, not strictly related, but here it goes anyway. If you think it's worth a new issue I can open it.

In function uc_attribute_stock_form_alter() I modified this:

      // If the following block is enabled, then the list will be populated with
      // the whole attribute options list, when stock-less, allowing you to
      // make an order with items that are not in stock, which is unacceptable.
      
      /*if (empty($data)) {
        return;
      }*/

The aim is not to allow people to choose things that are not available for choice.

Prior to this modification, if you had any item with, let's say, a "size" attribute, with options [35, 36, 37, 38, 39, 40, 41], and 0 stock in all of them, then all of the options would be displayed in the combo list. They would be without stock next to them, but selectable nonetheless, and the order could be completed, so you'd be selling non-existent vapor.

This created no end of trouble.

After that modification, the function proceeded as normal, but the only entry in the combobox would be "Select <...>". The list would be unpopulated, and you can't add the item to the cart, which is much preferable to the upstream behavior.

I guess that if that code snippet was added there at some point, it was for a reason. But maybe it needs to be reviewed. For now, I've just commented it in my local copy.

Again, thanks for your support :)

  • MPeli committed f7257ca on 7.x-1.x
    Issue #2892592 by i92guboj: errorEntityMalformedException on final /cart...

Status: Fixed » Closed (fixed)

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