recently viewed items

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

I am trying to clear the database of some examples that I have published.
I am unable to clear the recently viewed items.
I have used the admin section to change the defaults to not list recenlty viewed items.
(Also mssql studio manager).
This didnt work.
Any solutions.

Thanks
15 years ago
It's a bug. Open ProductManager.GetRecentlyViewedProducts() method and replace

foreach (int productID in productIDs)
            {
                Product product = GetByProductID(productID);
                if (product != null)
                    products.Add(product);
            }


with
 foreach (int productID in productIDs)
            {
                Product product = GetByProductID(productID);
                if (product != null && product.Published && !product.Deleted)
                    products.Add(product);
            }
15 years ago
I have just implemented this fix but noticed something else.

When a product has been unpublished, if the user has a direct link to a product (often the case through search engines etc.) that user will still be taken to that product.

It is my thought that my unpublishing the product, this in turn should cascade to all product variants. However, because it doesn't the product variants still appear as published and allow people to click the Add to Cart button.

Although when clicking Add to Cart button it does not actually add the item (they just get a message saying "Your shopping cart is empty"), this is not very informative.

You can prevent the Add to Cart button from appearing on an unpublished product by unpublishing the product variant. However, currently you can still browse to the product page (even if you can't buy it). Really what we need is to create a "Product Not Available" page which shows related items. So if a visitor has a direct link to an item that is not currently available ("Unpublished") they get a message saying "This item is not currently available. However you may be interested in one of these items....."

Tests to reproduce.

1. On site go view the Apple 32gb Ipod touch product (http://yourshop/Products/35-apple-ipod-touch-32gb-mp3mp4-player.aspx)
2. Copy the link from the address bar
3. Go into administration and unpublish the main product
4. Paste the copied link into browser - notice it takes you to page and Add to Cart is available
5. Go into administration and unpublish the product variant
6. Paste the link again and notice that you are still taken to the page but you can no longer purchase the product variant.

One other thing I noticed is that if you set the following in a product variant:

Stock quantity: 0    
Minimum Stock quantity: 10    
Low stock activity:   Disable Buy Button

The Add to Cart button is still available and allows people to buy the product. Was their anything else I needed to set to enable this feature?

Thanks,
Ben
15 years ago
Hello Ben,

what we could do is add a bool Site Setting (Maybe: DisplayOutOfStockProducts ) and check it on the product display page. if the product is unpublished or isOutOfStock we redirect to a SorryProductNotFound page or even display the product with an OutOfStock Label and set the buy button to invisible.

the only issue i might see with this is that the product collections are usually in cache and i am not sure if the available quantity is getting updated . if not, we should.


what do you think
15 years ago
This should be the default behaviour. Choosing a Low Stock Activity of "Disable Buy Button" should disable the buy button when productVariant.StockQuantity < productVariant.MinStockQuantity.

The thing is I can't see that this check is made anywhere.

In this case I would normally add a property e.g. InStock to the underlying class and return its value as

bool Instock = (productVariant.StockQuantity < productVariant.MinStockQuantity)

Then on your product variant templates in code behind change line 127 to:

if ((!productVariant.DisableBuyButton) & (productVariant.InStock))


You can test easily without the property just by changing to:

if ((!productVariant.DisableBuyButton) & (productVariant.StockQuantity > productVariant.MinStockQuantity))


This will then disable the buy button if not in stock.

As you say, you may wish to change the behaviour so that it displays a useful message like "This item is not currently in stock" or redirects to a related products page.
12 years ago
Hi Team,

Now recently viewed products are stored in cookies but I want to persist these products when user come back after an hour or when customer logs from different machine.

I want to know is there a way that i can config this in DB & pull



Regards,
Prakash
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.