2

Does anyone know what scope: 'minicart_content' references? I have a couple of ideas, I have been trying to track this down. I am converting flat HTML templates to Magento. when I do

<p data-bind="html: getCartParam('subtotal')"></p> 

The subtotal outputs with a <span class="price">$0.00</span> inside of the <p/> tag

I only want the values from the cart.

Within my theme, I am using the file Magento_Checkout/templates/cart/minicart.phtml

Thank you!

1 Answer 1

6

This is telling knockoutJS to use the minicart_content ui component as the base object. What this means is that data-bind="html: getCartParam('subtotal') resolves to the getCartParam method found in Magento_Checkout/view/frontend/web/js/view/minicart.js which is the component element of minicart_content as defined in Magento_Checkout/view/frontend/layout/default.xml.

2
  • Thank you, would the <span/> tag encapsulating the subtotal in the output happen to be coming from Magento_Checkout/view/base/web/js/price-box.js ? Commented Dec 28, 2016 at 14:14
  • I don't actually have the code you posted in my installation (perhaps you're using an older version?) but in my installation it works like this: the subtotal <span> comes from Magento_Directory/Model/Currency.php in the formatPrecision method. The html string returned by this method ends up in the cart section of the CustomerData object (Magento_Customer/view/frontend/web/js/customer-data.js) and is printed out in Magento_Checkout/view/frontend/web/template/minicart/subtotal/totals.html. Commented Dec 29, 2016 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.