Display total price and total items in minicart The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Minicart in header is cached by FPCmini cart not showing itemsHow to display price times quantity in minicartIs it possible to add the rwd minicart to my own custom theme, and if so how could I do itrender minicart in custom layout - Magento 2Magento 2 minicartMagento 2 Minicart - Display line item subtotal rather than unit priceMagento 2: Show total items count in Knockout templateUpdate quantity in minicartMini cart content not rendering properly in Magento 2?
Do warforged have souls?
When did F become S? Why?
Why is the object placed in the middle of the sentence here?
He got a vote 80% that of Emmanuel Macron’s
Keeping a retro style to sci-fi spaceships?
A pet rabbit called Belle
How does this infinite series simplify to an integral?
system call string length limit
Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?
Are my PIs rude or am I just being too sensitive?
Why can't wing-mounted spoilers be used to steepen approaches?
Match Roman Numerals
How to prevent selfdestruct from another contract
How did passengers keep warm on sail ships?
Do working physicists consider Newtonian mechanics to be "falsified"?
I could not break this equation. Please help me
Am I ethically obligated to go into work on an off day if the reason is sudden?
How to test the equality of two Pearson correlation coefficients computed from the same sample?
Windows 10: How to Lock (not sleep) laptop on lid close?
How are presidential pardons supposed to be used?
Road tyres vs "Street" tyres for charity ride on MTB Tandem
Mortgage adviser recommends a longer term than necessary combined with overpayments
What's the point in a preamp?
How to pronounce 1ターン?
Display total price and total items in minicart
The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Minicart in header is cached by FPCmini cart not showing itemsHow to display price times quantity in minicartIs it possible to add the rwd minicart to my own custom theme, and if so how could I do itrender minicart in custom layout - Magento 2Magento 2 minicartMagento 2 Minicart - Display line item subtotal rather than unit priceMagento 2: Show total items count in Knockout templateUpdate quantity in minicartMini cart content not rendering properly in Magento 2?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have installed magento 2.0.7 and overide the template minicart.phtml to my custom theme. I want to show total price and total items in the header minicart like the below image
magento2 mini-cart
add a comment |
I have installed magento 2.0.7 and overide the template minicart.phtml to my custom theme. I want to show total price and total items in the header minicart like the below image
magento2 mini-cart
Hi, have you found solution to above ? as I am Looking for the same.
– Arun Karnawat
Jul 25 '16 at 8:00
Yes arun.I will post my answer
– Asha
Jul 28 '16 at 7:03
thank you, I have figured it out, but if you can, I want$00 - 0 itemto be printed by default if 0 product is in the cart. in Magento 2.1.0. Thank you
– Arun Karnawat
Jul 28 '16 at 8:20
add a comment |
I have installed magento 2.0.7 and overide the template minicart.phtml to my custom theme. I want to show total price and total items in the header minicart like the below image
magento2 mini-cart
I have installed magento 2.0.7 and overide the template minicart.phtml to my custom theme. I want to show total price and total items in the header minicart like the below image
magento2 mini-cart
magento2 mini-cart
edited Jun 6 '16 at 10:44
Asha
asked Jun 6 '16 at 10:37
AshaAsha
3422522
3422522
Hi, have you found solution to above ? as I am Looking for the same.
– Arun Karnawat
Jul 25 '16 at 8:00
Yes arun.I will post my answer
– Asha
Jul 28 '16 at 7:03
thank you, I have figured it out, but if you can, I want$00 - 0 itemto be printed by default if 0 product is in the cart. in Magento 2.1.0. Thank you
– Arun Karnawat
Jul 28 '16 at 8:20
add a comment |
Hi, have you found solution to above ? as I am Looking for the same.
– Arun Karnawat
Jul 25 '16 at 8:00
Yes arun.I will post my answer
– Asha
Jul 28 '16 at 7:03
thank you, I have figured it out, but if you can, I want$00 - 0 itemto be printed by default if 0 product is in the cart. in Magento 2.1.0. Thank you
– Arun Karnawat
Jul 28 '16 at 8:20
Hi, have you found solution to above ? as I am Looking for the same.
– Arun Karnawat
Jul 25 '16 at 8:00
Hi, have you found solution to above ? as I am Looking for the same.
– Arun Karnawat
Jul 25 '16 at 8:00
Yes arun.I will post my answer
– Asha
Jul 28 '16 at 7:03
Yes arun.I will post my answer
– Asha
Jul 28 '16 at 7:03
thank you, I have figured it out, but if you can, I want
$00 - 0 item to be printed by default if 0 product is in the cart. in Magento 2.1.0. Thank you– Arun Karnawat
Jul 28 '16 at 8:20
thank you, I have figured it out, but if you can, I want
$00 - 0 item to be printed by default if 0 product is in the cart. in Magento 2.1.0. Thank you– Arun Karnawat
Jul 28 '16 at 8:20
add a comment |
4 Answers
4
active
oldest
votes
I believe you will need to use AJAX along with the API unless there is already a function for this in the Magento/Checkout/Model... Find the minicart knockout js template for an example already in your code.
http://devdocs.magento.com/guides/v2.0/javascript-dev-guide/javascript/js_overview.html
http://devdocs.magento.com/guides/v2.0/extension-dev-guide/bk-extension-dev-guide.html
add a comment |
Please make a copy of minicart.phtml file in your theme (appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml) and add the below code in it
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
/** @var $block MagentoCheckoutBlockCartSidebar */
?>
<?php $helper = $this->helper('MagentoCheckoutHelperCart');?>
<div data-block="minicart" class="minicart-wrapper">
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('Shopping Cart'); ?></span>
<span class="counter qty empty"
data-bind="css: empty: cart().summary_count < 0 , blockLoader: isLoading">
<span class="ex-top-cart-subtotal">
<!-- ko if: cart().summary_count -->
<!-- ko if: cart().possible_onepage_checkout -->
<!-- ko foreach: getRegion('subtotalContainer') -->
<!-- ko template: getTemplate() --><!-- /ko --> -
<!-- /ko -->
<!-- /ko -->
<!-- /ko --></span>
<span class="counter-label">
<!-- ko ifnot: cart().summary_count -->
£ <!-- ko i18n: ' 0.00 - 0 item ' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko if: cart().summary_count == 1 -->
<!-- ko i18n: 'item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count > 1 -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<?php //echo "£ ".number_format($helper->getQuote()->getSubtotal(), 2, '.', '');?>
</span>
</span>
</a>
<?php if ($block->getIsNeedToDisplaySideBar()): ?>
<div class="block block-minicart empty"
data-role="dropdownDialog"
data-mage-init='"dropdownDialog":
"appendTo":"[data-block=minicart]",
"triggerTarget":".showcart",
"timeout": "2000",
"closeOnMouseLeave": false,
"closeOnEscape": true,
"triggerClass":"active",
"parentClass":"active",
"buttons":[]'>
<div id="minicart-content-wrapper" data-bind="scope: 'minicart_content'">
<!-- ko template: getTemplate() --><!-- /ko -->
</div>
</div>
<?php endif ?>
<script>
window.checkout = <?php /* @escapeNotVerified */ echo Zend_Json::encode($block->getConfig()); ?>;
</script>
<script type="text/x-magento-init">
"[data-block='minicart']":
"Magento_Ui/js/core/app": <?php /* @escapeNotVerified */ echo $block->getJsLayout();?>
,
"*":
"Magento_Ui/js/block-loader": "<?php /* @escapeNotVerified */ echo $block->getViewFileUrl('images/loader-1.gif'); ?>"
</script>
</div>
please explain what you changed....
– Philipp Sander
Dec 16 '16 at 13:10
add a comment |
Go to this directory appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml
and overwrite with below code in minicart.phtml file.
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span class="counter qty empty" data-bind="css: empty: cart().summary_count == 0 , css: empty: !cart().summary_count , blockLoader: isLoading">
<span class="counter-number">
<!-- ko if: !cart().summary_count -->
<!-- ko i18n: '0 item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count >= 1 -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: ' items' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="price-wrapper" data-bind="html: cart().subtotal_excl_tax"> </span>
<span class="price-custom-minicart">
<!-- ko if: !cart().subtotal_excl_tax -->
<!-- ko i18n: '€ 0.00' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
</a>
add a comment |
Working code for me. Magento 2.2.4
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="counter qty empty"
data-bind="css: empty: !!getCartParam('summary_count') == false , blockLoader: isLoading">
<span class="counter-number">
<!-- ko ifnot: getCartParam('summary_count') -->
<!-- ko text: '0' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') != 1 -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
</span>
</a>
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f119512%2fdisplay-total-price-and-total-items-in-minicart%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
I believe you will need to use AJAX along with the API unless there is already a function for this in the Magento/Checkout/Model... Find the minicart knockout js template for an example already in your code.
http://devdocs.magento.com/guides/v2.0/javascript-dev-guide/javascript/js_overview.html
http://devdocs.magento.com/guides/v2.0/extension-dev-guide/bk-extension-dev-guide.html
add a comment |
I believe you will need to use AJAX along with the API unless there is already a function for this in the Magento/Checkout/Model... Find the minicart knockout js template for an example already in your code.
http://devdocs.magento.com/guides/v2.0/javascript-dev-guide/javascript/js_overview.html
http://devdocs.magento.com/guides/v2.0/extension-dev-guide/bk-extension-dev-guide.html
add a comment |
I believe you will need to use AJAX along with the API unless there is already a function for this in the Magento/Checkout/Model... Find the minicart knockout js template for an example already in your code.
http://devdocs.magento.com/guides/v2.0/javascript-dev-guide/javascript/js_overview.html
http://devdocs.magento.com/guides/v2.0/extension-dev-guide/bk-extension-dev-guide.html
I believe you will need to use AJAX along with the API unless there is already a function for this in the Magento/Checkout/Model... Find the minicart knockout js template for an example already in your code.
http://devdocs.magento.com/guides/v2.0/javascript-dev-guide/javascript/js_overview.html
http://devdocs.magento.com/guides/v2.0/extension-dev-guide/bk-extension-dev-guide.html
answered Jun 6 '16 at 11:13
LM_FieldingLM_Fielding
7281437
7281437
add a comment |
add a comment |
Please make a copy of minicart.phtml file in your theme (appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml) and add the below code in it
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
/** @var $block MagentoCheckoutBlockCartSidebar */
?>
<?php $helper = $this->helper('MagentoCheckoutHelperCart');?>
<div data-block="minicart" class="minicart-wrapper">
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('Shopping Cart'); ?></span>
<span class="counter qty empty"
data-bind="css: empty: cart().summary_count < 0 , blockLoader: isLoading">
<span class="ex-top-cart-subtotal">
<!-- ko if: cart().summary_count -->
<!-- ko if: cart().possible_onepage_checkout -->
<!-- ko foreach: getRegion('subtotalContainer') -->
<!-- ko template: getTemplate() --><!-- /ko --> -
<!-- /ko -->
<!-- /ko -->
<!-- /ko --></span>
<span class="counter-label">
<!-- ko ifnot: cart().summary_count -->
£ <!-- ko i18n: ' 0.00 - 0 item ' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko if: cart().summary_count == 1 -->
<!-- ko i18n: 'item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count > 1 -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<?php //echo "£ ".number_format($helper->getQuote()->getSubtotal(), 2, '.', '');?>
</span>
</span>
</a>
<?php if ($block->getIsNeedToDisplaySideBar()): ?>
<div class="block block-minicart empty"
data-role="dropdownDialog"
data-mage-init='"dropdownDialog":
"appendTo":"[data-block=minicart]",
"triggerTarget":".showcart",
"timeout": "2000",
"closeOnMouseLeave": false,
"closeOnEscape": true,
"triggerClass":"active",
"parentClass":"active",
"buttons":[]'>
<div id="minicart-content-wrapper" data-bind="scope: 'minicart_content'">
<!-- ko template: getTemplate() --><!-- /ko -->
</div>
</div>
<?php endif ?>
<script>
window.checkout = <?php /* @escapeNotVerified */ echo Zend_Json::encode($block->getConfig()); ?>;
</script>
<script type="text/x-magento-init">
"[data-block='minicart']":
"Magento_Ui/js/core/app": <?php /* @escapeNotVerified */ echo $block->getJsLayout();?>
,
"*":
"Magento_Ui/js/block-loader": "<?php /* @escapeNotVerified */ echo $block->getViewFileUrl('images/loader-1.gif'); ?>"
</script>
</div>
please explain what you changed....
– Philipp Sander
Dec 16 '16 at 13:10
add a comment |
Please make a copy of minicart.phtml file in your theme (appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml) and add the below code in it
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
/** @var $block MagentoCheckoutBlockCartSidebar */
?>
<?php $helper = $this->helper('MagentoCheckoutHelperCart');?>
<div data-block="minicart" class="minicart-wrapper">
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('Shopping Cart'); ?></span>
<span class="counter qty empty"
data-bind="css: empty: cart().summary_count < 0 , blockLoader: isLoading">
<span class="ex-top-cart-subtotal">
<!-- ko if: cart().summary_count -->
<!-- ko if: cart().possible_onepage_checkout -->
<!-- ko foreach: getRegion('subtotalContainer') -->
<!-- ko template: getTemplate() --><!-- /ko --> -
<!-- /ko -->
<!-- /ko -->
<!-- /ko --></span>
<span class="counter-label">
<!-- ko ifnot: cart().summary_count -->
£ <!-- ko i18n: ' 0.00 - 0 item ' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko if: cart().summary_count == 1 -->
<!-- ko i18n: 'item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count > 1 -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<?php //echo "£ ".number_format($helper->getQuote()->getSubtotal(), 2, '.', '');?>
</span>
</span>
</a>
<?php if ($block->getIsNeedToDisplaySideBar()): ?>
<div class="block block-minicart empty"
data-role="dropdownDialog"
data-mage-init='"dropdownDialog":
"appendTo":"[data-block=minicart]",
"triggerTarget":".showcart",
"timeout": "2000",
"closeOnMouseLeave": false,
"closeOnEscape": true,
"triggerClass":"active",
"parentClass":"active",
"buttons":[]'>
<div id="minicart-content-wrapper" data-bind="scope: 'minicart_content'">
<!-- ko template: getTemplate() --><!-- /ko -->
</div>
</div>
<?php endif ?>
<script>
window.checkout = <?php /* @escapeNotVerified */ echo Zend_Json::encode($block->getConfig()); ?>;
</script>
<script type="text/x-magento-init">
"[data-block='minicart']":
"Magento_Ui/js/core/app": <?php /* @escapeNotVerified */ echo $block->getJsLayout();?>
,
"*":
"Magento_Ui/js/block-loader": "<?php /* @escapeNotVerified */ echo $block->getViewFileUrl('images/loader-1.gif'); ?>"
</script>
</div>
please explain what you changed....
– Philipp Sander
Dec 16 '16 at 13:10
add a comment |
Please make a copy of minicart.phtml file in your theme (appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml) and add the below code in it
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
/** @var $block MagentoCheckoutBlockCartSidebar */
?>
<?php $helper = $this->helper('MagentoCheckoutHelperCart');?>
<div data-block="minicart" class="minicart-wrapper">
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('Shopping Cart'); ?></span>
<span class="counter qty empty"
data-bind="css: empty: cart().summary_count < 0 , blockLoader: isLoading">
<span class="ex-top-cart-subtotal">
<!-- ko if: cart().summary_count -->
<!-- ko if: cart().possible_onepage_checkout -->
<!-- ko foreach: getRegion('subtotalContainer') -->
<!-- ko template: getTemplate() --><!-- /ko --> -
<!-- /ko -->
<!-- /ko -->
<!-- /ko --></span>
<span class="counter-label">
<!-- ko ifnot: cart().summary_count -->
£ <!-- ko i18n: ' 0.00 - 0 item ' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko if: cart().summary_count == 1 -->
<!-- ko i18n: 'item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count > 1 -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<?php //echo "£ ".number_format($helper->getQuote()->getSubtotal(), 2, '.', '');?>
</span>
</span>
</a>
<?php if ($block->getIsNeedToDisplaySideBar()): ?>
<div class="block block-minicart empty"
data-role="dropdownDialog"
data-mage-init='"dropdownDialog":
"appendTo":"[data-block=minicart]",
"triggerTarget":".showcart",
"timeout": "2000",
"closeOnMouseLeave": false,
"closeOnEscape": true,
"triggerClass":"active",
"parentClass":"active",
"buttons":[]'>
<div id="minicart-content-wrapper" data-bind="scope: 'minicart_content'">
<!-- ko template: getTemplate() --><!-- /ko -->
</div>
</div>
<?php endif ?>
<script>
window.checkout = <?php /* @escapeNotVerified */ echo Zend_Json::encode($block->getConfig()); ?>;
</script>
<script type="text/x-magento-init">
"[data-block='minicart']":
"Magento_Ui/js/core/app": <?php /* @escapeNotVerified */ echo $block->getJsLayout();?>
,
"*":
"Magento_Ui/js/block-loader": "<?php /* @escapeNotVerified */ echo $block->getViewFileUrl('images/loader-1.gif'); ?>"
</script>
</div>
Please make a copy of minicart.phtml file in your theme (appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml) and add the below code in it
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
/** @var $block MagentoCheckoutBlockCartSidebar */
?>
<?php $helper = $this->helper('MagentoCheckoutHelperCart');?>
<div data-block="minicart" class="minicart-wrapper">
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('Shopping Cart'); ?></span>
<span class="counter qty empty"
data-bind="css: empty: cart().summary_count < 0 , blockLoader: isLoading">
<span class="ex-top-cart-subtotal">
<!-- ko if: cart().summary_count -->
<!-- ko if: cart().possible_onepage_checkout -->
<!-- ko foreach: getRegion('subtotalContainer') -->
<!-- ko template: getTemplate() --><!-- /ko --> -
<!-- /ko -->
<!-- /ko -->
<!-- /ko --></span>
<span class="counter-label">
<!-- ko ifnot: cart().summary_count -->
£ <!-- ko i18n: ' 0.00 - 0 item ' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko if: cart().summary_count == 1 -->
<!-- ko i18n: 'item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count > 1 -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
<?php //echo "£ ".number_format($helper->getQuote()->getSubtotal(), 2, '.', '');?>
</span>
</span>
</a>
<?php if ($block->getIsNeedToDisplaySideBar()): ?>
<div class="block block-minicart empty"
data-role="dropdownDialog"
data-mage-init='"dropdownDialog":
"appendTo":"[data-block=minicart]",
"triggerTarget":".showcart",
"timeout": "2000",
"closeOnMouseLeave": false,
"closeOnEscape": true,
"triggerClass":"active",
"parentClass":"active",
"buttons":[]'>
<div id="minicart-content-wrapper" data-bind="scope: 'minicart_content'">
<!-- ko template: getTemplate() --><!-- /ko -->
</div>
</div>
<?php endif ?>
<script>
window.checkout = <?php /* @escapeNotVerified */ echo Zend_Json::encode($block->getConfig()); ?>;
</script>
<script type="text/x-magento-init">
"[data-block='minicart']":
"Magento_Ui/js/core/app": <?php /* @escapeNotVerified */ echo $block->getJsLayout();?>
,
"*":
"Magento_Ui/js/block-loader": "<?php /* @escapeNotVerified */ echo $block->getViewFileUrl('images/loader-1.gif'); ?>"
</script>
</div>
answered Jul 28 '16 at 7:09
AshaAsha
3422522
3422522
please explain what you changed....
– Philipp Sander
Dec 16 '16 at 13:10
add a comment |
please explain what you changed....
– Philipp Sander
Dec 16 '16 at 13:10
please explain what you changed....
– Philipp Sander
Dec 16 '16 at 13:10
please explain what you changed....
– Philipp Sander
Dec 16 '16 at 13:10
add a comment |
Go to this directory appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml
and overwrite with below code in minicart.phtml file.
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span class="counter qty empty" data-bind="css: empty: cart().summary_count == 0 , css: empty: !cart().summary_count , blockLoader: isLoading">
<span class="counter-number">
<!-- ko if: !cart().summary_count -->
<!-- ko i18n: '0 item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count >= 1 -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: ' items' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="price-wrapper" data-bind="html: cart().subtotal_excl_tax"> </span>
<span class="price-custom-minicart">
<!-- ko if: !cart().subtotal_excl_tax -->
<!-- ko i18n: '€ 0.00' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
</a>
add a comment |
Go to this directory appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml
and overwrite with below code in minicart.phtml file.
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span class="counter qty empty" data-bind="css: empty: cart().summary_count == 0 , css: empty: !cart().summary_count , blockLoader: isLoading">
<span class="counter-number">
<!-- ko if: !cart().summary_count -->
<!-- ko i18n: '0 item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count >= 1 -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: ' items' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="price-wrapper" data-bind="html: cart().subtotal_excl_tax"> </span>
<span class="price-custom-minicart">
<!-- ko if: !cart().subtotal_excl_tax -->
<!-- ko i18n: '€ 0.00' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
</a>
add a comment |
Go to this directory appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml
and overwrite with below code in minicart.phtml file.
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span class="counter qty empty" data-bind="css: empty: cart().summary_count == 0 , css: empty: !cart().summary_count , blockLoader: isLoading">
<span class="counter-number">
<!-- ko if: !cart().summary_count -->
<!-- ko i18n: '0 item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count >= 1 -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: ' items' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="price-wrapper" data-bind="html: cart().subtotal_excl_tax"> </span>
<span class="price-custom-minicart">
<!-- ko if: !cart().subtotal_excl_tax -->
<!-- ko i18n: '€ 0.00' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
</a>
Go to this directory appdesignfrontendyourpackageyourthemeMagento_Checkouttemplatescartminicart.phtml
and overwrite with below code in minicart.phtml file.
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span class="counter qty empty" data-bind="css: empty: cart().summary_count == 0 , css: empty: !cart().summary_count , blockLoader: isLoading">
<span class="counter-number">
<!-- ko if: !cart().summary_count -->
<!-- ko i18n: '0 item' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: cart().summary_count >= 1 -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: ' items' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="price-wrapper" data-bind="html: cart().subtotal_excl_tax"> </span>
<span class="price-custom-minicart">
<!-- ko if: !cart().subtotal_excl_tax -->
<!-- ko i18n: '€ 0.00' --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
</a>
answered Dec 5 '16 at 10:05
Abhinav SinghAbhinav Singh
2,135612
2,135612
add a comment |
add a comment |
Working code for me. Magento 2.2.4
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="counter qty empty"
data-bind="css: empty: !!getCartParam('summary_count') == false , blockLoader: isLoading">
<span class="counter-number">
<!-- ko ifnot: getCartParam('summary_count') -->
<!-- ko text: '0' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') != 1 -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
</span>
</a>
add a comment |
Working code for me. Magento 2.2.4
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="counter qty empty"
data-bind="css: empty: !!getCartParam('summary_count') == false , blockLoader: isLoading">
<span class="counter-number">
<!-- ko ifnot: getCartParam('summary_count') -->
<!-- ko text: '0' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') != 1 -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
</span>
</a>
add a comment |
Working code for me. Magento 2.2.4
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="counter qty empty"
data-bind="css: empty: !!getCartParam('summary_count') == false , blockLoader: isLoading">
<span class="counter-number">
<!-- ko ifnot: getCartParam('summary_count') -->
<!-- ko text: '0' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') != 1 -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
</span>
</a>
Working code for me. Magento 2.2.4
<a class="action showcart" href="<?php /* @escapeNotVerified */ echo $block->getShoppingCartUrl(); ?>"
data-bind="scope: 'minicart_content'">
<span class="counter qty empty"
data-bind="css: empty: !!getCartParam('summary_count') == false , blockLoader: isLoading">
<span class="counter-number">
<!-- ko ifnot: getCartParam('summary_count') -->
<!-- ko text: '0' --><!-- /ko -->
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- /ko -->
</span>
<span class="counter-label">
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
</span>
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
<!-- ko if: getCartParam('summary_count') != 1 -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<span data-bind="html: getCartParam('subtotal')"></span>
<!-- /ko -->
</span>
</a>
answered Jun 22 '18 at 11:01
Nadeem0035Nadeem0035
593411
593411
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f119512%2fdisplay-total-price-and-total-items-in-minicart%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Hi, have you found solution to above ? as I am Looking for the same.
– Arun Karnawat
Jul 25 '16 at 8:00
Yes arun.I will post my answer
– Asha
Jul 28 '16 at 7:03
thank you, I have figured it out, but if you can, I want
$00 - 0 itemto be printed by default if 0 product is in the cart. in Magento 2.1.0. Thank you– Arun Karnawat
Jul 28 '16 at 8:20