Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment field not showing in checkout #54

Closed
mtjweb opened this issue Jul 14, 2020 · 3 comments
Closed

Comment field not showing in checkout #54

mtjweb opened this issue Jul 14, 2020 · 3 comments

Comments

@mtjweb
Copy link

mtjweb commented Jul 14, 2020

I installed the module via composer and enabled it, but it is not showing in checkout.

I'm using Magento 2.3.5-p1

@sunilit42
Copy link

@mtjweb is that work with 2.3.5.p1?

@Amadeco
Copy link
Contributor

Amadeco commented Dec 14, 2020

Good morning all,

I have a related issue with this module.

Indeed, if you disable (or you leave empty this field) max_length in admin configuration, it output one js error in checkout process :

Uncaught TypeError: Cannot read property 'length' of null
at order-comment-block.js:54
at Function.evaluateImmediate_CallReadThenEndDependencyDetection (knockout.js:2173)
at Function.evaluateImmediate_CallReadWithDependencyDetection (knockout.js:2140)
at Function.evaluateImmediate (knockout.js:2101)
at Object.ko.computed.ko.dependentObservable (knockout.js:1954)
at UiClass.initialize (order-comment-block.js:53)
at UiClass.initialize (wrapper.js:109)
at new UiClass (class.js:49)
at Object.initComponent (layout.js:137)
at fire (jquery.js:3238)

By debugguing, this problem seems related to
boldcommerce/magento2-ordercomments/view/frontend/web/js/view/checkout/order-comment-block.js :

this.remainingCharacters = ko.computed(function(){
    return self.getMaxLength() - self.comment().length;
});

I replaced by checking self.comment() return :

this.remainingCharacters = ko.computed(function(){
	               	var length = 0;
	                if (self.comment() != null && self.comment().length < 1) {
		            	length = self.comment().length;
		            }
	                
                    return self.getMaxLength() - length;
                });

Which work now without any js errors.

I dit not fully tested this solution and I am not sure if it is the right solution to adopt.

I think we need to add a condition in html template to process remainingCharacters function or not according to admin configuration.

What do you think @boldsidney ?

Ilan Parmentier

@boldsidney
Copy link
Contributor

Hi @mageho
The error has been fixed with 1.8.1 as part of #63
tested on 2.3.5-p2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants