nbrightproject / NBrightBuy

NBrightStore - E-Commerce for DNN (NBSv3)
http://www.nbrightproject.org/
21 stars 15 forks source link

Option problem in ver. 3.6.5.1 #157

Closed BenderNETs closed 6 years ago

BenderNETs commented 6 years ago

Hello, I'm trying to add some options to my articles. On the prodcut details page I see the dropdownbox with the options but they are all empty (I can see all empty options with values like "T5nU9bGZ" in the html code). Since I added options I can also not buy the article anymore. When I click on the buy button nothing happens. All options are only "sizes" like "Small", "Medium", "Large" with no extra cost ($0). Is there anything I missed or is this a bug?

Thanks, Harald

leedavi commented 6 years ago

I take it you did put text in for the values.

Did you click the required checkbox?

I'm not aware of any issues with options and your the first to report this for v3.5, whcih has been out for quite a time now.

This is in French (Not had time to do the English, yet), but do a bing translate, see if it points something out. But it's all fairly simple.

http://nbs3manager.nbrightproject.org/fr-fr/Documentation/Catalog/Articles-section/Options-of-products

Also post question on the forum, I'm trying to save GitHub for known issue.

https://forum.nbrightproject.org/

BenderNETs commented 6 years ago

I checked the required box. See attached. Are there any other settings I missed?

screenshot_3 screenshot_2 screenshot_1

BenderNETs commented 6 years ago

Just found out that the "Buy" button doesn't work on any article (even the ones without options). The only way I get them in the cart is by clicking the cart icon on the image in the product list.

leedavi commented 6 years ago

The add to basket is done via ajax, so check for any JS errors. I can't remmeber what template is being used on v3.5.6, but I'll be surprised if this isn't working.

leedavi commented 6 years ago

Also make sure you have the mini basket on the page. The JS for the ajax is included in that template.

Tychodewaard commented 6 years ago

The templates have been adjusted and there is a language parameter needed to show the options.

Tychodewaard commented 6 years ago

At one point the options where missing at my sites too. First the options were missing in the back end. When adjusted the back end template (there was a path genxml/ which became later genxml/lang/genxml/ ) the options were back. The options were stored in the db with language parameters but then the front of the store became empty as the templates needed adjustment too. After adjusting the theme template, all was well

My ProductDisplayDetail.cshtml looks like this now:

@inherits NBrightBuy.render.NBrightBuyRazorTokens @using System.Linq @using NBrightDNN @using Nevoweb.DNN.NBrightBuy.Components;

@AddMetaData("resourcepath", "/DesktopModules/NBright/NBrightBuy/App_LocalResources/")

