Adding a date picker field

I’m running a flower shop and want to know how I can add a date picker field. I saw a MOD for v1, but the instructions don’t carry over the same to v2.

You can use the mod at [URL]http://forum.cs-cart.com/showthread.php?p=84301#post84301[/URL]



For 2.0x option_type.tpl is at yourskin\admin\views\product_options\components



Use something like below:

{if !$app_types || ($app_types && $app_types|strpos:“D” !== false)}

Date
{/if}

For 2.0x product_options.tpl is at yourskin\customer\views\products\components

Use something like below:
{elseif $po.option_type == "D"} {*Date*}
{include file="scripts/date.tpl"}



You can place the date.tpl file anywhere you want. Just make sure you update the line {include file="scripts/date.tpl"} in product_options.tpl

I haven't tested it, but this should be close. Someone with more time can post any corrections.

I added those two lines, but when I go to add a new global option, I don’t see the date option.



If I put the date.tpl file in the same directory as the product_options.tpl, should my path just be:



{include file="date.tpl"}

Clear your cache. It will show up.



&cc

I’ve done something wrong. It still doesn’t show up.

Worked for me

Is my path to the date.tpl file correct? I have it in the same directory as the product_options.tpl file

Here’s what I have on lines 38-41 of option_types.tpl (/skins/basic/admin/views/product_options/components/option_types.tpl)


```php

{if !$app_types || ($app_types && $app_types|strpos:“T” !== false)}

{$lang.textarea}
Date
{/if}
```


Then in product_options.tpl (/skins/computer_shop/customer/views/products/components/product_options.tpl), I have this code in lines 43-51 (code I copied and pasted is between the blank lines):

```php
{$po.value|default:$po.inner_hint}

{elseif $po.option_type == "D"} {*Date*}
{include file="templates/`$product.product_code`.tpl"}
{include file="date.tpl"}


{if $NEWpoOptionRequired == "R"}* required field
{/if}

{elseif $po.option_type == "F"} {*File*}

```

You need to close the if and open another if



{if !$app_types || ($app_types && $app_types|strpos:“D” !== false)}

Date
{/if}
{if !$app_types || ($app_types && $app_types|strpos:"T" !== false)}
{$lang.textarea}
{/if}



This worked for me in product_options.tpl

```php

{elseif $po.option_type == "I"} {*Input*}



{elseif $po.option_type == "D"} {*Date*}
{include file="date.tpl"}




{elseif $po.option_type == "T"} {*Textarea*}

```

Placed date.tpl in yourskin\customer directory

I’m sorry, I added the code as you sent moved my date.tpl file and still nada.

I just want to be sure that I’m editing the correct files.



My option_types.tpl is in my “basic” skin, correct? (Since that’s what I’m using for the admin)



And my product_options.tpl is in my “computer_shop” skin since that’s my front end template.

[quote name=‘fuelishways’]I just want to be sure that I’m editing the correct files.



My option_types.tpl is in my “basic” skin, correct? (Since that’s what I’m using for the admin)



And my product_options.tpl is in my “computer_shop” skin since that’s my front end template.[/QUOTE]


  1. You only have 1 admin skin, “basic”, therefore, drop and replace will work.


  2. As for the product_option.tpl, you need to compare the file located in:

    skins/YOURSKIN/customer/views/products/components/


  3. In product_option.tpl, edit the path where to locate the “date” file as follow:

    ```php {include file=“common_templates/date.tpl”} ```


  4. Drop the file, date.tpl to skins/YOURSKIN/customer/views/products/components/common_templates/