X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   In Stock/Out of Stock/Lead Time (https://forum.x-cart.com/showthread.php?t=58940)

welly 04-17-2011 08:18 AM

In Stock/Out of Stock/Lead Time
 
Hi,

Rather than showing stock levels on our product pages, I want to show whether a product is in stock, out of stock, or in some cases, what the expected dispatch time will be. Most of our products are 'standard, and we only want people to be able to order them if they are available. Some others we would like to be available to order all the time, even if we don't have them physically available at the time of the order.

I have added an extra product field, 'Leadtime', which for certain products will contain something like 'Usually dispatched within 21 days'. For those products, I have set the stock level to 100000 or similar.

In /common_files/customer/main/product_details.tpl I have added the following code just below where the stock levels would be shown:

<tr>
<td class="property-name">Availability</td>
<td class="property-value" colspan="2">
{if $product.avail gt 50000}
{foreach from=$extra_fields item=v}
{if $v.field eq "Leadtime"}
{$v.field_value}
{/if}
{/foreach}
{elseif $product.avail gt 0}
In Stock
{else}
Out of Stock
{/if}
</td>
</tr>

It probably isn't the neatest way to do it, but it does seem to do the trick for our standard products. If availability is > 50000 (special product) then show the leadtime, otherwise if it's >0 it's 'In Stock', if not it's 'Out of Stock'.

Unfortunately it doesn't work for products with variants. I have a product with 3 sizes and 2 colours (6 choices in all), and if I switch on the stock level setting, I can see that when I select between the various options, the stock levels and prices alter as they should, but my 'Availability' code doesn't update.

It does show 'In Stock' if any one of the variants is in stock, and 'Out of Stock' if none of them are, but that's about it.

Can anyone point me to the bit of code I need to be looking at, and give me a clue or two as to the changes I need to make? I'm looking at some of the Product_Options templates, and I'm not sure I want to be fiddling with them without a little direction.

Many thanks

Welly

qualiteam 04-27-2011 05:43 AM

Re: In Stock/Out of Stock/Lead Time
 
In case of variants there is a special JS code that updates HTML on page as soon as the page is loaded.

Thus you should also make the necessary changes to the "skin/common_files/modules/Product_Options/func.js" script.


All times are GMT -8. The time now is 11:03 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.