Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#9 | interdiff.txt | 400 bytes | swickham |
#9 | add_support_for_ubercart-2856838-9.patch | 2.98 KB | swickham |
| |||
#8 | interdiff.txt | 1.58 KB | znerol |
#8 | 2856838-8-ubercart-integration.patch | 2.98 KB | znerol |
| |||
#4 | 2856838-4-ubercart-integration.patch | 2.08 KB | znerol |
|
Comments
Comment #2
znerol CreditAttribution: znerol commentedI 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).
Comment #3
swickham CreditAttribution: swickham at Acro Commerce commentedfwiw, I'm not getting this particular error. I am running a little older version of Ubercart, 3.8,
Comment #4
znerol CreditAttribution: znerol commentedThis 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.
Comment #5
bellagio CreditAttribution: bellagio commentedi enabled new Authcache Ubercart module and now all of Ubercart nodes shows 'HIT'. wow. I am thankful you got bored in the train.
Comment #6
swickham CreditAttribution: swickham at Acro Commerce commentedI 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.
Comment #7
znerol CreditAttribution: znerol commentedThats weird. Sequence of execution for
authcache_element_suspect()
andauthcache_element_set_cacheable()
shouldn't actually matter.Comment #8
znerol CreditAttribution: znerol commentedOh, I'm stupid. The NULL attributes workaround must run before the main authcache
form_alter
in order to be effective.Comment #9
swickham CreditAttribution: swickham at Acro Commerce commentedJust 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.
Comment #10
znerol CreditAttribution: znerol commentedAdds an adaption of Authcache Commerce Test.
Comment #11
swickham CreditAttribution: swickham at Acro Commerce commentedI made two small changes to your patch:
Comment #12
znerol CreditAttribution: znerol commentedThanks 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 factprotected
in both base classes (DrupalWebTestCase
as well asDrupalUnitTestCase
):Comment #13
znerol CreditAttribution: znerol commentedOh! Just realized that
setUp
ispublic
throughout the whole Authcache code base. So for the sake of consistency let's forget aboutprotected
.Comment #14
swickham CreditAttribution: swickham at Acro Commerce commentedI 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.
Comment #16
znerol CreditAttribution: znerol commentedI 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.
Comment #17
swickham CreditAttribution: swickham at Acro Commerce commentedNo problem, Authcache is a really great module to have out there so happy to help in some small way!