Add quantity input and add to cart button in Search Autocomplete in SearchBox.cshtml ?

7 meses atrás
3.90

I want to add input for quantity and add to cart button in Search Autocomplete in SearchBox.cshtml

This code here:
if (Model.AutoCompleteEnabled)
    {
        <text>
            <script type="text/javascript">
                $(document).ready(function() {
                    $('#small-searchterms').autocomplete({
                            delay: 500,
                            minLength: @(Model.SearchTermMinimumLength.ToString()),
                            source: '@(Url.RouteUrl("ProductSearchAutoComplete"))',
                            appendTo: '.search-box',
                            select: function(event, ui) {
                                $("#small-searchterms").val(ui.item.label);
                                setLocation(ui.item.producturl);
                                return false;
                            }
                        })
                        .data("ui-autocomplete")._renderItem = function(ul, item) {
                            var t = item.label;
                            //html encode
                            t = htmlEncode(t);
                            return $("<li></li>")
                                .data("item.autocomplete", item)
                                .append("<a>@(Model.ShowProductImagesInSearchAutoComplete ? Html.Raw("<img src='\" + item.productpictureurl + \"'>") : null)<span>" + t + "</span></a>")
                                .appendTo(ul);
                        };
                });
            </script>
        </text>
    }


1. Can I do it without touching the source code?
2. If yes, how can I append the input and button here in the code?

Thanks in advance.
7 meses atrás
This is what I want:


Please, help me do it.

Thanks.