diff --git a/Block/Multishipping.php b/Block/Multishipping.php index a608f8c..8e0f887 100644 --- a/Block/Multishipping.php +++ b/Block/Multishipping.php @@ -1,7 +1,10 @@ m(); return df_cc_n( - df_tag('div', + final protected function _toHtml() { + $m = $this->m(); /** @var M $m */ + $s = $m->s(); /** @var S $s */ + $a = df_quote()->getBillingAddress(); /** @var A $a */ + return df_cc_n(df_tag('div', // 2017-08-26 // The generic «.df-payment» selector is used here: // https://github.com/mage2pro/core/blob/2.10.43/Payment/view/frontend/web/main.less#L51 ['class' => df_cc_s('df-payment df-card', df_module_name_lc($m, '-'), 'df-singleLineMode')] - + df_widget($m, 'multishipping', CP::p() + ['ba' => df_quote()->getBillingAddress()->getData()]) - ,df_block_output($m, 'multishipping', ['requireCardholder' => $m->s()->requireCardholder()]) - ) - ,df_link_inline(df_asset_name('main', $m, 'css')) - );} + + df_widget($m, 'multishipping', CP::p() + ['ba' => $a->getData()]) + ,df_block_output($m, 'multishipping', [ + /** + * 2017-10-18 + * `The «Prefill the cardholder's name from the billing address?» option + * is wrongly ignored in the multi-shipping scenario`: + * https://github.com/mage2pro/stripe/issues/36 + * I have implemented it similar to: + * https://github.com/mage2pro/core/blob/3.2.8/Payment/view/frontend/web/card.js#L171-L178 + */ + 'cardholder' => !$s->prefillCardholder() ? null : df_strtoupper(df_cc_s( + $a->getFirstname(), $a->getLastname() + )) + ,'requireCardholder' => $s->requireCardholder() + ]) + ), df_link_inline(df_asset_name('main', $m, 'css'))); + } } \ No newline at end of file diff --git a/composer.json b/composer.json index b7ebc28..2482ca5 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "mage2pro/stripe" - ,"version": "2.3.0" + ,"version": "2.3.1" ,"description": "The «Stripe» payment extension for Magento 2." ,"type": "magento2-module" ,"homepage": "https://mage2.pro/c/extensions/stripe" diff --git a/view/frontend/templates/multishipping.phtml b/view/frontend/templates/multishipping.phtml index f5540ee..3ef0f46 100644 --- a/view/frontend/templates/multishipping.phtml +++ b/view/frontend/templates/multishipping.phtml @@ -1,6 +1,7 @@ @@ -39,7 +40,7 @@ https://github.com/mage2pro/stripe/issues/14 id='dfe_stripe_cardholder' placeholder="" type='text' - value='' + value='' data-validate='{required:true}' />