Guide To Developing Custom Product Variant Attributes?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 năm cách đây
Are Product Variant Attributes integarted in a way, so I can create custom versions like a plugin?

I'd like to have a custom Product Variant Attribute that allows me to attached a custom image as well as adding a price etc...  

Its for clothing or product colour options, so I can actually display a swatch of the colour and the user can click the image and enlarge it?
12 năm cách đây
Guess no one else needs something like this :/
12 năm cách đây
I needed the same thing but I just added a PictureId field to the ProductVariantAttributeValue table and modified the View to show the thumbnails when it was a Radio Button List.

-Add PictureId to Nop.Core.Domain.Catalog.ProductVariantAttributeValue
-Add PictureId to Nop.Admin.Controllers.ProductVariantController's ProductAttributeValueCreatePopup methods
-Add PictureId to Nop.Admin.Models.ProductVariantAttributeValueModel with this tag to get the upload control:
[UIHint("Picture")]

-Add the field to Nop.Admin.Views.ProductVariant._CreateOrUpdateProductAttributeValue.cshtml
</tr>
        <tr>
        <td class="adminTitle">
            @Html.NopLabelFor(model => model.PictureId):
        </td>
        <td class="adminData">
            @Html.EditorFor(model => model.PictureId)
            @Html.ValidationMessageFor(model => model.PictureId)
        </td>
    </tr>

-Add a string for the PictureUrl in Nop.Web.Models.ProductModel.ProductVariantModel.ProductVariantAttributeValueModel
-Modify the model creation in Nop.Web.Controllers.CatalogController to fill the Url from the PVAV's PictureId using the PictureService
-Finally, modify Nop.Web.Views.Catalog._ProductAttributes.cshtml to show the image based on the Url you have in the model.
12 năm cách đây
leen3o wrote:
Guess no one else needs something like this :/


Please vote for it.


Making any Custom Product Variant Attribute Plug-Ins would be a great feature also! The Custom Product Variant Attributes could allow for custom HTML code to be used to render the attribute on the product page.
12 năm cách đây
Thanks I have voted
12 năm cách đây
for things like that i would not do a plugin, since core needs to know product-attributes.....
...on the other side you want to stay out of the nop-core to not bleed too much on updates .... so ...

you could extend the Product by:

1 - Adding a Folder Ext in Nop.Core.Domain.Catalog where all your extensions of core-objects will go.
2. Add a new partial class to extend the Product.. fe. ProductExtensions
3. extend the properties you want
4. dont forget to set the Product-class partial, and use only 1 constructor since it will mess up otherwise ( not the sw but the humans )

here comes sample-code for the Extension class in Ext-Folder:

--->

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace Nop.Core.Domain.Catalog
{
    public partial class Product
    {
         public virtual ICollection<SomeObject> mysomeobjectcollection {get; set; }
         public string PictureURL700xp {get; set; }
         public string PictureURL500px {get; set; }
    }

}


so what do you think ?, i like critics , always getting better ...
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.