Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit e17acca

Browse files
committed
Merge pull request #1437 from OpenBazaar/fixShippingBug
Fix shipping bug
2 parents 173720e + ff84ace commit e17acca

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

js/templates/buyDetails.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
</form>
3939
</div>
4040
</div>
41-
<div class="flexCol-4">
41+
<div class="flexCol-4 overflowHidden">
4242
<div class="rowItem padding2015 alignRight marginTop20">
4343
<span class="noOverflow fontSize13 js-buyWizardBTCPrice"></span>
4444
<span class="noOverflow textOpacity75 fontSize13 js-buyWizardPrice">

js/views/buyDetailsVw.js

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,34 @@ module.exports = Backbone.View.extend({
1414

1515
initialize: function() {
1616
"use strict";
17-
var currentShippingPrice = 0,
17+
var recipient = this.model.get('page').profile.handle || this.model.get('page').profile.guid;
18+
19+
this.model.set('recipient', recipient);
20+
21+
this.listenTo(this.model, 'change:selectedModerator change:selectedAddress', this.render);
22+
this.render();
23+
},
24+
25+
render: function(){
26+
var self = this,
27+
currentShippingPrice = 0,
1828
currentShippingBTCPrice = 0,
19-
recipient = this.model.get('page').profile.handle || this.model.get('page').profile.guid;
20-
if(this.model.get('vendor_offer').listing.shipping.free !== true) {
21-
if(this.model.get('userCountry') != this.model.get('vendor_offer').listing.shipping.shipping_origin) {
29+
shippingType = "",
30+
templJSON = {};
31+
console.log(this.model)
32+
33+
//set prices before each render
34+
if(this.model.get('vendor_offer').listing.shipping.free !== true && this.model.get('selectedAddress')) {
35+
if(this.model.get('selectedAddress').country != this.model.get('vendor_offer').listing.shipping.shipping_origin) {
2236
currentShippingPrice = this.model.get('internationalShipping');
2337
currentShippingBTCPrice = this.model.get('internationalShippingBTC');
2438
this.model.set('shippingType', 'international');
39+
shippingType = 'international';
2540
} else {
2641
currentShippingPrice = this.model.get('domesticShipping');
2742
currentShippingBTCPrice = this.model.get('domesticShippingBTC');
2843
this.model.set('shippingType', 'domestic');
44+
shippingType = 'domestic';
2945
}
3046
}
3147

@@ -39,14 +55,6 @@ module.exports = Backbone.View.extend({
3955
currency: this.model.get('userCurrencyCode')
4056
}).format(currentShippingPrice));
4157

42-
this.model.set('recipient', recipient);
43-
44-
this.listenTo(this.model, 'change:selectedModerator change:selectedAddress', this.render);
45-
this.render();
46-
},
47-
48-
render: function(){
49-
var self = this;
5058
loadTemplate('./js/templates/buyDetails.html', function(loadedTemplate) {
5159
self.$el.html(loadedTemplate(self.model.toJSON()));
5260
//this does not add it to the DOM, that is done by the parent view

0 commit comments

Comments
 (0)