Print Page | Close Window

Adding Stock to Product List View

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Customizing ProductCart
Forum Description: Exchange messages with other users that are customizing ProductCart.
URL: https://forum.productcart.com/forum_posts.asp?TID=3842
Printed Date: 14-July-2025 at 5:33pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Adding Stock to Product List View
Posted By: knifepro
Subject: Adding Stock to Product List View
Date Posted: 11-July-2010 at 5:34pm

Is it possible to add the number of units in stock to the product list view. The items are listed in the AJAX view. Would like to add them to the regular view.

Can someone tell me what code I need to add

Okay I figured this one out. I used the following code to show stock on the list page:

      <% if (scdisplayStock=-1) and (pNoStock=0) then %>
        <% if (pstock>0) then %>
            <p class="pcShowProductStock">
            <%response.write dictLanguage.Item(Session("language")&"_viewPrd_19") & " " & pStock %>
            </p>
        <% end if
    end if %>

Now I am trying to get the backorder message to display on products that are out of stock and allow backordering. Here is what I have but I can't get it to work. Any ideas?

        <% If (scOutofStockPurchase=-1 AND CLng(pStock)<1 AND pserviceSpec=0 AND pNoStock=0 AND pcv_intBackOrder=1) OR (pserviceSpec<>0 AND scOutofStockPurchase=-1 AND iBTOOutofstockpurchase=-1 AND CLng(pStock)<1 AND pNoStock=0 AND pcv_intBackOrder=1) Then %>
        <%If clng(pcv_intShipNDays)>0 then%>
            <%response.write "<div>"&dictLanguage.Item(Session("language")&"_viewPrd_60")&dictLanguage.Item(Session("language")&"_sds_viewprd_1") & pcv_intShipNDays & dictLanguage.Item(Session("language")&"_sds_viewprd_1b") & "</div>"%>
            <% end if
    end if %>


-------------
Brian

brian@theknifeprofessional.com
brian@heartlandbraidedrugs.com
www.theknifeprofessional.com
www.heartlandbraidedrugs.com
ProductCart v4.7
QuickBooks Sync
Mobile



Replies:
Posted By: knifepro
Date Posted: 14-July-2010 at 9:37pm
Can anyone give me any ideas?

-------------
Brian

brian@theknifeprofessional.com
brian@heartlandbraidedrugs.com
www.theknifeprofessional.com
www.heartlandbraidedrugs.com
ProductCart v4.7
QuickBooks Sync
Mobile


Posted By: knifepro
Date Posted: 24-October-2010 at 4:35pm
I was successful in adding stock to my list view and I am still trying to add the "Ships with N Days" message to the items I allowed to be back ordered. I get the message to show but I can not get the value entered into the N Days to show. I would appreciate any help.

       <% if (scdisplayStock=-1) and (pNoStock=0) then %>
        <% if (pstock>0) then %>
            <p class="pcShowProductStock">
            <%response.write dictLanguage.Item(Session("language")&"_viewPrd_19") & " " & pStock %>
            </p>
        <% else %>
        <p class="pcShowProductStock">
        <% response.write dictLanguage.Item(Session("language")&"_sds_viewprd_1") & " " & pcv_intShipNDays %>
        </p>
        <% end if
    end if %>


-------------
Brian

brian@theknifeprofessional.com
brian@heartlandbraidedrugs.com
www.theknifeprofessional.com
www.heartlandbraidedrugs.com
ProductCart v4.7
QuickBooks Sync
Mobile


Posted By: Greg Dinger
Date Posted: 24-October-2010 at 4:41pm
Brian - pStock and pcv_intShipNDays represent values that were retrieved from the product table.  If you are not getting those values to display, you need to make certain that you have listed the appropriate fields in your query, then populated the page-level variables to display them as presented above. make sense?

-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: knifepro
Date Posted: 24-October-2010 at 8:26pm
Greg,

It makes sense. Can you advise the file that links up to pcShowProductH.asp. pStock works and shows the number so it must be defined in a query. But I can fine no query in pcShowProduct.asp.


-------------
Brian

brian@theknifeprofessional.com
brian@heartlandbraidedrugs.com
www.theknifeprofessional.com
www.heartlandbraidedrugs.com
ProductCart v4.7
QuickBooks Sync
Mobile


Posted By: Greg Dinger
Date Posted: 24-October-2010 at 8:38pm

What page are you working on?  ViewCategories.asp?  Another page?  Tthere are several that use pcShowProductH.asp for product summary formatting.



