-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
160 additions
and
159 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,51 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Mageplaza | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Mageplaza.com license that is | ||
* available through the world-wide-web at this URL: | ||
* https://www.mageplaza.com/LICENSE.txt | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this extension to newer | ||
* version in the future. | ||
* | ||
* @category Mageplaza | ||
* @package Mageplaza_ShareCart | ||
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | ||
* @license https://www.mageplaza.com/LICENSE.txt | ||
*/ | ||
--> | ||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> | ||
<head> | ||
<css src="Mageplaza_ShareCart::css/style.css"/> | ||
</head> | ||
<body> | ||
<referenceBlock name="minicart"> | ||
<arguments> | ||
<argument name="jsLayout" xsi:type="array"> | ||
<item name="components" xsi:type="array"> | ||
<item name="minicart_content" xsi:type="array"> | ||
<item name="children" xsi:type="array"> | ||
<item name="extra_info" xsi:type="array"> | ||
<item name="children" xsi:type="array"> | ||
<item name="mp_sharecart" xsi:type="array"> | ||
<item name="component" xsi:type="string">Mageplaza_ShareCart/js/view/minicart</item> | ||
<item name="config" xsi:type="array"> | ||
<item name="componentDisabled" xsi:type="helper" helper="Mageplaza\ShareCart\Helper\Data::isDisabled"/> | ||
</item> | ||
</item> | ||
</item> | ||
</item> | ||
</item> | ||
</item> | ||
</item> | ||
</argument> | ||
</arguments> | ||
</referenceBlock> | ||
</body> | ||
</page> | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Mageplaza | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Mageplaza.com license that is | ||
* available through the world-wide-web at this URL: | ||
* https://www.mageplaza.com/LICENSE.txt | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this extension to newer | ||
* version in the future. | ||
* | ||
* @category Mageplaza | ||
* @package Mageplaza_ShareCart | ||
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | ||
* @license https://www.mageplaza.com/LICENSE.txt | ||
*/ | ||
--> | ||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> | ||
<head> | ||
<css src="Mageplaza_ShareCart::css/style.css"/> | ||
</head> | ||
<body> | ||
<referenceBlock name="minicart"> | ||
<arguments> | ||
<argument name="jsLayout" xsi:type="array"> | ||
<item name="components" xsi:type="array"> | ||
<item name="minicart_content" xsi:type="array"> | ||
<item name="children" xsi:type="array"> | ||
<item name="extra_info" xsi:type="array"> | ||
<item name="children" xsi:type="array"> | ||
<item name="mp_sharecart" xsi:type="array"> | ||
<item name="component" xsi:type="string">Mageplaza_ShareCart/js/view/minicart</item> | ||
<item name="config" xsi:type="array"> | ||
<item name="componentDisabled" xsi:type="helper" helper="Mageplaza\ShareCart\Helper\Data::isDisabled"/> | ||
</item> | ||
</item> | ||
</item> | ||
</item> | ||
</item> | ||
</item> | ||
</item> | ||
</argument> | ||
</arguments> | ||
</referenceBlock> | ||
</body> | ||
</page> |
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 |
---|---|---|
@@ -1,77 +1,77 @@ | ||
/** | ||
* Mageplaza | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Mageplaza.com license that is | ||
* available through the world-wide-web at this URL: | ||
* https://www.mageplaza.com/LICENSE.txt | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this extension to newer | ||
* version in the future. | ||
* | ||
* @category Mageplaza | ||
* @package Mageplaza_ShareCart | ||
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | ||
* @license https://www.mageplaza.com/LICENSE.txt | ||
*/ | ||
define([ | ||
'jquery', | ||
'uiComponent', | ||
'Magento_Customer/js/customer-data', | ||
'mage/translate' | ||
], function ($, Component, customerData, $t) { | ||
'use strict'; | ||
|
||
var isReload = true; | ||
|
||
return Component.extend({ | ||
defaults: { | ||
template: 'Mageplaza_ShareCart/minicart' | ||
}, | ||
|
||
initialize: function () { | ||
this._super(); | ||
|
||
if (isReload) { | ||
customerData.reload(['cart'], false); | ||
isReload = false; | ||
} | ||
this.customer = customerData.get('cart'); | ||
}, | ||
|
||
moveShareCart: function(){ | ||
$(document).ready(function () { | ||
$('.secondary.sharecart').appendTo($('.action.viewcart').parent()); | ||
}); | ||
}, | ||
|
||
getQuoteId: function () { | ||
return customerData.get('cart')().quote_url; | ||
}, | ||
|
||
copyQuote: function (object, e) { | ||
var quoteUrl = document.createElement('textarea'); | ||
|
||
quoteUrl.value = customerData.get('cart')().quote_url; | ||
document.body.appendChild(quoteUrl); | ||
quoteUrl.select(); | ||
document.execCommand('copy'); | ||
document.body.removeChild(quoteUrl); | ||
|
||
e.currentTarget.setAttribute('class', 'mp-tooltipped'); | ||
e.currentTarget.setAttribute('aria-label', $t('Copied!')); | ||
}, | ||
|
||
leaveQuote: function (object, e) { | ||
e.currentTarget.removeAttribute('class'); | ||
e.currentTarget.removeAttribute('aria-label'); | ||
}, | ||
|
||
isDisplay: function () { | ||
return customerData.get('cart')().summary_count; | ||
} | ||
}); | ||
}); | ||
/** | ||
* Mageplaza | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Mageplaza.com license that is | ||
* available through the world-wide-web at this URL: | ||
* https://www.mageplaza.com/LICENSE.txt | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this extension to newer | ||
* version in the future. | ||
* | ||
* @category Mageplaza | ||
* @package Mageplaza_ShareCart | ||
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | ||
* @license https://www.mageplaza.com/LICENSE.txt | ||
*/ | ||
define([ | ||
'jquery', | ||
'uiComponent', | ||
'Magento_Customer/js/customer-data', | ||
'mage/translate' | ||
], function ($, Component, customerData, $t) { | ||
'use strict'; | ||
|
||
var isReload = true; | ||
|
||
return Component.extend({ | ||
defaults: { | ||
template: 'Mageplaza_ShareCart/minicart' | ||
}, | ||
|
||
initialize: function () { | ||
this._super(); | ||
|
||
if (isReload) { | ||
customerData.reload(['cart'], false); | ||
isReload = false; | ||
} | ||
this.customer = customerData.get('cart'); | ||
}, | ||
|
||
moveShareCart: function(){ | ||
$(document).ready(function () { | ||
$('.secondary.sharecart').appendTo($('.action.viewcart').parent()); | ||
}); | ||
}, | ||
|
||
getQuoteId: function () { | ||
return customerData.get('cart')().quote_url; | ||
}, | ||
|
||
copyQuote: function (object, e) { | ||
var quoteUrl = document.createElement('textarea'); | ||
|
||
quoteUrl.value = customerData.get('cart')().quote_url; | ||
document.body.appendChild(quoteUrl); | ||
quoteUrl.select(); | ||
document.execCommand('copy'); | ||
document.body.removeChild(quoteUrl); | ||
|
||
e.currentTarget.setAttribute('class', 'mp-tooltipped'); | ||
e.currentTarget.setAttribute('aria-label', $t('Copied!')); | ||
}, | ||
|
||
leaveQuote: function (object, e) { | ||
e.currentTarget.removeAttribute('class'); | ||
e.currentTarget.removeAttribute('aria-label'); | ||
}, | ||
|
||
isDisplay: function () { | ||
return customerData.get('cart')().summary_count; | ||
} | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,29 +1,29 @@ | ||
<!-- | ||
/** | ||
* Mageplaza | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Mageplaza.com license that is | ||
* available through the world-wide-web at this URL: | ||
* https://www.mageplaza.com/LICENSE.txt | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this extension to newer | ||
* version in the future. | ||
* | ||
* @category Mageplaza | ||
* @package Mageplaza_ShareCart | ||
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | ||
* @license https://www.mageplaza.com/LICENSE.txt | ||
*/ | ||
--> | ||
<!--ko if: isDisplay() --> | ||
<div class="secondary sharecart" style="text-align: center" afterRender="moveShareCart()"> | ||
<a class="action sharecart mp-sharecart-minicart" data-bind="click: copyQuote, event: {mouseleave: leaveQuote}" | ||
style="cursor: pointer"> | ||
<span data-bind="i18n: 'Share Cart'"></span> | ||
</a> | ||
</div> | ||
<!-- /ko --> | ||
<!-- | ||
/** | ||
* Mageplaza | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Mageplaza.com license that is | ||
* available through the world-wide-web at this URL: | ||
* https://www.mageplaza.com/LICENSE.txt | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this extension to newer | ||
* version in the future. | ||
* | ||
* @category Mageplaza | ||
* @package Mageplaza_ShareCart | ||
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | ||
* @license https://www.mageplaza.com/LICENSE.txt | ||
*/ | ||
--> | ||
<!--ko if: isDisplay() --> | ||
<div class="secondary sharecart" style="text-align: center" afterRender="moveShareCart()"> | ||
<a class="action sharecart mp-sharecart-minicart" data-bind="click: copyQuote, event: {mouseleave: leaveQuote}" | ||
style="cursor: pointer"> | ||
<span data-bind="i18n: 'Share Cart'"></span> | ||
</a> | ||
</div> | ||
<!-- /ko --> |