Orchard/Magelia How to override basket count part output


Hi. I'm have a issue while try override output from the Basket count part, By default this layout use any data from model and text, that reallly rendered , for example "Basket(4)", rendered by java script code. I can't expand how to alternate this.
Closed Feb 27, 2014 at 8:04 AM by cdurand


yaligault wrote Jul 15, 2013 at 4:31 PM

Thank you for your question and for your interest in Magelia WebStore. We will look at the issue get back to you tomorrow.
Best regards,

yaligault wrote Jul 16, 2013 at 1:06 PM


Please find hereafter the answer Aloys from the Magelia team wrote :.

The basket count is divided into four parts :
  1. The view of the basket count widget is here: « Modules\Magelia.WebStore\Views\Parts\ BasketCount.cshtml ». This view does not directly display the number of items in the basket, it references the container in which the number of items in the basket will be displayed asynchronously (because this number can change). The basketcount view also references the client model that will be instantiated by the Magelia client framework, via the "mag-basket-Count" css class. This view can be overridden by adding a view to tour Orchard theme. If you do so, make sure that you use the same path as BasketCount.cshtml (for example: « Themes\YOURTHEME\Views\Parts\BasketCount.cshtml »).
  2. The client model (written in javascript) is located in the MageliaWebSTore module for Orchard: « Modules\Magelia.WebStore\Scripts\Libraries\Magelia\Magelia.BasketCount.js ».
    The methods of this model can be overwritten in the current theme, by using the $.extend method. This JQuery method is natively supported by Orchard. Please find hereafter sample code that demonstrates how to override « Basket(X) » in the basket count widget and display a warning message instead:
@using (this.Script.Foot())
<script type="text/javascript">
    if (typeof (Magelia) != 'undefined' && $.isFunction(Magelia.BasketCount)) {
                refresh: function () {
                    if (this.config.getBasketCountUrl) {
                            function (response) {
  1. The « BasketCount » action of the « BasketController »controler located in the Magelia WebStore module for Orchard : « Modules\Magelia.WebStore\Controllers\BasketController.cs ». This action is called asynchronously by the client and will call the Magelia WebStore webservices in order to get the number of distinct SKUs (except offered products if any) of the basket and will return that number to the « Basket/BasketCount » shape.
  2. The view that displays the numver of elements in the basket: « Modules\Magelia.WebStore\Views\DisplayTemplates\Basket\BasketCount.cshtml » called by the « BasketCount » action. This view will render the HTML « <p>Basket(X)</p> ». In order to overrride this view and personalize tour template, use the same procedure as for the widget view and make sure to respect the path for your THEME (Themes\YOURTHEME\Views\ DisplayTemplates\Basket\BasketCount.cshtml).
With this explanation you should now have a better voiew of how to override the Basketcount part.

Please do not hesitate if you have any other question.

Best regards.

wrote Jul 16, 2013 at 1:20 PM

Mikle wrote Aug 3, 2013 at 5:32 AM

I resolved my problem by changing Modules\Magelia.WebStore\Views\DisplayTemplates\Basket\BasketCount.cshtm view.
Thanks you for irrefragable answer.

wrote Feb 27, 2014 at 8:04 AM