Using "wildcards"

I’m working on a way to have more status options for products other than In Stock and Out of Stock. Basically I have some products that will ship within a week if they’re out of stock and others that will ship within a month.

I have found a way to do this but need a little help. In the file /skins/basic/customer/common_templates/product_data.tpl I added a piece of code which looks like this:

<br />
        {if $settings.General.allow_negative_amount == "Y" && $product.amount == 0 && $product.product_code == "7185132CJI"} <br />
            <p class="strong text_out_of_stock_2" id="in_stock_info_{$obj_id}">{$lang.text_out_of_stock_2}</p><br />
        {/if}<br />

```<br />
<br />
The one problem I have is with "7185132CJI". That is one of my product codes but I'd like it to apply to all products that start with 7185. I tried things like : "7185*" or "7185%" but neither one works. <br />
<br />
Any suggestions?

You could probably do something like:

&& "7185 == $product.product_code|substr:0:3}

This says “execute this php function substr($product.product_code, 0, 3)” which in turn says return th 1st 4 characters of $product.product_code.

Changed it slightly to

&& “7185” == $product.product_code|substr:0:4 and works like a charm

Thank you SO much, you have made my life much simpler.

Yeah, the last parameter is a length, not a position…