Skip to content

Commit

Permalink
MAGETWO-39865: [GITHUB] window.checkout is undefined if minicart is r…
Browse files Browse the repository at this point in the history
…emoved #1458
  • Loading branch information
Stanislav Idolov committed Jul 10, 2015
1 parent 139997b commit 6ed9ab3
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 22 deletions.
18 changes: 7 additions & 11 deletions app/code/Magento/Captcha/view/frontend/layout/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,17 @@
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="minicart">
<referenceBlock name="authentication-popup">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="minicart_content" xsi:type="array">
<item name="authenticationPopup" xsi:type="array">
<item name="children" xsi:type="array">
<item name="sign-in-popup" xsi:type="array">
<item name="children" xsi:type="array">
<item name="captcha" xsi:type="array">
<item name="component" xsi:type="string">Magento_Captcha/js/view/checkout/loginCaptcha</item>
<item name="displayArea" xsi:type="string">additional-login-form-fields</item>
<item name="formId" xsi:type="string">user_login</item>
<item name="configSource" xsi:type="string">checkout</item>
</item>
</item>
<item name="captcha" xsi:type="array">
<item name="component" xsi:type="string">Magento_Captcha/js/view/checkout/loginCaptcha</item>
<item name="displayArea" xsi:type="string">additional-login-form-fields</item>
<item name="formId" xsi:type="string">user_login</item>
<item name="configSource" xsi:type="string">checkout</item>
</item>
</item>
</item>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Checkout\Model\Customer\Autentication;

class ConfigPlugin
{
/**
* @var \Magento\Framework\UrlInterface
*/
protected $urlBuilder;

/**
* @param \Magento\Framework\UrlInterface $urlBuilder
*/
public function __construct(\Magento\Framework\UrlInterface $urlBuilder)
{
$this->urlBuilder = $urlBuilder;
}

/**
* @param \Magento\Customer\Block\Account\AuthenticationPopup $subject
* @param array $result
* @return array
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function afterGetConfig(
\Magento\Customer\Block\Account\AuthenticationPopup $subject,
array $result
) {
$result['checkoutUrl'] = $this->urlBuilder->getUrl('checkout');
return $result;
}
}
4 changes: 4 additions & 0 deletions app/code/Magento/Checkout/etc/frontend/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
<plugin name="checkout-session-depersonalize"
type="Magento\Checkout\Model\Layout\DepersonalizePlugin" sortOrder="20"/>
</type>
<type name="Magento\Customer\Block\Account\AuthenticationPopup">
<plugin name="authentication-popup-checkout-url"
type="Magento\Checkout\Model\Customer\Autentication\ConfigPlugin" sortOrder="20"/>
</type>
<type name="Magento\Customer\CustomerData\SectionPoolInterface">
<arguments>
<argument name="sectionSourceMap" xsi:type="array">
Expand Down
11 changes: 0 additions & 11 deletions app/code/Magento/Customer/Block/Account/AuthenticationPopup.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public function getJsLayout()
public function getConfig()
{
return [
'checkoutUrl' => $this->getCheckoutUrl(),
'customerRegisterUrl' => $this->getCustomerRegisterUrlUrl(),
'customerForgotPasswordUrl' => $this->getCustomerForgotPasswordUrl(),
'baseUrl' => $this->getBaseUrl()
Expand All @@ -57,16 +56,6 @@ public function getBaseUrl()
return $this->_storeManager->getStore()->getBaseUrl();
}

/**
* Get one page checkout page url
*
* @return string
*/
public function getCheckoutUrl()
{
return $this->getUrl('checkout');
}

/**
* Get customer register url
*
Expand Down

0 comments on commit 6ed9ab3

Please sign in to comment.