Hidden products

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 年 前
Hi all!
This is my very first question in this forum.

I'm trying to achieve the following:
Having a product that is hidden in the shop (not in any category and doesn't show up in the search-results) but can be accessed / added to the cart by a non-public path.

The problem:
I've built a parallel system (integrated as a plugin) that allows the customer to search in a manufacturer-repository. The manufacturer has about 20.000 products in their catalogue. Obviously my client doesn't want to create a product in their store for every possible item that the customer might (or never) buy.

Solution proposal alt. 1:
Create a hidden product that can be added to the cart from the other system (price will be taken from the other system). This requires nopCommerce to be able to add a comment of some sort to the order (preferably to the specific order row) so that the admin can take action when the order comes in (add that specific product to the local catalogue or whatever).
The name / product nr. (and the price) comes from the other system and probably needs to be added in the cart and propagated to the order row when needed.

Solution proposal alt. 2:
Dynamically create the product when the customer presses buy in the other system. And then add that product into the cart.

Solution proposal alt. 3:
After looking around in the forum I took a look at the "Build your own computer" and the use of product variant attributes. Maybe it would be easier to add a variant attribute dynamically rather than creating a whole product.
So, in the cart it would show up as:
Manufacturer part:
Some manufacturer part name (prod.nr.): [+1299 kr]

Solution proposal alt. 4:
Create a product like alt. 3 and import all manufacturer-products as variant attribute alternatives into the local store. Would this pose a performance problem if say 20.000 alternatives were added!?

I would of course prefer if this could be done somehow straight out of the box, but if needed I will change the source to make it work.

So, do you guys have any other ideas or any input about which way I should go on this one!?

Kind regards,
Richard
12 年 前
While not exactly, the problem sounds somewhat similar to what this is trying to accomplish.
12 年 前
I would think you're option 1 is best.  You can create one or more Product Attributes - e.g. Product Number, Product Description.  Then create one not Published product / single product variant. On that variant, create the product variant attributes (tab) as Control type Textbox.

see  http://admin-demo.nopcommerce.com/Admin/ProductVariant/Edit/96

You will still need custom coding to create the shopping cart item with that product variant, and set the Price, and the attributes.
12 年 前
Aha, that sounds really interesting. I didn't know that customers could specify attributes directly in the shop.
I guess a good example would be a "design the text on your t-shirt" scenario like the one you've described.

That takes care of the problem with having dynamic input but the problem with hiding a product is yet to be solved!
Or is it possible to add a hidden / unpublished product to the cart from custom code?

Any input on that?

Thanks!
/ Richard
12 年 前
richard_bladh wrote:
... but the problem with hiding a product is yet to be solved!
Or is it possible to add a hidden / unpublished product to the cart from custom code?

I did a quick test as follows.

- In browser, saved the complete web page html for a published (unhidden) product to the desktop.
- On the test site, unpublished the product.
- Opened the saved page in the browser.
- Clicked the Add to Cart button.  The product did not get added to the cart. (It does, from the saved page, if the product is published.)

This was to test using the form's "post" method of the webform.  This has worked in another cart I've used, but it appears it will not in nopCommerce.  

Theoretically, at least, in your code, you could momentarily publish the product, add it to the cart, then unpublish it, but I am not sure if a further step in the checkout process would remove it from the cart before checkout were completed.
12 年 前
Thank you for taking your time to test this!
I would expect that behavior in a well designed / implemented shop like nopCommerce =O)

In ShoppingCartService.cs in GetShoppingCartItemWarnings:

if (!product.Published || !productVariant.Published)
{
warnings.Add(_localizationService.GetResource("ShoppingCart.ProductUnpublished"));
}


So, it seems you cannot add unpublished products to the cart. Bummer!


But I assume you can add an uncategorized product (can't find any references to categories in the source) since you are able to find those products using the search-system anyway.


Hmmm, the closest I can get is to create a general manufacturer-product (with a strange name so that it won't show up in the search-system - probably need to rule that out ;-). Add some variant attributes and specify that the customer specifies the price (goulp - bad!) and dynamically add values (i.e. product nr. / name / price) to the attributes when the user clicks buy.

But if I do that, I've already begun to create and fix problems that comes from doing things the wrong way. I probably need to dynamically create the product / product variant in the local store when needed, which was the solution I wanted to avoid in the first place...

Would be really good if this would work right out of the box.

/ Richard
12 年 前
Two thoughts.

1. If that is the only check in the code, override it based on some attribute unique to the products you want to add to the cart.

2. Check with the developer of the plugin linked to in my previous post above to see if he is creating products on the fly for his application.  He may have already figured it out...
12 年 前
Yepp, that would be one way to go.
I would suspect that there is another check in the checkout-code aswell.
It feels like the "create a product on the fly"-approach is less intrusive though. The only downside to that solution is that the system might be cluttered with products rarely bought. But on the other hand - adding the product to the system is what the admin would have to do manually anyway (after a purchase).

I will try the "on the fly" implementation first and if that fails or requires to much work, I will try the other solution.

Thanks for the tips!

/ Richard
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.