Assign specific product(s) to one specific customer

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

Is it possible to make a product assigned to a specific customer, so it´s only the specific customer who can view and buy the product?

I think of a photographer who takes pictures of a lot of people and then send a login/password to the customer and then the customer can view and buy the photos without other people can view and buy the photos.

Anyone who have the solution then I could be interested in buying(send PM).
12 years ago
Not out of the box. It requires some customization (mapping table between customers and products)
12 years ago
Hi,

I'm looking for the exact same thing (for a photography gallery shop).

Are there any tutorials for mapping customers to categories or products?

Thanks,
12 years ago
nmt88 wrote:
Hi,

I'm looking for the exact same thing (for a photography gallery shop).

Are there any tutorials for mapping customers to categories or products?

Thanks,


Hi

I made a small change to the code.

CustomerID must be written in Admin Comments Textfield under the product.
If customer with correct ID is logged in the image will display otherwise the image is not shown.
If Admin Comments is blank the product will show for everyone.


Simple change that works for me but it can be improved if needed.

The code is located at presentation\Nop.Web\Controllers\CatalogController.cs (Line 304)

private ProductModel PrepareProductOverviewModel(Product product, bool preparePriceModel = true, bool preparePictureModel = true)
        {
            if (product == null)
                throw new ArgumentNullException("product");

            var model = product.ToModel();

          
            //price
            if (preparePriceModel)
            {
                model.ProductPrice = PrepareProductPriceModel(product);
            }
            //picture
            if (preparePictureModel)
            {
                var picture = product.GetDefaultProductPicture(_pictureService);
                // Added By Tommy Christensen 16-11-2011  
                Int32 findID = Convert.ToInt32(product.AdminComment);
                  if (findID < 1)
                      findID = 0;
                // Add end

                 // if (picture != null) Removed by Tommy Christensen

                if (picture != null && _workContext.CurrentCustomer.Id == findID || picture != null && findID==0)// Added by Tommy Christensen

                    model.DefaultPictureModel.ImageUrl = _pictureService.GetPictureUrl(picture, _mediaSetting.ProductThumbPictureSize, true);
                else
                    model.DefaultPictureModel.ImageUrl = _pictureService.GetDefaultPictureUrl(_mediaSetting.ProductThumbPictureSize);
                model.DefaultPictureModel.Title = string.Format(_localizationService.GetResource("Media.Product.ImageLinkTitleFormat"), model.Name);
                model.DefaultPictureModel.AlternateText = string.Format(_localizationService.GetResource("Media.Product.ImageAlternateTextFormat"), model.Name);
            }
            return model;
        }
12 years ago
I have now made a complete solution, still I will not change the DB so I use the existing admin comment field for the product to key in the customerID.

Empty Admin Comment field or Text will display the product for everyone.
CustomerID in Admin Commen field will hide the pictures and Add to Cart button for all except the specific customer.

The solution only requires minor changes in the CatalogController.cs
12 years ago
Being able to apply ACLs to products and categories is an essential requirement of ours, indeed applying ACLs to any entity is desirable.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.