HELP! if anyone out there can review this code and tell me what is missing/why not working, desperately needed and greatly appreciated.
Following help shared here, we set our products to display per the settings at back office for inventory and Quantity on hand.
So, if the quantity on hand is set to "0" for a product, the product info displays but a dimmed image shows up (and will not put product in cart), and text displays saying product is out of stock. This works GREAT at SKU level, and displays correctly at Product/More Info pages.
When we tried to have similar results at the Search Products display page= it is only half working.
So, all code displays correctly, and works for QOH "0" settings. But when a product is in inventory, the Add to Cart button is non functioning.
See at www.vdcusa.com and type Peenuts in Site Search box.
----
Here is the code- maybe I am missing something very obvious here- I can't see it. Stuck in rock and hard place here= happy with inventory status at product pages, but have had customers call complaining about the add to cart button at search results not allowing them to add the product to cart (because, it is broken live and won't)
ANY Help SO appreciated! THANKS!
-------
[-- DEFINE PRODUCT --]
[-- IF PRODUCT.DisplayMoreInformationPage --]
<script type="text/javascript">
function YouSave(){
var MSRP = "[-- PRODUCT.Price --]".substr(1);
var OurPrice = "[-- PRODUCT.SaleAmount --]".substr(1);
Savings = Math.round((MSRP - OurPrice) / MSRP * 100)
document.write("<p style='color:#003978; font-weight:bold;'>Save: " + Savings + "%" + "</p>")
}
</script>
<tr>
[-- IF PRODUCT.DisplayGraphic "checked" --]
[-- IF PRODUCT.Graphic --]
[-- IF PRODUCT.DisplayMoreInfoPage --]
<td class="product_img" align="center" valign="top"><a href="[-- PRODUCT.MoreInfoURL --]"><img "[-- IF PRODUCT.Graphic --][-- PRODUCT.Graphic Remove_HTML --][-- ELSE --]src="media/NeedProductImage.jpg"[-- END_IF --]"> </a></td>
[-- ELSE --]
<td class="product_img" align="center" valign="top"><a href="[-- PRODUCT.MoreInfoURL --]"><img "[-- IF PRODUCT.Graphic --][-- PRODUCT.Graphic Remove_HTML --][-- ELSE --]src="media/NeedProductImage.jpg"[-- END_IF --]"> </a></td>
[-- END_IF --]
[-- END_IF --]
[-- END_IF --]
<td align="left" valign="top" width="191px">
[-- IF PRODUCT.DisplayName --]
<p style="color:#000;">SKU:[-- PRODUCT.SKU --]</p>
[-- IF PRODUCT.DisplayMoreInfoPage --]
<a href="[-- PRODUCT.MoreInfoURL --]">
<p style="color:#003978;">[-- PRODUCT.Name --]</p>
</a>
[-- ELSE --]
<p style="color:#003978;">[-- PRODUCT.Name --]</p>
[-- END_IF --]
[-- END_IF --]
</td>
<td style="width:138px" >
[-- IF PRODUCT.QuantityOnHand 0 --]
###### out of stock#######
<p style="color:#676767;">Anticipated availability:<br />[-- PRODUCT.Field2 --]</p>
<p style="color:#E3372E; font-weight:bold;">Out of Stock</p>
[-- IF PRODUCT.DisplayOrderQuantity checked --]
[-- IF PRODUCT.DisplayOrderingOptions --]
#do nothing
[-- ELSE --]
[-- IF VAR.MoreInfoPage "yes" --]
<br>
[-- END_IF --]
[-- END_IF --]
[-- STORE.Qty --] <input type=text size=2 name="[-- PRODUCT.RecordNumber --]:qnty" value="0" >
[-- END_IF --]
[-- IF VAR.AddButtonGraphic --]
<img style="opacity: .25;" src="http://www.vdcusa.com/shopsite_sc/images/btn_addtocart_Dim.jpg" />
[-- ELSE_IF ADDIMAGE? --]
<img style="opacity: .25;" src="http://www.vdcusa.com/shopsite_sc/images/btn_addtocart_Dim.jpg" />
[-- ELSE --]
<img style="opacity: .25;" src="http://www.vdcusa.com/shopsite_sc/images/btn_addtocart_Dim.jpg" />
[-- END_IF --]
######
[-- ELSE --]
###### in stock#######
<p style="color:#676767;">Price:[-- PRODUCT.Price --]</p>
<p style="color:#E3372E; font-weight:bold;">Our Price: [-- PRODUCT.SaleAmount --]</p>
<script type="text/javascript">
YouSave();
</script>
#######
[-- END_IF --]
</td>
<td align="center" style="white-space: nowrap; width:133px">
[-- IF PRODUCT.QuantityOnHand 0 --]
######out of stock#######
[-- IF VAR.AddButtonGraphic --]
<img src="/btn_addtocart_Dim.jpg" />
[-- ELSE_IF ADDIMAGE? --]
<img style="opacity: .25;" src="http://vdcusa.com/shopsite_sc/images/btn_addtocart_Dim.jpg" />
[-- ELSE --]
<img style="opacity: .25;" src="http://vdcusa.com/shopsite_sc/images/btn_addtocart_Dim.jpg" />
[-- END_IF --]
######
[-- ELSE --]
###### in stock#######
<form name="form_one" action="[-- SHOPPING_CART_URL Base --]/order.cgi" method="post">
<input type="hidden" name="storeid" value="[-- STORE.ID --]">
<input type="hidden" name="dbname" value="products">
<input type="hidden" name="function" value="add">
<input type="hidden" name="itemnum" value="[-- PRODUCT.RecordNumber --]">
[-- IF PRODUCT.DisplayOrderQuantity checked --]
[-- IF PRODUCT.DisplayOrderingOptions --]
#do nothing
[-- ELSE --]
[-- IF VAR.MoreInfoPage "yes" --]
<br>
[-- END_IF --]
[-- END_IF --]
[-- STORE.Qty --] <input type=text size=2 name="[-- PRODUCT.RecordNumber --]:qnty" value="1" >
[-- END_IF --]
[-- IF VAR.AddButtonGraphic --]
<input type=image class="add" src="[-- OUTPUT_DIRECTORY_URL --]/[-- VAR.Media --]/[-- VAR.AddButtonGraphic --]" name="Add to Cart" alt="Add to Cart">
[-- ELSE_IF ADDIMAGE? --]
<input type=image class="add-img" [--addimage--]>
[-- ELSE --]
<input class="add" type=submit value="[-- ADDTEXT --]">
[-- END_IF --]
</form>
#######
[-- END_IF --]
[-- ELSE --]
<p style="padding-top:10px">[-- PRODUCT.ProductDescription --]</p>
[-- END_IF --]
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr></tr>
[-- END_DEFINE PRODUCT --]