This comes in handy when you only want to show stock levels or a message stating “Low Stock” when the stock level for an item falls below a particular level. The standard behavior is to show or hide inventory information, regardless of a particular inventory level.
The code below is for V3.51 and is for standard products. If you wish to achieve the same result for BTO or Apparel products then check the code relating to those as it may be different.
Existing Code in pc/ViewPrdCode.asp:
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' START: Show Units in Stock (if on, show the stock level here) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Public Sub pcs_UnitsStock if scdisplayStock=-1 AND pNoStock=0 then if pstock > 0 then response.write "<div class='pcShowProductStock'>" response.write dictLanguage.Item(Session("language")&"_viewPrd_19") & " " & pStock response.write "</div>" end if end if End Sub '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' END: Show Units in Stock (if on, show the stock level here) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
… would become:
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' START: Show Units in Stock (if on, show the stock level here) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Public Sub pcs_UnitsStock if scdisplayStock=-1 AND pNoStock=0 then ' COMPANY XYZ EDITS - START ' if pstock > 0 then <<<< ORIGINAL-CODE if pstock > 0 AND pstock < 41 then COMPANY XYZ EDITS - END response.write "<div class='pcShowProductStock'>" ' COMPANY XYZ EDITS - START ' response.write dictLanguage.Item(Session("language")&"_viewPrd_19") & " " & pStock <<<< ORIGINAL-CODE response.write dictLanguage.Item(Session("language")&"_viewPrd_19") ' COMPANY XYZ EDITS - END response.write "</div>" end if end if End Sub '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' END: Show Units in Stock (if on, show the stock level here) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note:
Also not the use of the “COMPANY XYZ EDITS ” comments. It is important to always, clearly comment any code edits, as mentioned in our guidelines for editing ProductCart's source code and prepare for future updates.