-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Fixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release
Description
The left block Last Ordered Items is not showing properly the Add to cart button on the :
data-bind="css: {'no-display': !lastOrderedItems().isShowAddToCart}
Always returning false.
Target JS file is : Magento_Sales/web/js/view/last-ordered-items.js
Preconditions
- Environnement Docker NGINX php 7
- Magento 2.2
Steps to reproduce
- In my account or in catalog, left block Last ordered items not showing properly for add to cart button
Expected result
- Add to cart button viewable to add last ordered items to cart
Actual result
- lastOrderedItems().isShowAddToCart always returning FALSE so the add to cart div actions stands with no-display CSS class
Original Code of Magento_Sales/web/js/view/last-ordered-items.js
define([
'uiComponent',
'Magento_Customer/js/customer-data'
], function (Component, customerData) {
'use strict';
return Component.extend({
/** @inheritdoc */
initialize: function () {
var isShowAddToCart = false,
item;
this._super();
this.lastOrderedItems = customerData.get('last-ordered-items');
for (item in this.lastOrderedItems.items) {
if (item['is_saleable']) {
isShowAddToCart = true;
break;
}
}
this.lastOrderedItems.isShowAddToCart = isShowAddToCart;
}
});
});
My correction Code :
define([
'uiComponent',
'Magento_Customer/js/customer-data',
'jquery'
], function (Component, customerData, $) {
'use strict';
return Component.extend({
/** @inheritdoc */
initialize: function () {
var isShowAddToCart = false,
item;
this._super();
this.lastOrderedItems = customerData.get('last-ordered-items');
var self = this;
$(this.lastOrderedItems().items).each(function(){
if(this['is_saleable']) {
self.lastOrderedItems().isShowAddToCart = true;
}
});
}
});
});
Metadata
Metadata
Assignees
Labels
Fixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release