Pass data to child template in cart-items of checkout pageMagento2 override admin js filemain.CRITICAL: Plugin class doesn't existOneStepCheckout - display subtotals of tax classPrice not getting updated for second product…Magento 2: Pass data in checkoutMultiple knockout uiComponents should not share the same data / seperate view instancesMagento 2.2.1: Add Custom Upload file attribute in CheckoutPass the values to rest api from magento2 checkout pageCheckout cart xml move items
The Digit Triangles
What is going on with gets(stdin) on the site coderbyte?
Find the next value of this number series
Why do ¬, ∀ and ∃ have the same precedence?
Does grappling negate Mirror Image?
How to draw a matrix with arrows in limited space
What to do when eye contact makes your coworker uncomfortable?
Has the laser at Magurele, Romania reached a tenth of the Sun's power?
Why is the Sun approximated as a black body at ~ 5800 K?
What are some good ways to treat frozen vegetables such that they behave like fresh vegetables when stir frying them?
Can I cause damage to electrical appliances by unplugging them when they are turned on?
Doesn't the system of the Supreme Court oppose justice?
Review your own paper in Mathematics
Is it ethical to recieve stipend after publishing enough papers?
Change the color of a single dot in `ddot` symbol
What fields between the rationals and the reals allow a good notion of 2D distance?
awk assign to multiple variables at once
Is there any evidence that Cleopatra and Caesarion considered fleeing to India to escape the Romans?
Do we have to expect a queue for the shuttle from Watford Junction to Harry Potter Studio?
What is Cash Advance APR?
What is the English pronunciation of "pain au chocolat"?
When were female captains banned from Starfleet?
How to convince somebody that he is fit for something else, but not this job?
Merge org tables
Pass data to child template in cart-items of checkout page
Magento2 override admin js filemain.CRITICAL: Plugin class doesn't existOneStepCheckout - display subtotals of tax classPrice not getting updated for second product…Magento 2: Pass data in checkoutMultiple knockout uiComponents should not share the same data / seperate view instancesMagento 2.2.1: Add Custom Upload file attribute in CheckoutPass the values to rest api from magento2 checkout pageCheckout cart xml move items
My site is a market place site where vendors(sellers can sell their product).
Now i want to customize the to group items in cart by each vendor like this:
http://prntscr.com/hmsam6
checkout_index_index.xml
<item name="cart_groups" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/cart-groups</item>
<item name="children" xsi:type="array">
<item name="cart_items" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/cart_groups/cart-items</item>
<item name="children" xsi:type="array">
<item name="details" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details</item>
<item name="children" xsi:type="array">
<item name="thumbnail" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/thumbnail</item>
<item name="displayArea" xsi:type="string">before_details</item>
</item>
<item name="subtotal" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/subtotal</item>
<item name="displayArea" xsi:type="string">after_details</item>
</item>
</item>
</item>
</item>
</item>
</item>
cart-group.js
define([
'ko',
'Magento_Checkout/js/model/totals',
'uiComponent',
'Magento_Checkout/js/model/step-navigator',
'Magento_Checkout/js/model/quote'], function (ko, totals, Component, stepNavigator, quote)
'use strict';
return Component.extend(
defaults:
template: 'Magento_Checkout/summary/cart-groups'
,
groups: window.checkoutConfig.quoteItemData,
getGroups:function()
var tempGroups = this.groups;
var arr = Object.keys(tempGroups).map(function (key) return tempGroups[key]; );
return arr;
,
/**
* Returns bool value for items block state (expanded or not)
*
* @returns *
*/
isItemsBlockExpanded: function ()
return quote.isVirtual() ,
/**
* Returns cart items qty
*
* @returns Number
*/
getItemsQty: function ()
return parseFloat(this.totals['items_qty']);
,
/**
* Returns count of cart line items
*
* @returns Number
*/
getCartLineItemsCount: function ()
return parseInt(totals.getItems()().length, 10);
,
););
cart-group.html
<div class="block items-in-cart"
data-bind="mageInit: 'collapsible':'openedState': 'active', 'active': isItemsBlockExpanded()">
<div class="title" data-role="title">
<strong role="heading">
<translate args="'Item in Cart'" if="getCartLineItemsCount() === 1"/>
<translate args="'Items in Cart'" if="getCartLineItemsCount() > 1"/>
</strong>
</div>
<div class="content minicart-items" data-role="content">
<div class="minicart-items-wrapper overflowed">
<each args="getGroups()">
<p class="checkout-vendor-shop-name" data-bind="text: vendor_shop_name"></p>
<!-- ko foreach: $parent.elems() -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</each>
</div>
</div>
The problem is here:
<each args="getGroups()">
<p class="checkout-vendor-shop-name" data-bind="text: vendor_shop_name"></p>
<!-- ko foreach: $parent.elems() -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</each>
How can i pass data to child template with each data in this loop: getGroups() array. Right now it is all the data in quote, and it is duplicated 2 times
magento2 magento-2.1 checkout magento2.2 knockout
bumped to the homepage by Community♦ yesterday
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
My site is a market place site where vendors(sellers can sell their product).
Now i want to customize the to group items in cart by each vendor like this:
http://prntscr.com/hmsam6
checkout_index_index.xml
<item name="cart_groups" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/cart-groups</item>
<item name="children" xsi:type="array">
<item name="cart_items" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/cart_groups/cart-items</item>
<item name="children" xsi:type="array">
<item name="details" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details</item>
<item name="children" xsi:type="array">
<item name="thumbnail" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/thumbnail</item>
<item name="displayArea" xsi:type="string">before_details</item>
</item>
<item name="subtotal" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/subtotal</item>
<item name="displayArea" xsi:type="string">after_details</item>
</item>
</item>
</item>
</item>
</item>
</item>
cart-group.js
define([
'ko',
'Magento_Checkout/js/model/totals',
'uiComponent',
'Magento_Checkout/js/model/step-navigator',
'Magento_Checkout/js/model/quote'], function (ko, totals, Component, stepNavigator, quote)
'use strict';
return Component.extend(
defaults:
template: 'Magento_Checkout/summary/cart-groups'
,
groups: window.checkoutConfig.quoteItemData,
getGroups:function()
var tempGroups = this.groups;
var arr = Object.keys(tempGroups).map(function (key) return tempGroups[key]; );
return arr;
,
/**
* Returns bool value for items block state (expanded or not)
*
* @returns *
*/
isItemsBlockExpanded: function ()
return quote.isVirtual() ,
/**
* Returns cart items qty
*
* @returns Number
*/
getItemsQty: function ()
return parseFloat(this.totals['items_qty']);
,
/**
* Returns count of cart line items
*
* @returns Number
*/
getCartLineItemsCount: function ()
return parseInt(totals.getItems()().length, 10);
,
););
cart-group.html
<div class="block items-in-cart"
data-bind="mageInit: 'collapsible':'openedState': 'active', 'active': isItemsBlockExpanded()">
<div class="title" data-role="title">
<strong role="heading">
<translate args="'Item in Cart'" if="getCartLineItemsCount() === 1"/>
<translate args="'Items in Cart'" if="getCartLineItemsCount() > 1"/>
</strong>
</div>
<div class="content minicart-items" data-role="content">
<div class="minicart-items-wrapper overflowed">
<each args="getGroups()">
<p class="checkout-vendor-shop-name" data-bind="text: vendor_shop_name"></p>
<!-- ko foreach: $parent.elems() -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</each>
</div>
</div>
The problem is here:
<each args="getGroups()">
<p class="checkout-vendor-shop-name" data-bind="text: vendor_shop_name"></p>
<!-- ko foreach: $parent.elems() -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</each>
How can i pass data to child template with each data in this loop: getGroups() array. Right now it is all the data in quote, and it is duplicated 2 times
magento2 magento-2.1 checkout magento2.2 knockout
bumped to the homepage by Community♦ yesterday
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Yes. Magento 2.2.x. But it is related to knockoutjs, which i am not familiar with. Can you give me some hint to go ?
– Toàn Tam
Dec 13 '17 at 5:59
have you fond solution?
– Abdul
Jan 25 '18 at 5:55
@ToànTam have you found any solution?
– user00247
Dec 10 '18 at 7:33
add a comment |
My site is a market place site where vendors(sellers can sell their product).
Now i want to customize the to group items in cart by each vendor like this:
http://prntscr.com/hmsam6
checkout_index_index.xml
<item name="cart_groups" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/cart-groups</item>
<item name="children" xsi:type="array">
<item name="cart_items" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/cart_groups/cart-items</item>
<item name="children" xsi:type="array">
<item name="details" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details</item>
<item name="children" xsi:type="array">
<item name="thumbnail" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/thumbnail</item>
<item name="displayArea" xsi:type="string">before_details</item>
</item>
<item name="subtotal" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/subtotal</item>
<item name="displayArea" xsi:type="string">after_details</item>
</item>
</item>
</item>
</item>
</item>
</item>
cart-group.js
define([
'ko',
'Magento_Checkout/js/model/totals',
'uiComponent',
'Magento_Checkout/js/model/step-navigator',
'Magento_Checkout/js/model/quote'], function (ko, totals, Component, stepNavigator, quote)
'use strict';
return Component.extend(
defaults:
template: 'Magento_Checkout/summary/cart-groups'
,
groups: window.checkoutConfig.quoteItemData,
getGroups:function()
var tempGroups = this.groups;
var arr = Object.keys(tempGroups).map(function (key) return tempGroups[key]; );
return arr;
,
/**
* Returns bool value for items block state (expanded or not)
*
* @returns *
*/
isItemsBlockExpanded: function ()
return quote.isVirtual() ,
/**
* Returns cart items qty
*
* @returns Number
*/
getItemsQty: function ()
return parseFloat(this.totals['items_qty']);
,
/**
* Returns count of cart line items
*
* @returns Number
*/
getCartLineItemsCount: function ()
return parseInt(totals.getItems()().length, 10);
,
););
cart-group.html
<div class="block items-in-cart"
data-bind="mageInit: 'collapsible':'openedState': 'active', 'active': isItemsBlockExpanded()">
<div class="title" data-role="title">
<strong role="heading">
<translate args="'Item in Cart'" if="getCartLineItemsCount() === 1"/>
<translate args="'Items in Cart'" if="getCartLineItemsCount() > 1"/>
</strong>
</div>
<div class="content minicart-items" data-role="content">
<div class="minicart-items-wrapper overflowed">
<each args="getGroups()">
<p class="checkout-vendor-shop-name" data-bind="text: vendor_shop_name"></p>
<!-- ko foreach: $parent.elems() -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</each>
</div>
</div>
The problem is here:
<each args="getGroups()">
<p class="checkout-vendor-shop-name" data-bind="text: vendor_shop_name"></p>
<!-- ko foreach: $parent.elems() -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</each>
How can i pass data to child template with each data in this loop: getGroups() array. Right now it is all the data in quote, and it is duplicated 2 times
magento2 magento-2.1 checkout magento2.2 knockout
My site is a market place site where vendors(sellers can sell their product).
Now i want to customize the to group items in cart by each vendor like this:
http://prntscr.com/hmsam6
checkout_index_index.xml
<item name="cart_groups" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/cart-groups</item>
<item name="children" xsi:type="array">
<item name="cart_items" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/cart_groups/cart-items</item>
<item name="children" xsi:type="array">
<item name="details" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details</item>
<item name="children" xsi:type="array">
<item name="thumbnail" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/thumbnail</item>
<item name="displayArea" xsi:type="string">before_details</item>
</item>
<item name="subtotal" xsi:type="array">
<item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/subtotal</item>
<item name="displayArea" xsi:type="string">after_details</item>
</item>
</item>
</item>
</item>
</item>
</item>
cart-group.js
define([
'ko',
'Magento_Checkout/js/model/totals',
'uiComponent',
'Magento_Checkout/js/model/step-navigator',
'Magento_Checkout/js/model/quote'], function (ko, totals, Component, stepNavigator, quote)
'use strict';
return Component.extend(
defaults:
template: 'Magento_Checkout/summary/cart-groups'
,
groups: window.checkoutConfig.quoteItemData,
getGroups:function()
var tempGroups = this.groups;
var arr = Object.keys(tempGroups).map(function (key) return tempGroups[key]; );
return arr;
,
/**
* Returns bool value for items block state (expanded or not)
*
* @returns *
*/
isItemsBlockExpanded: function ()
return quote.isVirtual() ,
/**
* Returns cart items qty
*
* @returns Number
*/
getItemsQty: function ()
return parseFloat(this.totals['items_qty']);
,
/**
* Returns count of cart line items
*
* @returns Number
*/
getCartLineItemsCount: function ()
return parseInt(totals.getItems()().length, 10);
,
););
cart-group.html
<div class="block items-in-cart"
data-bind="mageInit: 'collapsible':'openedState': 'active', 'active': isItemsBlockExpanded()">
<div class="title" data-role="title">
<strong role="heading">
<translate args="'Item in Cart'" if="getCartLineItemsCount() === 1"/>
<translate args="'Items in Cart'" if="getCartLineItemsCount() > 1"/>
</strong>
</div>
<div class="content minicart-items" data-role="content">
<div class="minicart-items-wrapper overflowed">
<each args="getGroups()">
<p class="checkout-vendor-shop-name" data-bind="text: vendor_shop_name"></p>
<!-- ko foreach: $parent.elems() -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</each>
</div>
</div>
The problem is here:
<each args="getGroups()">
<p class="checkout-vendor-shop-name" data-bind="text: vendor_shop_name"></p>
<!-- ko foreach: $parent.elems() -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
</each>
How can i pass data to child template with each data in this loop: getGroups() array. Right now it is all the data in quote, and it is duplicated 2 times
magento2 magento-2.1 checkout magento2.2 knockout
magento2 magento-2.1 checkout magento2.2 knockout
asked Dec 13 '17 at 4:58
Toàn TamToàn Tam
424314
424314
bumped to the homepage by Community♦ yesterday
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ yesterday
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Yes. Magento 2.2.x. But it is related to knockoutjs, which i am not familiar with. Can you give me some hint to go ?
– Toàn Tam
Dec 13 '17 at 5:59
have you fond solution?
– Abdul
Jan 25 '18 at 5:55
@ToànTam have you found any solution?
– user00247
Dec 10 '18 at 7:33
add a comment |
Yes. Magento 2.2.x. But it is related to knockoutjs, which i am not familiar with. Can you give me some hint to go ?
– Toàn Tam
Dec 13 '17 at 5:59
have you fond solution?
– Abdul
Jan 25 '18 at 5:55
@ToànTam have you found any solution?
– user00247
Dec 10 '18 at 7:33
Yes. Magento 2.2.x. But it is related to knockoutjs, which i am not familiar with. Can you give me some hint to go ?
– Toàn Tam
Dec 13 '17 at 5:59
Yes. Magento 2.2.x. But it is related to knockoutjs, which i am not familiar with. Can you give me some hint to go ?
– Toàn Tam
Dec 13 '17 at 5:59
have you fond solution?
– Abdul
Jan 25 '18 at 5:55
have you fond solution?
– Abdul
Jan 25 '18 at 5:55
@ToànTam have you found any solution?
– user00247
Dec 10 '18 at 7:33
@ToànTam have you found any solution?
– user00247
Dec 10 '18 at 7:33
add a comment |
1 Answer
1
active
oldest
votes
https://stackoverflow.com/questions/20430976/can-i-pass-a-variable-in-a-template-binding
So something like this:
<div data-bind="foreach: getGroups">
<p class="checkout-vendor-shop-name" data-bind="text: vendor_shop_name"></p>
<!-- ko foreach: $parent.elems() -->
<!-- ko template: name: getTemplate(), templateOptions: myvar: $data --><!-- /ko -->
<!-- /ko -->
</div>
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%2f205564%2fpass-data-to-child-template-in-cart-items-of-checkout-page%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
https://stackoverflow.com/questions/20430976/can-i-pass-a-variable-in-a-template-binding
So something like this:
<div data-bind="foreach: getGroups">
<p class="checkout-vendor-shop-name" data-bind="text: vendor_shop_name"></p>
<!-- ko foreach: $parent.elems() -->
<!-- ko template: name: getTemplate(), templateOptions: myvar: $data --><!-- /ko -->
<!-- /ko -->
</div>
add a comment |
https://stackoverflow.com/questions/20430976/can-i-pass-a-variable-in-a-template-binding
So something like this:
<div data-bind="foreach: getGroups">
<p class="checkout-vendor-shop-name" data-bind="text: vendor_shop_name"></p>
<!-- ko foreach: $parent.elems() -->
<!-- ko template: name: getTemplate(), templateOptions: myvar: $data --><!-- /ko -->
<!-- /ko -->
</div>
add a comment |
https://stackoverflow.com/questions/20430976/can-i-pass-a-variable-in-a-template-binding
So something like this:
<div data-bind="foreach: getGroups">
<p class="checkout-vendor-shop-name" data-bind="text: vendor_shop_name"></p>
<!-- ko foreach: $parent.elems() -->
<!-- ko template: name: getTemplate(), templateOptions: myvar: $data --><!-- /ko -->
<!-- /ko -->
</div>
https://stackoverflow.com/questions/20430976/can-i-pass-a-variable-in-a-template-binding
So something like this:
<div data-bind="foreach: getGroups">
<p class="checkout-vendor-shop-name" data-bind="text: vendor_shop_name"></p>
<!-- ko foreach: $parent.elems() -->
<!-- ko template: name: getTemplate(), templateOptions: myvar: $data --><!-- /ko -->
<!-- /ko -->
</div>
answered Jan 25 '18 at 12:53
sterossteros
827629
827629
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%2f205564%2fpass-data-to-child-template-in-cart-items-of-checkout-page%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
Yes. Magento 2.2.x. But it is related to knockoutjs, which i am not familiar with. Can you give me some hint to go ?
– Toàn Tam
Dec 13 '17 at 5:59
have you fond solution?
– Abdul
Jan 25 '18 at 5:55
@ToànTam have you found any solution?
– user00247
Dec 10 '18 at 7:33