-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAGETWO-39865: [GITHUB] window.checkout is undefined if minicart is r…
…emoved #1458
- Loading branch information
Stanislav Idolov
committed
Jul 10, 2015
1 parent
24b7c6a
commit 121d146
Showing
11 changed files
with
142 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
app/code/Magento/Customer/Block/Account/AuthorizationPopup.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Customer\Block\Account; | ||
|
||
class AuthorizationPopup extends \Magento\Framework\View\Element\Template | ||
{ | ||
/** | ||
* @var array | ||
*/ | ||
protected $jsLayout; | ||
|
||
/** | ||
* @param \Magento\Framework\View\Element\Template\Context $context | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
\Magento\Framework\View\Element\Template\Context $context, | ||
array $data = [] | ||
) { | ||
parent::__construct($context, $data); | ||
$this->jsLayout = isset($data['jsLayout']) && is_array($data['jsLayout']) ? $data['jsLayout'] : []; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getJsLayout() | ||
{ | ||
return \Zend_Json::encode($this->jsLayout); | ||
} | ||
|
||
/** | ||
* Returns popup config | ||
* | ||
* @return array | ||
*/ | ||
public function getConfig() | ||
{ | ||
return [ | ||
'checkoutUrl' => $this->getCheckoutUrl(), | ||
'customerRegisterUrl' => $this->getCustomerRegisterUrlUrl(), | ||
'customerForgotPasswordUrl' => $this->getCustomerForgotPasswordUrl(), | ||
'baseUrl' => $this->getBaseUrl() | ||
]; | ||
} | ||
|
||
/** | ||
* Return base url. | ||
* | ||
* @return string | ||
*/ | ||
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 | ||
* | ||
* @return string | ||
*/ | ||
public function getCustomerRegisterUrlUrl() | ||
{ | ||
return $this->getUrl('customer/account/create'); | ||
} | ||
|
||
/** | ||
* Get customer forgot password url | ||
* | ||
* @return string | ||
*/ | ||
public function getCustomerForgotPasswordUrl() | ||
{ | ||
return $this->getUrl('customer/account/forgotpassword'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
app/code/Magento/Customer/view/frontend/templates/account/authorization-popup.phtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
?> | ||
<div id="authorizationPopup" data-bind="scope:'authorizationPopup'"> | ||
<script> | ||
window.authorizationPopup = <?php echo \Zend_Json::encode($block->getConfig()); ?>; | ||
</script> | ||
<!-- ko template: getTemplate() --><!-- /ko --> | ||
<script type="text/x-magento-init"> | ||
{ | ||
"#authorizationPopup": { | ||
"Magento_Ui/js/core/app": <?php echo $block->getJsLayout();?> | ||
}, | ||
"*": { | ||
"Magento_Ui/js/block-loader": "<?php echo $block->getViewFileUrl('images/loader-1.gif'); ?>" | ||
} | ||
} | ||
</script> | ||
</div> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.