Earlier we launched uWebshop 1.8 with quite some nice new functionality.
As usual we try to release an update package from previous version as soon as possible.
Today we release a single update package from uWebshop 1.6.0.2 or uWebshop 1.7 to 1.8.0.1 as well as an update package from 1.8.0.0 to 1.8.0.1
As usual downloads can be found on the uWebshop our.umbraco page
(at the bottom)
WARNING: If you are not yet on 1.6.0.2 please use the previous update packages to get to 1.6.0.2 first!
New in version 1.8.0.1 (27 april 2012)
- Tested with Umbraco 4.7.2
- Changes to the default CustomerData control to allow customer to set their own password
- Validation on SSWS_OrderOverview.ascx if stock isn’t empty
- New setting: disableStockAndOrderdUpdates. This disables any updates to the catalog after a customer confirms it’s order.
- Fixt an issue with stock
- Various code optimalisations & Bug fixes
Not required manual updates to be done for 1.6.0.2 and 1.7.0.x and 1.8.0.0 users
Stock Validation
If you want to make use of the Stock Validation to disable people form submitting the order if there is not enough stock open the SSWS_OrderOverview.ascx file and add this validator line:
<asp:CustomValidator id="valItemsOutOfStock" runat="server" />
Manual updates to be done for 1.6.0.2 and 1.7.0.x users
Property Types
To update to this release you have to add some property types manually:
on the sswsPaymentProvider document type you can add the following properties on each shopAlias/Language tab:
Amount property
Name: #Amount
Alias: amount_ShopAlias (example: amount_NL or amount_SHOP)
Type: Textstring
VAT property
Name: #Tax
Alias: taxPercentage_ShopAlias (example: taxPercentage_NL or taxPercentage_SHOP)
Type: SSWS – VAT Picker
on the sswsShippingProvider document type you can add the following property on each shopAlias/Language tab:
VAT property
Name: #Tax
Alias: taxPercentage_ShopAlias (example: taxPercentage_NL or taxPercentage_SHOP)
Type: SSWS – VAT Picker
Scripts
We updated are .Base class quite a bit to allow the new text and imageId be added to each orderline. This requires new javascript. Use the code below to update your files accordingly:
ssws.js
/* UWEBSHOP CLASS */
if (typeof SuperSimpleWebshop === 'undefined') { var SuperSimpleWebshop = {}; }
(function () {
/* UWEBSHOP PUBLIC METHODS */
SuperSimpleWebshop.addUpdateOrderLine = function (shopAlias,pricingId, action, quantity, variants, text, imageId, success, error) {
var params = [shopAlias,pricingId,action,quantity,variants, text, imageId], formData = null;
return ssws_service.callBase('AddUpdateOrderLine', params, formData, success, error);
};
SuperSimpleWebshop.GetOrderForCurrentCustomer = function (shopAlias, success, error) {
var params = [shopAlias], formData = null;
return ssws_service.callBase('GetOrderForCurrentCustomer', params, formData, success, error);
};
SuperSimpleWebshop.getDictionaryItem = function (shopAlias,key, success, error) {
var params = [shopAlias,key], formData = null;
return ssws_service.callBase('GetDictionaryItem', params, formData, success, error);
};
SuperSimpleWebshop.GetJSONForCategory = function (shopAlias,CategoryId, success, error) {
var params = [shopAlias,CategoryId], formData = null;
return ssws_service.callBase('GetJSONForCategory', params, formData, success, error);
};
SuperSimpleWebshop.GetJSONForProduct = function (shopAlias,ProductId, success, error) {
var params = [shopAlias,ProductId], formData = null;
return ssws_service.callBase('GetJSONForProduct', params, formData, success, error);
};
SuperSimpleWebshop.GetJSONForPricing = function (shopAlias,PricingId, success, error) {
var params = [shopAlias,PricingId], formData = null;
return ssws_service.callBase('GetJSONForPricing', params, formData, success, error);
};
/* UWEBSHOP PRIVATE SERVICE OBJECT */
var SuperSimpleWebshopService = function () {
var superSimpleWebshopService = this;
superSimpleWebshopService.callBase = function (methodName, args, data, success, error, dataType) {
jQuery.ajax({
type: 'POST',
url: superSimpleWebshopService.createUrl(methodName, args),
data: data,
async: true,
success: function (data, status, xmlHttpRequest) {
if (success) {
success(data);
}
},
error: function(xmlHttpRequest, status, errorThrown) {
if(error){
error(data);
}
},
cache: false,
contentType: 'application/json; charset=utf-8',
dataType: 'json'
});
};
superSimpleWebshopService.createUrl = function (method, args) {
var baseUrl = '/Base/SuperSimpleWebshop/' + method;
if (args) {
for (var i = 0; i < args.length; i++) {
baseUrl += '/' + args[i];
}
}
return baseUrl + '.aspx';
};
};
var ssws_service = new SuperSimpleWebshopService();
})();
ssws-script.js
// UWEBSHOP EXAMPLE SCRIPTS
$(document).ready(function () {
$.fn.GetJSONForCategory = function (CategoryId, shopAlias) {
SuperSimpleWebshop.GetJSONForCategory(CategoryId, shopAlias,
function (data) {
alert(data.Title);
},
function (data) {
alert('Error' + data.status);
});
};
$.fn.GetJSONForProduct = function (ProductId, shopAlias) {
SuperSimpleWebshop.GetJSONForProduct(ProductId, shopAlias,
function (data) {
alert(data.Title);
},
function (data) {
alert('Error' + data.status);
});
};
$.fn.GetOrderForCurrentCustomer = function (shopAlias) {
SuperSimpleWebshop.GetOrderForCurrentCustomer(shopAlias,
function (data) {
return data;
},
function (data) {
alert('Error' + data.status);
});
};
$.fn.UpdateMiniBasket = function (shopAlias) {
SuperSimpleWebshop.GetOrderForCurrentCustomer(shopAlias,
function (data) {
$('#minibasket dl dd').text(data.TotalAmountWithTax);
$('#minibasket dl dd').effect("bounce", { times: 3 }, 300);
},
function (data) {
alert('Error' + data.status);
});
};
$.fn.GetJSONForPricing = function (PricingId, shopAlias) {
SuperSimpleWebshop.GetJSONForPricing(PricingId, shopAlias,
function (data) {
alert(data.Title);
},
function (data) {
alert('Error' + data.status);
});
};
$.fn.AddUpdateOrderline = function (shopAlias, id, action, quantity, variants, text, imageId, obj, originalClass) {
SuperSimpleWebshop.addUpdateOrderLine(shopAlias, id, action, quantity, variants, text, imageId,
function (data) {
if (obj) {
$(obj).attr('class', originalClass);
}
$.fn.UpdateMiniBasket(shopAlias);
},
function (data) {
if (obj) {
$(obj).attr('class', originalClass);
}
$.fn.UpdateMiniBasket(shopAlias);
});
};
// shopdirect links
$('.shopdirect a').click(function (event) {
// stop href from firing
event.preventDefault();
var currentObject = $(this);
var originalClass = $(this).attr('class');
var shopAlias = $('body').attr('id');
var pricingID = $(this).attr('id');
$(this).attr('class', 'loader');
$.fn.AddUpdateOrderline(shopAlias, pricingID, 'add', 1, '0', '0', '0', currentObject, originalClass);
});
// productpage to basket links
$('.pricingblock > form > input[type=submit]').click(function (event) {
// stop href from firing
event.preventDefault();
var items = '';
$(this).parent().find('select[name*=variant] option:selected').each(function (i) {
if (!$(this).attr("disabled")) {
items += $(this).val() + ',';
}
});
var currentObject = $(this);
var originalClass = $(this).attr('class');
var originalText = $(this).val();
var shopAlias = $('body').attr('id');
var pricingID = $(this).parent().find('input[name=product]').val();
var action = $(this).parent().find('input[name=action]').val();
var quantity = $(this).parent().find('input[name=quantity]').val();
var variants = items.substring(0, items.length - 1);
var text = '0';
var imageId = '0';
if ($(this).parent().find('input[name=text]').length) {
if ($(this).parent().find('input[name=text]').val().length) {
text = $(this).parent().find('input[name=text]').val();
}
}
if ($(this).parent().find('input[name=imageId]').length) {
if ($(this).parent().find('input[name=imageId]').val().length) {
imageId = $(this).parent().find('input[name=imageId]').val();
}
}
if (variants == '')
variants = '0';
$(this).attr('class', 'loader');
$.fn.AddUpdateOrderline(shopAlias, pricingID, action, quantity, variants, text, imageId, currentObject, originalClass);
$(this).effect("pulsate", { times: 1 }, 400);
});
// this function must be below any add or update function to prevent mixups
$('.button').click(function (event) {
var currentButton = $(this);
var originalClass = $(this).attr('class');
$(this).attr('class', 'loader');
setTimeout(function () { $(currentButton).attr('class', originalClass) }, 500);
});
//equalize height of product blocks for demo skin
$.fn.equalHeight = function (group) {
var tallest = 0;
group.each(function () {
var thisHeight = $(this).height();
if (thisHeight > tallest) {
tallest = thisHeight;
}
});
group.height(tallest);
};
//equalize height of product blocks for demo skin
if ($('ul.itemgrid li.productblock').length) {
$.fn.equalHeight($("ul.itemgrid li.productblock"));
};
//equalize height of pricing blocks for demo skin
if ($('li.pricingblock').length) {
$.fn.equalHeight($("li.pricingblock"));
};
});
Update the SSWS-CustomerData macro
Open the SSWS-CustomerData macro and click the “Browse properties” button.
This will add the new parameters to this macro.
Extra manual changes if you are updating from 1.6.0.2
If you are updating from a 1.6.0.2 release and want to make use of the ‘accept terms and conditions’ validation on the customer data module you have to add the following fields to the SSWS_CustomerData.ascx usercontrol:
<asp:CheckBox ID="chkAcceptTerms" runat="server" /> <asp:CustomValidator id="valAcceptTerms" runat="server" />
There are also two dictionary items corresponding with these two fields:
- AcceptTermsAndConditions
This dictionary item is used to display the accept terms and conditions label next to the checkbox. You can use HTML code in there to generate a link to the terms and conditions page of your webshop. - AcceptTermsAndConditionsError
This dictionary item is used to display the error when a customer does not check the accept terms and conditions checkbox.
Web.config update
If you want to make use of the new URL’s without ID’s and fully configurable as introduced in uWebshop 1.7 you have to add the following two lines to the <appsettings> section of the web.config:
<add key="sswsCategoryUrl" value="categoryUrl" /> <add key="sswsProductUrl" value="productUrl" />
Please let us know if something is not clear, or something is not working after the update!
After running this a few times we had nodes showing up, wahoo! But hmmm, “Unnamed”? We did send a name into it: Name = nodeName. Curious.
And there we have it: the ability to create whatever we want! You may have noticed that if the parentId variable is empty, the parent Id is set to the ContentVirtualRoot, that is how the “My first category” node was created.