Override wishlist.containsSku
Posted: Sun Feb 21, 2016 8:47 pm
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.
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
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"></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"></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