I have Ubercart installed all other pages get 'HIT' except Ubercart nodes.
Under 'Remove Form Token', i set uc_product_add_to_cart_form_* but all Ubercart nodes show this message.

Message 1: "Canceled: Value element nid contained in the cacheable form uc_product_add_to_cart_form_xxxx. Please enable a suitable Authcache integration module for that form or file a support request."

Could you advise what to check to generate cache for Ubercart nodes? thank you for your time.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bellagio created an issue. See original summary.

znerol’s picture

Title: Caching cancelled and unable to make it work » Add support for Ubercart
Category: Support request » Feature request
Status: Active » Needs work

I guess that we'd need a little Ubercart integration module in order to add out-of-the-box support (similar to the Authcache Commerce module).

swickham’s picture

fwiw, I'm not getting this particular error. I am running a little older version of Ubercart, 3.8,

znerol’s picture

Status: Needs work » Needs review
FileSize
2.08 KB

This patch adds an Authcache Ubercart module which resolves the reported problem and also fixes #2885086: Check to make sure element is an array before checking to see if it needs to be flagged.

Need to add tests before I can ship that.

bellagio’s picture

i enabled new Authcache Ubercart module and now all of Ubercart nodes shows 'HIT'. wow. I am thankful you got bored in the train.

swickham’s picture

Status: Needs review » Needs work

I just tested and this doesn't fix the issue with the NULL "attributes" index in the $form array. The authcache_form_value_suspect() function is called before the Authcache Ubercart module's form_alter is triggered since it's called within a form_alter in the main module which is run before the Ubercart Authcache module's alter.

znerol’s picture

Thats weird. Sequence of execution for authcache_element_suspect() and authcache_element_set_cacheable() shouldn't actually matter.

znerol’s picture

Status: Needs work » Needs review
FileSize
2.98 KB
1.58 KB

Oh, I'm stupid. The NULL attributes workaround must run before the main authcache form_alter in order to be effective.

swickham’s picture

Just tested and it works for me. However, just to pester you further, I noticed in the Ubercart support module's @file description you said it adds support for Drupal Commerce. Here's your patch with that one comment fixed.

znerol’s picture

Adds an adaption of Authcache Commerce Test.

swickham’s picture

I made two small changes to your patch:

  1. Added cacheobject as a test dependency to the module's info file, I got stuck on that for a bit as the test started bombing without offering any errors.
  2. The setUp function was defined as protected but needs to be public.
znerol’s picture

Thanks a lot for testing the test-patch. I think that Authcache Ubercart is useless anyway without Authcache Form and that one has cacheobject as test dependency already. Wouldn't it make sense to just add Authcache Form as a run-time dependency instead of cacheobject as test-dep?

Regarding setUp I disagree. This method is in fact protected in both base classes (DrupalWebTestCase as well as DrupalUnitTestCase):

$ git grep 'function setUp' modules/simpletest/drupal_web_test_case.php
modules/simpletest/drupal_web_test_case.php:  protected function setUp() {
modules/simpletest/drupal_web_test_case.php:  protected function setUp() {
znerol’s picture

Oh! Just realized that setUp is public throughout the whole Authcache code base. So for the sake of consistency let's forget about protected.

swickham’s picture

I actually had to change the setUp() method to public for more than consistency, the method we're extending from the UbercartTestHelper class is already defined as public so your method, as a result, can't be defined as protected otherwise it would error.

I really wasn't sure what the correct method for adding test dependencies was. Your Ubercart test does enable Authcache Form but since a test dependency declaration doesn't actually force anything and it's just more of a way of documenting I just tossed into the Ubercart test's info file as well so people wouldn't have to check through all included modules to see what was required that they weren't being warned about.

Does that make sense or is it just not the way things are done? I couldn't find an answer to that or a better way to make that requirement clear.

  • znerol committed 71480f6 on 7.x-2.x authored by swickham
    Issue #2856838 by znerol, swickham: Add support for Ubercart
    
znerol’s picture

Status: Needs review » Fixed

I committed it without the test_dependency for the moment, let's see whether the test-bot is happy with it.

Thanks a lot @all for reporting/fixing/testing this issue.

swickham’s picture

No problem, Authcache is a really great module to have out there so happy to help in some small way!

Status: Fixed » Closed (fixed)

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