Merge branch 'master' of https://github.com/mrvautin/expressCart
commit
931e8c7239
|
@ -410,7 +410,7 @@ router.post('/product/insert', common.restrict, (req, res) => {
|
||||||
res.redirect('/admin/product/new');
|
res.redirect('/admin/product/new');
|
||||||
}else{
|
}else{
|
||||||
// get the new ID
|
// get the new ID
|
||||||
let newId = newDoc.insertedIds;
|
let newId = newDoc.insertedIds[0];
|
||||||
|
|
||||||
// add to lunr index
|
// add to lunr index
|
||||||
common.indexProducts(req.app)
|
common.indexProducts(req.app)
|
||||||
|
|
|
@ -12,7 +12,7 @@ router.get('/checkout_return', (req, res, next) => {
|
||||||
let db = req.app.db;
|
let db = req.app.db;
|
||||||
let config = common.getConfig();
|
let config = common.getConfig();
|
||||||
let paymentId = req.session.paymentId;
|
let paymentId = req.session.paymentId;
|
||||||
let payerId = req.param('PayerID');
|
let payerId = req.query['PayerID'];
|
||||||
|
|
||||||
let details = {'payer_id': payerId};
|
let details = {'payer_id': payerId};
|
||||||
paypal.payment.execute(paymentId, details, (error, payment) => {
|
paypal.payment.execute(paymentId, details, (error, payment) => {
|
||||||
|
@ -190,10 +190,7 @@ router.post('/checkout_action', (req, res, next) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the new ID
|
// get the new ID
|
||||||
let newId = '';
|
let newId = newDoc.insertedIds['0'];
|
||||||
if(newDoc.insertedIds.length > 0){
|
|
||||||
newId = newDoc.insertedIds[0].toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the order ID in the session
|
// set the order ID in the session
|
||||||
req.session.orderId = newId;
|
req.session.orderId = newId;
|
||||||
|
|
|
@ -60,7 +60,7 @@ router.post('/checkout_action', (req, res, next) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the new ID
|
// get the new ID
|
||||||
let newId = newDoc.insertedIds;
|
let newId = newDoc.insertedIds['0'];
|
||||||
|
|
||||||
// add to lunr index
|
// add to lunr index
|
||||||
common.indexOrders(req.app)
|
common.indexOrders(req.app)
|
||||||
|
@ -70,7 +70,7 @@ router.post('/checkout_action', (req, res, next) => {
|
||||||
// set the results
|
// set the results
|
||||||
req.session.messageType = 'success';
|
req.session.messageType = 'success';
|
||||||
req.session.message = 'Your payment was successfully completed';
|
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.paymentApproved = true;
|
||||||
req.session.paymentDetails = '<p><strong>Order ID: </strong>' + newId + '</p><p><strong>Transaction ID: </strong>' + charge.id + '</p>';
|
req.session.paymentDetails = '<p><strong>Order ID: </strong>' + newId + '</p><p><strong>Transaction ID: </strong>' + charge.id + '</p>';
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Products per row</label>
|
<label>Products per row</label>
|
||||||
<select class="form-control" name="productsPerRow">
|
<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 '1' config.productsPerRow}}>1</option>
|
||||||
<option {{selectState '2' config.productsPerRow}}>2</option>
|
<option {{selectState '2' config.productsPerRow}}>2</option>
|
||||||
<option {{selectState '3' config.productsPerRow}}>3</option>
|
<option {{selectState '3' config.productsPerRow}}>3</option>
|
||||||
|
|
Loading…
Reference in New Issue