check filetype on download.tpl + Need Help +

[COLOR=“Black”]Hi, i was trying to make some changes on dowload.tpl with no success.



here is what im trying to do.





Let says i upload 2 type of files on cart products from the Admin backend, one .zip file and one pdf file.



Some products have pdf’s other products have zip files.



I want to know if there a way i can check for filetype extensions on download.tpl.



What i want to do is something like this:



[COLOR=“Red”]{if $file.filename == zip extension}



{$file.filename} show a zip icon



{else}



{$file.filename} show a pdf icon



{/if}[/COLOR]






Thanks in advance.



Jema[/COLOR]

  1. In ‘/include/customer/products.php’



    AFTER



    ```php

    $edp_files[$k][‘size’] = filesize($var_dir[‘downloads’].$_data[‘product_id’].DS.$v);

    ```



    ADD



    ```php

    $edp_files[$k][‘filetype’] = strtolower(substr($var_dir[‘downloads’].$_data[‘product_id’].DS.$v,strlen($var_dir[‘downloads’].$_data[‘product_id’].DS.$v)-3,3));

    ```


  2. In ‘/skins/CLIENT_SKIN/customer/orders_pages/download.tpl’



    WHEREVER YOU WISH TO SHOW THE IMAGE PUT THIS CODE:

    and change the parts in red








3. Put your images in the cs-cart directory image folder as zip.[COLOR=#ff0000]gif [/COLOR]and pdf.[COLOR=#ff0000]gif[/COLOR].

[COLOR=“Black”]Superb mdekok3000 !! :smiley:



Work like a charm.



Many thanks for your time.



Jema[/COLOR]