react_convert
Mark Moffat 2018-02-03 12:58:34 +01:00
commit 931e8c7239
4 changed files with 7 additions and 9 deletions

View File

@ -410,7 +410,7 @@ router.post('/product/insert', common.restrict, (req, res) => {
res.redirect('/admin/product/new');
}else{
// get the new ID
let newId = newDoc.insertedIds;
let newId = newDoc.insertedIds[0];
// add to lunr index
common.indexProducts(req.app)

View File

@ -12,7 +12,7 @@ router.get('/checkout_return', (req, res, next) => {
let db = req.app.db;
let config = common.getConfig();
let paymentId = req.session.paymentId;
let payerId = req.param('PayerID');
let payerId = req.query['PayerID'];
let details = {'payer_id': payerId};
paypal.payment.execute(paymentId, details, (error, payment) => {
@ -190,10 +190,7 @@ router.post('/checkout_action', (req, res, next) => {
}
// get the new ID
let newId = '';
if(newDoc.insertedIds.length > 0){
newId = newDoc.insertedIds[0].toString();
}
let newId = newDoc.insertedIds['0'];
// set the order ID in the session
req.session.orderId = newId;

View File

@ -60,7 +60,7 @@ router.post('/checkout_action', (req, res, next) => {
}
// get the new ID
let newId = newDoc.insertedIds;
let newId = newDoc.insertedIds['0'];
// add to lunr index
common.indexOrders(req.app)
@ -70,7 +70,7 @@ router.post('/checkout_action', (req, res, next) => {
// set the results
req.session.messageType = 'success';
req.session.message = 'Your payment was successfully completed';
req.session.paymentEmailAddr = newDoc.orderEmail;
req.session.paymentEmailAddr = newDoc.ops[0].orderEmail;
req.session.paymentApproved = true;
req.session.paymentDetails = '<p><strong>Order ID: </strong>' + newId + '</p><p><strong>Transaction ID: </strong>' + charge.id + '</p>';

View File

@ -66,6 +66,7 @@
<div class="form-group">
<label>Products per row</label>
<select class="form-control" name="productsPerRow">
<option value="{{config.productsPerRow}}" hidden="hidden" selected="selected">{{config.productsPerRow}}</option>
<option {{selectState '1' config.productsPerRow}}>1</option>
<option {{selectState '2' config.productsPerRow}}>2</option>
<option {{selectState '3' config.productsPerRow}}>3</option>
@ -141,4 +142,4 @@
</div>
</div>
</div>
</div>
</div>