Related Tables database - new field

Posted: December 05, 2018 at 2:36 PM Quote #216956
Hello,

I need 2 extra fields in the RelatedProduct table to show on the RelateProduct view in the SimpleProduct box.

I'm getting an error and I don't know enough about what I'm doing to fix the ToString error.  Any help would be greatly, greatly appreciated.



http://www.parts.troyonlinesales.com/codeerror2.png

Here's a couple links to the code.

Thanks,
Dave
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: December 06, 2018 at 12:09 AM Quote #216970
When you look at the database the FigRef field - is it defined as an Integer or String ?
Seems to be a mismatch in the definition
i.e. Website is defined as Int and maybe the Database is a string ?
Or maybe the field in the database is null so it cannot be converted to int - check the value in the field
This post/answer is useful
1
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
www.SelectSystems.com.au
Select Systems is a computer systems technology solution developer and integration service provider.
Posted: December 06, 2018 at 6:03 PM Quote #217005
Hello and thanks for the reply.  I fixed that definition problem and have gotten this far (but have errors when I try to display the FigRef).

Domain Controller RelatedProduct.cs
        /// <DAVE>
        /// Gets or sets the display order
        /// </summary>
        public string FigRef { get; set; }

        /// <DAVE>
        /// Gets or sets the display order
        /// </summary>
        public int Qty { get; set; }


Admin Controller ProductController.ca
            var relatedProducts = _productService.GetRelatedProductsByProductId1(productId, true);
            var relatedProductsModel = relatedProducts
                .Select(x => new ProductModel.RelatedProductModel
                {
                    Id = x.Id,
                    //ProductId1 = x.ProductId1,
                    ProductId2 = x.ProductId2,
                    Product2Name = _productService.GetProductById(x.ProductId2).Name,
                    DisplayOrder = x.DisplayOrder,
                    FigRef = x.FigRef,
                    Qty = x.Qty

                })
                .ToList();


View _SimpleProductBox.cshtml
    <div class="item-details details">
        <h5 class="product-title">
            <a href="   ("Product", new { SeName = Model.SeName })">@Model.Name</a>  
            ********* Show FigRef and Qty here **********

        </h5>
    </div>
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Premium support services
  • Dedicated premium support services provided by core developers are intended for persons who run mission critical websites, work on projects with tight deadlines, or want to get dedicated support.
Professional services
  • Want to open a new store? Want to take your store to the next level? Need a custom extension? We can customize nopCommerce to fit your store perfectly. Request a quote to get started.