an ASP.NET Open Source CMS & eCommerce platform
Search:
Last Post 3/9/2010 10:20:39 AM By lukezy. 3 replies.
1/14/2009 2:00:30 PM
Bahram
Posts: 878
Joined: 12/8/2008
Location:Vancouver, BC Canada
In Stock / Out of Stock
- In Stock status never changes, How can we change it automatically based on the quantity,
- It seems when Quantity = 0 then the product does not show up in the Category List.
 
It should shows out of stock when Quantity is less or equal than zero, but let the user order the product, until it tagged as unavailable or discontinued.
 
BAhram
 
1/14/2009 3:00:55 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: In Stock / Out of Stock
There are a couple ways to control show/hide out of stock products.
 
"Site Admin -> Configuration -> Show if out of stock" is the store wide setting and "Site Admin -> Catalog > Products > Edit Product -> Tab: miscellaneour and Show if out of stock" is the product level.
 
To auto flip the product ship estimate to "out of stock" you also have many ways.
1) Change Web\Store\ProductSummary\ShipEstimate.ascx to display "out of stock" when Product.Quantity is 0.
or 
2) Add a database trigger to DSC_Product table when update shipEstimateId column to the right value when column Quantity changes to 0 
DotShoppingCart Staff
3/8/2010 12:24:06 PM
bansal_db
Posts: 181
Joined: 4/13/2009
Re: In Stock / Out of Stock
Luke, i tried this trigger on the Product table but its not working.
 
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
use dotshoppingcart
Go
CREATE TRIGGER dbo.updateStatus
   ON dbo.DSC_Product
   After Update
AS
if Update(quantity)
declare @qty int
select @qty = quantity from updated
BEGIN
    if(@qty = 0)
    begin
    update dotshoppingcart.dbo.DSC_Product set statusId = '100'
    end
    SET NOCOUNT ON;

    -- Insert statements for trigger here

END
GO
 
 
I am getting this error
 
<span>

Invalid object name 'updated'.

</span> Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'updated'.

Source Error:

<table width="100%" bgcolor="#ffffcc"> <tbody> <tr> <td>
Line 852:                descriptorTitleValues, descriptorDescriptionValues, isBulletedListValues, attributeValues, billingCycleId, recurringCount, crossSellProductIds, downloadBinaryIds,
Line 853:                title, keywords, extraHeadData, customFields);
Line 854:            db.ExecuteNonQuery(cmd);
Line 855: } Line 856:
</td> </tr> </tbody> </table>
Source File: C:\DSC\Source\Core\DBO\Product.cs    Line: 854
 
3/9/2010 10:20:39 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: In Stock / Out of Stock
Please take a look at SQL books online for the trigger syntax. I spot the two issues. 1) Use begin/end after the if statement. 2) you want to update the status Id for the current product. You code seems to update all the products.
DotShoppingCart Staff