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.
Hello,
some notice errors are created when anonymous user redirects from checkout to registration page(using Commerce Checkout Redirect).
Notice: Undefined index: in theme_commerce_checkout_progress_list() (line 173 of /blah/blah/sites/all/modules/commerce(contrib)/commerce_checkout_progress/commerce_checkout_progress.module)
Notice: Undefined index: in theme_commerce_checkout_progress_list() (line 176 of /var/www/fussycloud_master/sites/all/modules/commerce(contrib)/commerce_checkout_progress/commerce_checkout_progress.module)
Comments
Comment #1
jcisio CreditAttribution: jcisio commentedIt looks like the block is display neither in the cart nor a checkout page. If anyone uses Commerce Checkout Redirect and has the same problem, please help.
Comment #2
FiNeX CreditAttribution: FiNeX commentedI'm experiencing the same issue without "Commerce Checkout Redirect"
Comment #3
brycesenz CreditAttribution: brycesenz commentedI am also experiencing this issue without "Commerce Checkout Redirect"
Comment #4
brycesenz CreditAttribution: brycesenz commentedOk, the issue seems to be that in some cases, the variable '$current_page' (passed by the $variables array) is coming into the function uninitialized. I'm still trying to trace this back to figure out where it's all going wrong.
For others debugging the issue, I get this most often when I go to my shopping cart page while it is empty, then refresh the page on my browser.
*UPDATE*
The fact that $current_page is sometimes passed in uninitialized may be a bigger bug (I'm not sure of the maintainers intentions here).
But changing the following in "theme_commerce_checkout_progress_list()" removes the warnings for me:
Comment #5
brycesenz CreditAttribution: brycesenz commentedChanging status.
Comment #6
jcisio CreditAttribution: jcisio commentedCould you submit #4 as a patch please? It'd be easier for review.
Comment #7
Simon Georges CreditAttribution: Simon Georges commentedOn the "/cart" page,
$current_page
isNULL
, maybe there are other parts of the module to adapt, but so far, the attached patch fixes the notices for me.Comment #8
jcisio CreditAttribution: jcisio commentedI didn't test, but line 37, there is:
$_GET['q'] = 'cart'
Does changing it to
$_GET['q'] == 'cart'
work?
Comment #9
Simon Georges CreditAttribution: Simon Georges commented@jcisio, I just tested, and although it's probably a good idea to change it, changing it is not sufficient.
My patch is probably not needed if you find the root cause, I just don't have the time at the moment :-(
Comment #10
Simon Georges CreditAttribution: Simon Georges commented@jcisio, actually, the reason is I haven't checked the "commerce_checkout_progress_cart" box, therefore, the test is always false for me and $page_id not initialised...
Comment #11
jcisio CreditAttribution: jcisio commentedHmm, if you didn't check it, then the block should not appear on the cart page.
Otherwise, the block visibility settings are overriden. In that case, we should remove the check for it (at the same line).
Comment #12
aromka CreditAttribution: aromka commentedSetting "Include a Cart link as the first step" in checkout config fixed it for me.
Comment #13
Simon Georges CreditAttribution: Simon Georges commentedComment #14
GiorgosKI think the problem is more general after upgrading to latest dev of commerce (and this module) and visiting an EMPTY cart notices appear. if cart has items no notices
but as #12 pointed out going to admin/commerce/config/checkout and checking "Include a Cart link as the first step" makes notices go away
Comment #15
rei CreditAttribution: rei commentedconfirmed #12 & #14
Comment #16
agoradesign CreditAttribution: agoradesign commentedIf you neither want to include the cart link, nor get the error messages, you've to exclude the cart page from the block's visibility settings. Just go to admin/structure/block/manage/commerce_checkout_progress/indication/configure and check all pages except the cart
Comment #17
sinasalek CreditAttribution: sinasalek commented#12 fixed it for me, tx
Comment #18
jmoruziI get the same error messages, but it occurs when updating the quantity of items in the cart.
#12 and #14 made the errors go away for me as well. This hasn't really solved the problem though has it? Why is the error occurring?
Comment #19
jsacksick CreditAttribution: jsacksick commentedOk $page_id is not initialized when you're in the cart page unless you check the misnamed "Include a Cart link as the first step", So i added a check on the page_id and renamed "Include a Cart link as the first step" to "Display the cart step".
Comment #20
jcisio CreditAttribution: jcisio commentedLooks like a simple fix. Anyone can test please?
PS: I don't understand why the label is said to be misnamed.
Comment #21
jsacksick CreditAttribution: jsacksick commented@jcisio: Because the code actually checks the variable at two places and doesn't add the cart step until you check the "Include a Cart link as the first step".
First in
commerce_checkout_progress_block_view().
And in
commerce_checkout_progress_get_items
:That's probably what the checkbox actually means, Add/don't the cart step ? I don't know
Comment #22
jcisio CreditAttribution: jcisio commentedYes, but for me "Include a Cart link as the first step" == "Display the cart step", at least that's what it does. I'm not a native English speaker, BTW. If others confirm, we can change it.
Comment #23
jsacksick CreditAttribution: jsacksick commentedYou're probably right, I'm not a native English speaker either, let's just add the !empty fix and keep the current text. I'm also wondering if we should add an alter hook at the end of commerce_checkout_progress_get_items() to allow alteration by other modules. What do you think ? I'll probably create an other issue with a patch.
Comment #24
jsacksick CreditAttribution: jsacksick commentedBy the way this patch doesn't only remove the cart step, it removes completly the checkout progress on the cart page, I'm not 100% sure that's what you want, but IMO it doesn't make any sense to display a checkout progress when the current step is not displayed.
Comment #25
jcisio CreditAttribution: jcisio commentedI has been a long time since I last used this module... However, one question: did you look at comment #8? It didn't fix the problem (per #9) but does it change anything with your patch? IMO #8 is an error and must be fixed.
Comment #26
jsacksick CreditAttribution: jsacksick commented#8 is indeed an error and should be fixed, I think this check is useless.
However, concerning my patch, as I said, It will remove the checkout progress on the cart page unless you check the "Include a Cart link as the first step" option.
We can keep it like this or we can try to fix the current implementation and display the next steps but it doesn't make any sense IMO to display the next steps and not the current, what do you think ?
Comment #27
jsacksick CreditAttribution: jsacksick commentedComment #28
eviegas CreditAttribution: eviegas commentedAt line 173: dprint_r($items);
Comment #29
jcisio CreditAttribution: jcisio commentedI'm not sure what #28 means, but I committed #27 last week http://drupalcode.org/project/commerce_checkout_progress.git/commit/3c7a5cf. Either I forgot to comment here or my comment was lost.
Comment #31
a.milkovsky#7
Works for me
Comment #32
jcisio CreditAttribution: jcisio commentedPlease don't open closed issue to say that a patch works.
Comment #33
dasjoAs stated in #31, the patch from #7 solved the problem for me as well.