Display Data 19,000 product import.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Hello

Right I have just inserted 19,000 products into the Nop dbo.Product table (using the new feilds I that was created). I have mapped one of the 19,000 products to newly created category. Its not displaying. In the

CategoryTemplate.ProductsInGridOrLines.cshtml

@*product list*@
    @if (Model.Products.Count > 0)
    {
       @*list mode*@
            <div class="product-list">
             <div class="Product">
              Product List
             </div>
              <br />
            <div class="product-block">
              <table style="width: 100%;"border="solid #ffc600">
                    <tr>
                        <th class="image">
                            &nbsp;
                        </th>
                        <th class="Code">
                           Code
                        </th>
                        <th class="Description">
                           Descricption
                        </th>
                        <th class="Size">
                            Size
                        </th>
                        <th class="PackSize">
                            Pack
                            <br />
                            Size
                        </th>
                        <th class="Price">
                            Price
                        </th>
                        <th class="RRP">
                            RRP
                        </th>
                        <th class="QTY">
                            QTY
                        </th>
                     </tr>
                </table>
            </div>

            @foreach (var product in Model.Products)
            {
                <div class="item-box">
                    @Html.Partial("_ProductBox", product)
                </div>
            }

In _ProductBox


@model Nop.Web.Models.Catalog.ProductModel
<table style="width: 100%;"border="solid">
<tr class="product-item">
        <td class="picture">
            <a href="@Url.RouteUrl("Product", new { productId = Model.Id, SeName = Model.SeName })" title="@Model.DefaultPictureModel.Title">
            <img style="border-width: 0px;" alt="@Model.DefaultPictureModel.AlternateText" src="@Model.DefaultPictureModel.ImageUrl" title="@Model.DefaultPictureModel.Title" />
        </a>
        </td>
        <td class="StockCode">
        @Model.StockCode
        </td>
        <td class="Description">
        @Model.Name
        </td>
        <td class="Size">
        @Model.Size
        </td>
        <td class="PackSize">
        @Model.PackSize
        </td>
        <td class="WholesalePrice">
        @Model.WholesalePrice
        </td>
        <td class="QTYINSTOCK">
        @Model.QTYINSTOCK
        </td>
        <td class="RRP">
        @Model.RRP
        </td>
        <td>
            &nbsp;
        </td>
    </tr>
</table>


The only difference I can see in the Database the products I was playing with before the insert of all are part of the ProductVariant table but this isn't a requirement in our case....

All help highly appreciated.

Richard
12 years ago
How did you do the "insert"?  Did you use the nopC Import or directly using SQL?   Every Product must have at least one ProductVariant.
12 years ago
Directly into the Db as we are connecting our existing db and replicating between the two. The final end game is two write a stored procedure to replicate and update both dbs every 15 minutes....
12 years ago
Every Product must have at least one ProductVariant.


If so where in the code can this be changed as I don't need this table?

Thank you

Richard
12 years ago
I would not recommend changing this in the code.  The system is heavily dependent on Product Variants.  It would be much better for you to modify your SQL insert procedure to create one pv at the same time you create the product.
12 years ago
insert into Nop.dbo.Product(StockCode,Name,PackSize,WholesalePrice,RRP,MRP,QTYINSTOCK,SourceBarcode,Weig,PacksPerLayer,LayersPerPallet,PacksPerPallet)
select [STOCK CODE],DESCRIPTION,PACK,[WHOLESALE PRICE],[RETAIL PRICE],MRP,[QTY IN STOCK],[SOURCE BAR CODE],WEIGHT,[QTY PACKS PER LAYER],[QTY LAYERS PER PALLET],[PACK TOTAL PER PALLET] from cccsql.dbo.stock


This is my insert statement. If you don't mind me asking where do apply the changes to the ProductVariant Table.?

Richard
12 years ago
You need think about a redesign.  Most of the fields (price, qty, etc.) you're pulling from your cccsql.dbo.stock are already  on the ProductVariant table.  If you want to add new custom fields like QTY PER..., they belong there too .  These fields are critical for the Product table.  

      ,[Name]
      ,[ShortDescription]
      ,[FullDescription]
      ,[Published]
      ,[Deleted]
      ,[ProductTemplateId]

Look at sample data - if fields have values (even if 0), rather than NULL, then you should replicate that.

You need a second INSERT statement - i.e. one for each table.  You need to keep in mind, though, that the ProductVariant has a ProductId field that must reference the Product table Id field.  This Product.Id is an IDENTITY column.  You will need to disable it while you do the insert (Google for "SQL Server Disable IDENTITY Column").  Basic steps...

INSERT into product variant table first
disable Product table Identity column
INSERT from the Product Variant table into the Product table
re-enable the Product table Identity column
12 years ago
,[Name]
,[ShortDescription]
,[FullDescription]
,[Published]
,[Deleted]
,[ProductTemplateId]

I altered the functionality of these fields to allow nulls to insert the data. Work appropriately then I inserted the corresponding data - for example in ,[ProductTemplateId] I set it to 2. Then populated the whole the field with a statement. To match the sample data.

With the product_display page the feilds are showing fine.

Its the producttemplategridorlist page that is not displaying.

As in the controller and model for the product display page I added code - I also updated the whole entity from the domain through to the CSS

model.PacksPerLayer = product.PacksPerLayer;

public decimal Packs Per Layer [get; set;}


That show's up fine on the main product display. But I need to a few to show in the category list or grid page. Which is a grid now.
Is it nesercary to update the product variant table?????
Sorry to question it there must be a work around??
12 years ago
Just had a thought go into ProductVariant table Alter names then go through the existing enity update the names etc In all the code then insert from to the other to other. If we can't think of a work around....

THIS STUFF IS GREAT!!!
12 years ago
Sorry I'm hyped up..

If I go with inserting into the productvariant and product table removing then adding back the identifier from what I was reading is easy. How will these then identify one another??? When the data has populated all the feilds???
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.