Custom Product Control

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 лет назад
Hi All

conceptually speaking what would be the best way to go about my task:

i sell linear shower grates and drains, we have a standard range that are easy to sell via the store but we have a requirement to sell custom lengths with other custom attributes.

on only one of my products (the custom typs) i would like there to be 2 text fields one of which that the user is required to fill in.  the required field determines the cost of the item (length) the other field is filled in if required (outlet location).

i have thought about a price per millimeter making the user specify a quantity of millimeters, which works until the user selects their second custom order.  in which case NC adds the new quantity to the existing quantity in the cart.

1) should i create a new control for this product, and if so how would i redirect the product to the new control when clicked.  while still allowing for existing standard products to be processed as normal.

2) should i edit the existing control and if so how will NC know to display the options for the custom grates on only the custom product.

PS i am new to nopcommerce and i will gladly accept any beginner tips you have.

thanks heaps

Quintin
14 лет назад
Just to get the ball rolling.  I'm not sure if this is the best solution or would cause other issues but.... What you could potentially do is just search through the code and find the bit where it checks if an existing item is already in the cart and get  rid of that check. As i say not sure if this is the best solution....
14 лет назад
thanks for the reply.  that definately would be the easiest solution.  i wonder if possible?
14 лет назад
seems to work fine.  Make sure you do some through testing.

\Libraries\Nop.Common\Orders\ShoppingCartManager.cs   update method  

public static List<string> AddToCart(ShoppingCartTypeEnum ShoppingCartType, int ProductVariantID,
            List<int> SelectedAttributeIDs, string TextOption, int Quantity)

on about line 610 make the sure the if statement returns false using something like:

//if (shoppingCartItem != null)
            if(1 == 2)
            {
                int newQuantity = shoppingCartItem.Quantity + Quantity;
                warnings.AddRange(GetShoppingCartItemWarnings(ShoppingCartType, ProductVariantID, SelectedAttributeIDs,
                   TextOption, newQuantity));

                if (warnings.Count == 0)
                {
                    UpdateShoppingCartItem(shoppingCartItem.ShoppingCartItemID, ShoppingCartType, CustomerSessionGUID, ProductVariantID, SelectedAttributeIDs, TextOption, newQuantity, shoppingCartItem.CreatedOn, now);
                }
            }
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.