Help,ProductOptionsProcessor Not work

Topics related to running, modifying, or working with the Broadleaf Commerce Demo application

Moderator: jocanas

jammyjaccy
Newbie
Newbie
Posts: 4
Joined: Mon Mar 28, 2016 10:03 pm

Help,ProductOptionsProcessor Not work

Postby jammyjaccy » Thu May 19, 2016 9:02 am

I have a customer processer copy from ProductOptionsProcessor,only add a print in the method ,the code is

Code: Select all

private void writeJSONToModel(Arguments arguments, String modelKey, Object o) {
        try {
            String jsonValue = JSON_CACHE.get(o);
            if (jsonValue == null) {
                ObjectMapper mapper = new ObjectMapper();
                Writer strWriter = new StringWriter();
                mapper.writeValue(strWriter, o);
                jsonValue = strWriter.toString();
                JSON_CACHE.put(o, jsonValue);
            }
            log.info("-----" + jsonValue + "-----");
            addToModel(arguments, modelKey, jsonValue);
           
           
            Object result =((Map<String, Object>) arguments.getExpressionEvaluationRoot()).get(modelKey);
            log.info("-------------------------------- " + result.toString()) ;
        } catch (Exception ex) {
           ex.printStackTrace();
            LOG.error("There was a problem writing the product option map to JSON", ex);
        }
    }


when i visit the product page,and the productOptions.html use the tag blc:eshop_product_options,and the tomcat will print something like this:
[2016-05-19 21:36:29 INFO ] [http-apr-80-exec-4] {cn.ebuzz.eshop.core.web.processor.EshopProd
uctOptionsProcessor:145}--------------------------------- [{"price":"¥16.99","selectedOption
s":[3,14]},{"price":"¥16.99","selectedOptions":[2,14]},{"price":"¥16.99","selectedOptions":
[1,14]},{"price":"¥15.99","selectedOptions":[3,13]},{"price":"¥15.99","selectedOptions":[3,
12]},{"price":"¥15.99","selectedOptions":[3,11]},{"price":"¥15.99","selectedOptions":[2,13]
},{"price":"¥15.99","selectedOptions":[2,12]},{"price":"¥15.99","selectedOptions":[2,11]},{
"price":"¥15.99","selectedOptions":[1,13]},{"price":"¥15.99","selectedOptions":[12,1]},{"pr
ice":"¥15.99","selectedOptions":[1,11]}]

but the productOptions page still have the code :

Code: Select all

<div id="product-option-data" th:attr="data-product-option-pricing=${skuPricing}, data-product-options=${allProductOptions}" />

when F12,find the html sourcecode ,it will be :

Code: Select all

<div id="product-option-data"></div>

anyone can give me some help!? how to fix this? thanks !

Return to “Broadleaf Commerce Demo”

Who is online

Users browsing this forum: No registered users and 1 guest