Page 1 of 1

o

Posted: Fri Feb 19, 2016 2:50 am
by wzzhy001
Hello.

At first,I want product could add to wishlist without it`s attribute,like "color","size".

But now,I choose the way that check the product`s attribute and make it default value to save into wishlist. It works well, I make the attribute hidden in the front site.

Now, I use this way to check whether the product has saved in the wishlist.

Code: Select all

<div th:class="${'productActions' + #object.id}">
      <blc:named_order orderVar="wishlist" orderName="wishlist" />
        <div class="in_wishlist" th:classappend="${!wishlist.containsSku(#object.defaultSku)}? ' hidden'">
            <a href="/account/wishlist" class="add_wish">
                <span>in wishlist</span>
                <i class="iconfont">&#xe603;</i>
           </a>
        </div>
        <div class="add_to_wishlist" th:classappend="${wishlist.containsSku(#object.defaultSku)}? ' hidden'">
          <blc:form method="POST" th:action="@{/account/wishlist/add}">   
             <input type="hidden" name="productId" th:value="*{id}" />
             <input type="hidden" name="quantity" value="1" />
             <div class="add_wish addToWishlist">
                  <span>into wishlist</span>
                <i class="iconfont">&#xe602;</i>
               </div>
          </blc:form>
        </div>
   </div>


And the question is the main page could not check the product correctly. Because only the default attribute has saved into the wishlist. So the main page could not show the "in wishlist".

Then I search the method ".containsSku", it belong to OrderImpl.

So I wanna to override the OrderImpl and check the Order.name whether it is "wishlist", and make it other way to check wishlist.

But I just know how to extend an Entity, and it is different from overriding a Service.

How to Override the OrderImpl or it has another method to check whether the product inwishlist without attributes.

My English is poor,excuse me. Please help me. Thank you. The email would make me reply quickly: 344105304@qq.com

If there is any chinese friend, I will use chinese to describe my problem.

我想让商品是否存在于心愿单可以不匹配属性就单独检测该product.id是否存在于心愿单。

现在我在用它原有的检测是否在心愿单的方法,但是由于这个方法会检测匹配对应的sku.这就造成我最初加入心愿单时选择默认值加入心愿单,心愿单里只有一个默认值的商品。(因为我要允许他不选择商品就可以添加到心愿单)

我现在就想重载这个containsSku方法在OrderImpl里,这样我就可以根据Order.name是否叫wishlist来判断是否需要属性匹配。

然而我只会扩展实体,不会像Service类一样重载。

求帮助。谢谢。如果方便可直接邮件至344105304@qq.com