The view mode created to use in the popup content is defined here:

dc_ajax_add_cart/modules/dc_ajax_add_cart_popup/config/optional/core.entity_view_mode.commerce_product_variation.dc_ajax_add_cart_popup.yml

The machine name is: dc_ajax_add_cart_popup

The AjaxAddToCartPopupSubscriber.php class is using dc_ajax_add_to_cart_popup, please notice the "to" as difference.

dc_ajax_add_cart/modules/dc_ajax_add_cart_popup/src/EventSubscriber/AjaxAddToCartPopupSubscriber.php

The attached patch solve this issue.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

anacona16 created an issue. See original summary.

anacona16’s picture

subhojit777’s picture

Status: Active » Needs work

Thanks for catching the problem. Could you please write a test for this.

New test:

  1. Write a test module for dc_ajax_add_cart_popup, say dc_ajax_add_cart_popup_test
  2. dc_ajax_add_cart_popup_test should update the dc_ajax_add_cart_popup view mode. For example, add a field to the view mode.
  3. In the test AjaxAddCartPopupTest, check whether the field is present in the popup.

Attach two patches, one with the fix and the other without the fix. The patch without the fix should fail.

ytsurk’s picture

Priority: Normal » Major

This is a pretty nasty bug ..

a.kovrigin’s picture

#2 works for me

bmx269’s picture

Version: 8.x-1.0-beta1 » 2.0.0
Status: Needs work » Needs review

#2 tested and reviewed against version 2.0.0.

The patch fixes the machine name error.

Looks good.

proweb.ua’s picture

#2 works

vmarchuk’s picture

Version: 2.0.0 » 3.x-dev

  • vmarchuk committed 01a32666 on 3.x
    Issue #2967933: Wrong view mode name for popup content display.
    
vmarchuk’s picture

Status: Needs review » Fixed

Committed!

Status: Fixed » Closed (fixed)

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