@{ // assign Model, so we can resolve var in VS var product = (ProductData)Model.List.First(); var info = (NBrightInfo)product.Info; }

@CategoryBreadCrumb(true, Model)
@if (@product.Imgs.Count >= 1) {
@if (Model.GetSetting("enablefavorites") == "True") { } @if (product.Imgs.Count > 0) { } else {
@(Model.GetSettingHtmlOf("noimageicon"))NO IMAGE
} @if (@product.IsOnSale) {
@ResourceKey("ProductView.onsaleflag")
} @if (!@product.IsInStock) {
@ResourceKey("ProductView.outofstockflag")
} @if (product.HasProperty("promotionflag")) {
}
                    }

    <!-- fields required to send required ajax data to server to purchase product -->
    <div class="purchasing entryid@(info.ItemID)">
        <input id="@(info.ItemID)_productid" type="hidden" value="@(info.ItemID)">
        <input id="lang" type="hidden" value="@(info.Lang)">

        <h1 itemprop="name">@(product.ProductName)</h1>

        <div class="price">
        @if (@info.GetXmlProperty("genxml/checkbox/callforprice").ToLower() == "true") {
            <div class="cfp">Prijs op aanvraag</div>

            } else {

                if (product.IsOnSale)
            {
                <span>@ResourceKey("ProductView.onsale") : </span>
                <span class="old"> @(NBrightBuyUtils.FormatToStoreCurrency(product.FromPrice()))</span>
                <span class="sale"> @(NBrightBuyUtils.FormatToStoreCurrency(product.BestPrice()))</span>
            }
            else
            {
                if (product.Models.Count > 1 || product.Options.Count >= 1 || product.FromPrice() > product.BestPrice()) // has models or options
                {
                    <span>@ResourceKey("ProductView.from")</span>
                }
                <span> @(NBrightBuyUtils.FormatToStoreCurrency(product.BestPrice()))</span>
            }

            }<!-- end call for price -->
        </div>

        <!-- PAR LOT -->

                <div class="bulkprice">

            <!--        <div class="bulklot">Par lot :</div>-->
                    <div class="bulkpromo">
                        @foreach (NBrightInfo m in product.Models)
                        {
                            var unitcost = m.GetXmlPropertyDouble("genxml/textbox/txtunitcost");
                            var saleprice = m.GetXmlPropertyDouble("genxml/textbox/txtsaleprice");
                            var unitqty = m.GetXmlPropertyDouble("genxml/textbox/unitqty");
                            var orginalPrice = Math.Round(product.HighUnitPrice()*unitqty, 2);
                            var modelbestprice = unitcost;
                            if (saleprice > 0 && unitcost > saleprice)
                            {
                                modelbestprice = saleprice;
                            }

                            if (unitqty > 1 & (orginalPrice != modelbestprice)) // display bulk and only if the bulk price is not the highest price.
                            {
                                <div class="stamps">
                                    <div class="onsaleflag">-<span>@NBrightBuyUtils.CalcPricePercentageDiff(orginalPrice, modelbestprice).ToString("0")</span>%
                                    </div>
                                    <span class="old">@NBrightBuyUtils.FormatToStoreCurrency(orginalPrice)</span>
                                    <strong>@NBrightBuyUtils.FormatToStoreCurrency(modelbestprice)</strong>
                                </div>
                            }
                        }
                    </div>

                </div>

        @if (@info.GetXmlProperty("genxml/lang/genxml/textbox/txtsummary") != "")
        {
            <div itemprop="description" class="summary">@BreakOf(info, "genxml/lang/genxml/textbox/txtsummary")</div>
        }

        @if (@product.Models.Count >= 2)
        {
            var c = 0;
            <div class="models">
                @if (Model.GetSetting("modeldisplaytype") == "0" && (product.Models.Count >= 2))
                {
                    @ModelsRadio(info)
                }
                @if (Model.GetSetting("modeldisplaytype") == "1" && (product.Models.Count >= 2))
                {
                    @ModelsDropDown(info)
                }
                @if (Model.GetSetting("modeldisplaytype") == "2")
                {
                    foreach (NBrightInfo x in product.Models)
                    {
                        <div class="quantityoptions">
                            <a class="qtyminus" index="@(c)" href="javascript:void(0)">-</a>
                            <input type="text" id="selectedmodelqty@(c)" update="save" class="quantity" style='width: 21px' value="1" />
                            <!-- use hiddenfield to pass back modelid -->
                            <input id="selectedmodelid@(c)" type="hidden" value="@(x.GetXmlProperty("genxml/hidden/modelid"))">
                            <a class="qtyplus" index="@(c)" href="javascript:void(0)">+</a>
                            <label>@NBrightBuyUtils.GetItemDisplay(x, "{name} ({bestprice})", true) </label>
                        </div>
                        c += 1;
                    }
                }
            </div>
            <div class="clearfix"></div>
        }

        @if (@product.Options.Count >= 1)
        {
            <div class="options">
                <!-- OPTION HERE -->
                @ProductOptions(product)

            </div>
            <div class="clearfix"></div>
        }

        @if (product.ClientFileUpload)
        {
            <div class="options">

                <div id="clientfileuploadmsg">
                    @ResourceKey("ProductView.clientfileuploadmsg")
                </div>
                <div id="clientfileuploadmsgend" style="display: none;">
                    @ResourceKey("ProductView.clientfileuploadmsgend")
                </div>

                <div class="fileUpload dnnSecondaryAction">
                    <span>@ResourceKey("OrderAdmin.choosefile")</span>
                    <input id='optionfile' update='save' class="normalFileUpload form-control" type='file' name="files[]" multiple />
                </div>
                <div id="progressbar" style="display: none;">
                    <div id="progressbarpercent"></div>
                </div>

                <input id='optionfilelist' style='display: none;' update='save' type='text' />
                <input id='optionfileprefix' update='save' type='hidden' />

            </div>
            <div class="clearfix"></div>
        }

@if (@info.GetXmlProperty("genxml/checkbox/callforprice").ToLower() != "true") { if (Model.GetSetting("cataloguemode") != "True") {

@if (@product.IsInStock) { if (Model.GetSetting("modeldisplaytype") != "2") {
- @TextBox(info, "genxml/textbox/selectedaddqty", "class='quantity selectedaddqty' style='width:21px'", "1") +
} @ResourceKey("ProductView.addtobasket") } else { @ResourceKey("ProductView.outofstock") } @ResourceKey("ProductView.return")
                }

                } <!-- cla for price -->
                <div>
                    @HtmlOf(product.Info, "genxml/lang/genxml/hidden/promodesc")
                </div>
            </div>
    <div class="clearfix"></div>

<!-- Details -->
    @{
        var modeltableclass = "tab-content tab-hide";
    }
        <div class="details">

           <ul class="nav-tabs">

@if (info.GetXmlProperty("genxml/lang/genxml/edt/description") != "") {

  • @ResourceKey("ProductView.description")
  • } @*@if (product.Models.Count > 1) // has models { if (info.GetXmlProperty("genxml/lang/genxml/edt/description") == "") { modeltableclass = "tab-content tab-active";
  • @ResourceKey("ProductView.models")
  • } else {
  • @ResourceKey("ProductView.models")
  • } }*@ @if (product.Docs.Count >= 1) {
  • @ResourceKey("ProductView.documentation")
  • } @if (Model.GetSetting("addthispubid") != "") {
    } @if (@info.GetXmlProperty("genxml/lang/genxml/edt/description") != "") {

    @ResourceKey("ProductView.description")

    @HtmlOf(info, "genxml/lang/genxml/edt/description")
    } @if (@product.Models.Count > 1) // has models {

    @ResourceKey("ProductView.models")

    @foreach (var m in product.Models) { if (!bool.Parse(m.GetXmlProperty("genxml/checkbox/chkishidden"))) { @if (Model.GetSetting("productcode") == "True") { if (m.GetXmlProperty("genxml/textbox/txtmodelref") == "") { } else { } } } }
    @m.GetXmlProperty("genxml/lang/genxml/textbox/txtmodelname") @m.GetXmlProperty("genxml/lang/genxml/textbox/txtextra")NC@m.GetXmlProperty("genxml/textbox/txtmodelref") @if (product.BestPrice() < product.FromPrice()) { @NBrightBuyUtils.FormatToStoreCurrency(product.FromPrice()) @NBrightBuyUtils.FormatToStoreCurrency(product.BestPrice()) } else { @NBrightBuyUtils.FormatToStoreCurrency(product.BestPrice()) } @if (!product.IsInStock) { @ResourceKey("ProductView.outofstock") }
    } @if (@product.Docs.Count >= 1) {

    @ResourceKey("ProductView.documentation")

      @foreach (var doc in product.Docs) {
    • @ResourceKey("ProductView.filebullets")@doc.GetXmlProperty("genxml/textbox/txttitle")@doc.GetXmlProperty("genxml/textbox/txtdocdesc") @ResourceKey("ProductView.download")
    • }
    }
    @if (@product.GetRelatedProducts().Count >= 1) {

    @ResourceKey("ProductView.recommend")

    @foreach (var rp in product.GetRelatedProducts()) { var rproduct = new ProductData(rp.ItemID, rp.Lang);
    @if (rp.GetXmlProperty("genxml/imgs/genxml[1]/hidden/imageurl") != "") {
    } else {
    @(Model.GetSettingHtmlOf("noimageicon"))
    }

    @ProductName(rp)

    @*
    @if (product.IsOnSale) { if (product.Models.Count > 1) {@ResourceKey("ProductView.from")}@(NBrightBuyUtils.FormatToStoreCurrency(rproduct.FromPrice()))@(NBrightBuyUtils.FormatToStoreCurrency(rproduct.SalePrice())) } else { if (product.Models.Count > 1) // has models or options {@ResourceKey("ProductView.from")}@(NBrightBuyUtils.FormatToStoreCurrency(rproduct.FromPrice())) }
    @if (rproduct.IsOnSale) {
    @ResourceKey("ProductView.onsaleflag")
    } @if (!rproduct.IsInStock) {
    @ResourceKey("ProductView.outofstockflag")
    } @ResourceKey("ProductView.view")*@
    }
    }
    BenderNETs commented 6 years ago

    The missing mini basket module on the product details page helped to get the "Buy" button to work. I'm still struggling with the options on the same page. They still don't show up. Are there really any changes I have to make in the template file to get the options to show up? The options show up in the BackOffice as shown in the screenshot.

    BenderNETs commented 6 years ago

    I got it to work updating the templates. Thanks all...