User Tip - "Embed Saleable Files"
Design and Skin Customization
The current default for the File Module creates "dead links" and no buy button when a file that is for sale is embedded. Personally, I think that is a bad user experience and not useful at all.
So I have made my saleable files embed with the Buy button, and instead of "dead links", the file title and image link back to the file's detail page. So a saleable file then embeds like any other product for sale.
Jamroom isn't planning on changing the default by giving this to everyone as an update, so here is how it's done for those who are interested.
In your Admin Panel go to Profiles and then Files. Then in the templates folder modify item_embed.tpl to the code below
{jrCore_module_url module="jrFile" assign="murl"}
{if empty($item.file_file_item_price) && empty($item.file_file_item_bundle)}
<div>
<table class="item" style="width:80%;margin-left:0">
<tr>
<td rowspan="2" style="width:5%;padding-right:12px">
<a href="{$jamroom_url}/{$item.profile_url}/{$murl}/{$item._item_id}/{$item.file_title_url}">{jrCore_image module="jrFile" image="`$item.file_file_extension`.png" width="42" height="42" alt=$item.file_file_extension}</a>
</td>
<td>
<a href="{$jamroom_url}/{$item.profile_url}/{$murl}/{$item._item_id}/{$item.file_title_url}"><h3>{$item.file_title}</h3></a>
<td rowspan="2" style="width:5%;padding-right:12px"> <a href="{$jamroom_url}/{$murl}/download/file_file/{$item._item_id}">{jrCore_image module="jrFoxyCartBundle" image="IELTS-writing-task-2-free-download.png" width="140" alt="Free Download"}</a>
</td>
</tr>
<tr>
<td class="sublabel" style="width:95%">{$item.file_file_name}, {$item.file_file_size|jrCore_format_size}
<br>{if strlen($item.file_description) > 0}
{$item.file_description|truncate:90}
{/if}
</td>
</tr>
</table>
</div>
{else}
<div>
<table class="item" style="width:80%;margin-left:0">
<tr>
<td rowspan="2" style="width:5%;padding-right:12px">
<a href="{$jamroom_url}/{$item.profile_url}/{$murl}/{$item._item_id}/{$item.file_title_url}">{jrCore_image module="jrFile" image="`$item.file_file_extension`.png" width="42" height="42" alt=$item.file_file_extension}</a>
</td>
<td>
<a href="{$jamroom_url}/{$item.profile_url}/{$murl}/{$item._item_id}/{$item.file_title_url}"><h3>{$item.file_title}</h3></a>
</td>
<td rowspan="2" style="width:20%;white-space:nowrap;padding-right:12px">
{jrCore_module_function function="jrFoxyCart_add_to_cart" module='jrFile' field='file_file' item=$item}
</td>
</tr>
<tr>
<td class="sublabel" style="width:95%">{$item.file_file_name}, {$item.file_file_size|jrCore_format_size}
<br>{if strlen($item.file_description) > 0}
{$item.file_description|truncate:90}
{/if}
</td>
</tr>
</table>
</div>
{/if}
Note: The description section is optional and just for those who want a short description of their file to also embed (helpful). You must add a description section to your create/update forms as a text area for this to work. Then this section of code will be relevant.
<br>{if strlen($item.file_description) > 0}
{$item.file_description|truncate:90}
To see how this works, I embedded a saleable PDF book here -
http://kenrich.me/page/227/in-defense-of-contemporary-christian-music
So now the file is saleable wherever it is embedded on my network, and the PDF icon and title link back to the files detail page. The detail page is also enhanced by adding a full editor to the form but that's a separate issue.
This could potentially be good for downloadable ticket sales too - let me know if you implement a system where the ticket codes automatically increment - thanks.
updated by @ken-rich: 07/15/16 09:51:21PM