-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: knifepro
Date Posted: 26-October-2010 at 6:21pm
It is the viewcategories.asp. I see where the stock is query:

'// Query Products of current category
    query="SELECT products.idProduct, products.sku, products.description, products.price, products.listhidden, products.listprice, products.serviceSpec, products.bToBPrice, products.smallImageUrl,products.noprices,products.stock, products.noStock,products.pcprod_HideBTOPrice, POrder,products.FormQuantity,products.pcProd_BackOrder FROM products, categories_products WHERE products.idProduct=categories_products.idProduct AND categories_products.idCategory="& mIdCategory&" AND active=-1 AND configOnly=0 and removed=0 " & pcv_strCSFilters & query1
    set rs=Server.CreateObject("ADODB.Recordset")  
    rs.CacheSize=iPageSize
    rs.PageSize=iPageSize
    pcv_strPageSize=iPageSize

So I would add products.pcProd_ShipNDays.


-------------
Brian

brian@theknifeprofessional.com
brian@heartlandbraidedrugs.com
www.theknifeprofessional.com
www.heartlandbraidedrugs.com
ProductCart v4.7
QuickBooks Sync
Mobile


Posted By: Greg Dinger
Date Posted: 26-October-2010 at 7:42pm
yes, add that field so that in the middle of the query you have this:

,products.pcProd_BackOrder,products.pcProd_ShipNDays
 
That gets the data pulled out, then you have to grab it for use on the page. Find the following statement, and add the next one below it.
 
pcv_intBackOrder=pcArray_Products(15,pCnt)
pcv_intShipNDays=pcArray_Products(16,pCnt)


-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: knifepro
Date Posted: 27-October-2010 at 6:26pm
Okay here is what I have in the query on viewcategories.asp:

query="SELECT products.idProduct, products.sku, products.description, products.price, products.listhidden, products.listprice, products.serviceSpec, products.bToBPrice, products.smallImageUrl,products.noprices,products.stock, products.noStock,products.pcprod_HideBTOPrice, POrder,products.FormQuantity,products.pcProd_BackOrder,products.pcProd_ShipNDays FROM products, categories_products WHERE products.idProduct=categories_products.idProduct AND categories_products.idCategory="& mIdCategory&" AND active=-1 AND configOnly=0 and removed=0 " & pcv_strCSFilters & query1

I also added pcv_intShipNDays=pcArray_Products(16,pCnt).

In the ShowProductH.asp I have the following:

   <% if (scdisplayStock=-1) and (pNoStock=0) then %>
        <% if (pstock>0) then %>
            <p class="pcShowProductStock">
            <%response.write dictLanguage.Item(Session("language")&"_viewPrd_19") & " " & pStock %>
            </p>
        <% else %>
        <p class="pcShowProductStock">
        <% response.write dictLanguage.Item(Session("language")&"_sds_viewprd_1") & pcProd_ShipNDays & dictLanguage.Item(Session("language")&"_sds_viewprd_1b") %>
        </p>
        <% end if
    end if %>
I am getting the text from the language.asp but not the value for N days. I have tried both pcProd_ShipNDays and pcv_intShipNDays in the above statement. Do I need to include the following in the in one of the files. If so where at:

pcv_intShipNDays = rs("pcProd_ShipNDays")





-------------
Brian

brian@theknifeprofessional.com
brian@heartlandbraidedrugs.com
www.theknifeprofessional.com
www.heartlandbraidedrugs.com
ProductCart v4.7
QuickBooks Sync
Mobile


Posted By: Greg Dinger
Date Posted: 27-October-2010 at 7:33pm

I guided you as to what I believed was the correct code, based on looking at a page in another site.  If you are unable to tackle this it might be best to hire a developer.  Sorry, busy day.



-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: Greg Dinger
Date Posted: 27-October-2010 at 8:38pm
I just spotted your problem Brian. 
 
You set this variable: pcv_intShipNDays
You are printing this one: pcProd_ShipNDays
 
The spelling has to be precise or it won't work.
 


-------------
GreyBeard Design Group

Certified ProductCart Developer

Web Design/Development/Hosting

http://tinyurl.com/5c8t4t" rel="nofollow - Add-Ons & Custom Code |


Posted By: avalight
Date Posted: 29-October-2010 at 3:52pm
Brian
Did you ever get this to work?  Are you also showing the stock level on the product detail page in the apparel add-on?.  You must be using standard version?


-------------
Curt



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net