PDA

View Full Version : stock level indication


johnshackleton
19-Aug-2003, 09:12 AM
We are using the javascript laid out in the "Advance User Guide" to include stock levels within the site.

For items that are in stock it displays the message "Delivery 1-3 days"

For other non-stocked items it displays "Usually despatched in 5-7 days." This is fine as the majority of these items are delivered next day by our suppliers, so we will beat this estimate.

However, there are a few non-stocked lines that take a lot longer and 5-7 days is a bit misleading.

Is there a way of separating these non-stocked items within the javascript even though they both share the same value of zero? Ideally it would be best to have a third message "Usually despatched within 10-14 days".

Many thanks in advance.

John


<!--
{
var strIDs = 'Stock Message: '
{
if (pItem >= 1)
{
strIDs = 'Delivery 1-3 days'
}
else
{
strIDs = 'Usually despatched within 5-7 days'
}
}
return strIDs
}
//-->

NormanRouxel
19-Aug-2003, 09:54 AM
You could use NETQUOTEVAR:PRODUCTREFERENCE (assuming this code is in a Product Template) and have some part of the product reference that indicates the delivery period.

e.g. If our product reference contains "-xd" then it's a slow one.


var thisprod = "NETQUOTEVAR:PRODUCTREFERENCE";
if ( thisprod.indexOf("-xd") != -1 )
{
strIDs = "Usually despatched within 10-14 days";
}



Alternatively you could define a CUSTOMVAR containing the slow delivery prompt and use it instead of the standard one:-


var thismesg = "CUSTOMVAR:SLOWDELIVERY";
if ( thismesg )
{
strIDs = thismesg;
}


or as a one-liner
if ("CUSTOMVAR:SLOWDELIVERY") strIDs = "CUSTOMVAR:SLOWDELIVERY";


This method lets you tailor the message to each product.

Norman

johnshackleton
28-Aug-2003, 09:27 AM
Hi Norman,

I've been away and just got back to your reply.

I think your 2nd or 3rd suggestion would be more appropriate but I'm not sure how to incorporate

if ("CUSTOMVAR:SLOWDELIVERY") strIDs = "CUSTOMVAR:SLOWDELIVERY";

into the original javascript.

I seem to get every product displaying 10-14 days or every product displaying 5-7 days.

Thanks

John