Fixes to option editing

master
Mark Moffat 2019-10-26 11:39:10 +10:30
parent 7070cdef7e
commit 2055f74278
3 changed files with 8 additions and 8 deletions

View File

@ -225,8 +225,8 @@ $(document).ready(function (){
$.ajax({
method: 'POST',
url: '/admin/settings/option/remove/',
data: { productId: $('#frmProductId').val(), optName: name }
url: '/admin/product/removeoption',
data: { productId: $('#productId').val(), optName: name }
})
.done(function(msg){
showNotification(msg.message, 'success', true);
@ -245,7 +245,7 @@ $(document).ready(function (){
var optOptions = $('#product_optOptions').val();
var optJson = {};
if($('#productOptions').val() !== ''){
if($('#productOptions').val() !== '' && $('#productOptions').val() !== '"{}"'){
optJson = JSON.parse($('#productOptions').val());
}
@ -567,7 +567,7 @@ $(document).ready(function (){
$.ajax({
method: 'POST',
url: '/admin/product/setasmainimage',
data: { product_id: $('#frmProductId').val(), productImage: $(this).attr('data-id') }
data: { product_id: $('#productId').val(), productImage: $(this).attr('data-id') }
})
.done(function(msg){
showNotification(msg.message, 'success', true);
@ -581,7 +581,7 @@ $(document).ready(function (){
$.ajax({
method: 'POST',
url: '/admin/product/deleteimage',
data: { product_id: $('#frmProductId').val(), productImage: $(this).attr('data-id') }
data: { product_id: $('#productId').val(), productImage: $(this).attr('data-id') }
})
.done(function(msg){
showNotification(msg.message, 'success', true);
@ -597,7 +597,7 @@ $(document).ready(function (){
$.ajax({
method: 'POST',
url: '/admin/api/validate_permalink',
data: { 'permalink': $('#productPermalink').val(), 'docId': $('#frmProductId').val() }
data: { permalink: $('#productPermalink').val(), docId: $('#productId').val() }
})
.done(function(msg){
console.log('msg', msg);

File diff suppressed because one or more lines are too long

View File

@ -138,7 +138,7 @@
{{#ifCond this.productImage '==' true}}
<span class="label label-info">main image</span>
{{else}}
<a data-id="{{this.path}}" class="set-as-main-image btn btn-sm btn-success">Set as main image</a>
<a data-id="{{../this.path}}" class="set-as-main-image btn btn-sm btn-success">Set as main image</a>
{{/ifCond}}
</p>
<img src="{{this.path}}" class="product-main-image img-responsive">