DownloadPlus Template Blocks
Administrator Template
1. Customer Information - Current Downloads Tab
By default the Tab for the Current Downloads is hidden, the Purchased Downloadable Products are shown as part of the Customer View Tab. To show this tab, uncomment the block defined in the Layout file downloadplus.xml
of your default Administrator Template:
design/adminhtml/default/default/layout/downloadplus.xml
<!-- Customer - Edit - Current Downloads (Tab) --> <adminhtml_customer_edit> <reference name="customer_edit_tabs"> <action method="addTab"><name>downloadplus_downloads</name><block after="-">downloadplus/adminhtml_customer_edit_tab_downloads</block></action> </reference> </adminhtml_customer_edit>
2. Customer Information - Customer View
Your Customer Information Page may miss to show the Customer View Tab. In case of that, add this Tab to your block defined in the Layout file customer.xml
of your default Administrator Template:
app/design/adminhtml/default/default/layout/customer.xml
<layout> <adminhtml_customer_edit> <reference name="content"> <block type="adminhtml/customer_edit" name="customer_edit"></block> </reference> <reference name="left"> <!-- Adds "Customer View" --> <block type="adminhtml/customer_edit_tabs" name="customer_edit_tabs"> <block type="adminhtml/customer_edit_tab_view" name="customer_edit_tab_view" template="customer/tab/view.phtml"> <block type="adminhtml/customer_edit_tab_view_sales" name="sales" template="customer/tab/view/sales.phtml" before="-" /> <block type="adminhtml/customer_edit_tab_view_accordion" name="accordion" /> </block> <action method="addTab"><name>customer_edit_tab_view</name><block>customer_edit_tab_view</block></action> </block> </reference> <reference name="js"> <block type="adminhtml/template" template="customer/edit/js.phtml" name="customer.edit.js" as="customer_edit_js"></block> </reference> </adminhtml_customer_edit> </layout>
Frontend Template
1. Terms of Use when Downloading
DownloadPlus delivers with Template Blocks for the Download Pages (see example for the Terms of Use here) located by default in the following path:
Location of the DownloadPlus Template Blocks
app/design/frontend/default/default/template/downloadplus
Location of the DownloadPlus CSS file
skin/frontend/default/default/css/downloadplus.css
In case you are using a different template from the Magento default, copy the downloadplus
folder to the same location in your templates path. Also copy the downloadplus.xml
layout definition file located in the layout
folder of the default template.
To show the Terms of Use for Downloadable Products and Samples, the related Template Blocks of DownloadPlus are defined in the Layout XML downloadplus.xml
:
(all file paths shown are relative to app/design/frontend/…/<your template>
)
app/design/frontend/default/.../layout/downloadplus.xml
<!-- The Layout for the Download Links --> <core_download_link> <remove name="left"/> <reference name="root"> <action method="setTemplate"><template>page/1column.phtml</template></action> </reference> <!-- This adds the Terms of Use Page for the Downloadable Products --> <reference name="content"> <block type="downloadplus/license_links" name="downloadable_license_links" template="downloadplus/license/links.phtml" /> </reference> </core_download_link> <!-- The Layout for the Download Samples --> <core_download_sample> <remove name="left"/> <reference name="root"> <action method="setTemplate"><template>page/1column.phtml</template></action> </reference> <!-- This adds the Terms of Use Page for the Downloadable Samples --> <reference name="content"> <block type="downloadplus/license_samples" name="downloadable_license_samples" template="downloadplus/license/samples.phtml" /> </reference> </core_download_sample>
2. DownloadPlus Tabs for the Product Page
Version History
This adds a tab Version History to the Product Page where the history of the last (but current) updates is shown:
To add this Tab to all Product Types, customize the Layout file catalog.xml
of your current Frontend Template:
app/design/frontend/default/.../layout/catalog.xml
<catalog_product_view> <reference name="content"> ... <block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs" template="catalog/product/view/tabs.phtml" > ... <!-- This adds the Version History Tab --> <action method="addTab" translate="title" module="catalog"> <alias>versionhistory</alias> <title>Version History</title> <block>downloadplus/product_view_history</block> <template>downloadplus/product/view/history.phtml</template> </action> ... </block> ... </reference> </catalog_product_view>
To add this Tab to only Downloadable Products, customize the Layout file downloadable.xml
of your current Frontend Template:
app/design/frontend/default/.../layout/downloadable.xml
<PRODUCT_TYPE_downloadable> ... <!-- This adds the Version History Tab --> <reference name="product.info.tabs"> <action method="addTab" translate="title" module="catalog"> <alias>versionhistory</alias> <title>Version History</title> <block>downloadplus/product_view_history</block> <template>downloadplus/product/view/history.phtml</template> </action> </reference> ... </PRODUCT_TYPE_downloadable>
Release Notes
This adds a tab Release Notes to the Product Page where the Version and Detail for the current file is shown:
To add this tab to any Product Type, customize the Layout file catalog.xml
of your current Frontend Template;
app/design/frontend/default/.../layout/catalog.xml
<catalog_product_view> <reference name="content"> ... <block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs" template="catalog/product/view/tabs.phtml" > ... <!-- This adds the Release Notes Tab --> <action method="addTab" translate="title" module="catalog"> <alias>releasenotes</alias> <title>Release Notes</title> <block>downloadplus/product_view_history</block> <template>downloadplus/product/view/releasenotes.phtml</template> </action> ... </block> ... </reference> </catalog_product_view>
To add this Tab to only Downloadable Products, customize the Layout file downloadable.xml
of your current Frontend Template:
app/design/frontend/default/.../layout/downloadable.xml
<PRODUCT_TYPE_downloadable> ... <!-- This adds the Release Notes Tab --> <reference name="product.info.tabs"> <action method="addTab" translate="title" module="catalog"> <alias>releasenotes</alias> <title>Release Notes</title> <block>downloadplus/product_view_history</block> <template>downloadplus/product/view/releasenotes.phtml</template> </action> </reference> ... </PRODUCT_TYPE_downloadable>
Additional Downloads
This tab adds the Additional Downloads for the Product to the Product Page:
To add this Tab to all Product Types, customize the Layout file catalog.xml
of your current Frontend Template:
app/design/frontend/default/.../layout/catalog.xml
<catalog_product_view> <reference name="content"> ... <block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs" template="catalog/product/view/tabs.phtml" > ... <!-- This adds the Additional Downloads Tab --> <action method="addTab" translate="title" module="catalog"> <alias>additionaldownloads</alias> <title>Additional Downloads</title> <block>downloadplus/product_view_downloads</block> <template>downloadplus/product/view/downloads.phtml</template> </action> ... </block> ... </reference> </catalog_product_view>
3. Top Downloads Sidebar Block for Frontend
DownloadPlus delivers with a Sidebar Block for the Frontend, showing the Top Downloads. The associated templates are located by default in the following path:
Location of the Top Downloads Sidebar Block Template
app/design/frontend/default/default/template/downloadplus/sidebar/topdownloads.phtml
In case you are using a different template from the Magento default, copy the downloadplus
folder to the same location in your templates path. Also copy the downloadplus.xml
layout definition file located in the layout
folder of the default template.
To customize the layout position of this Block, use the downloadplus.xml
layout definition file:
app/design/frontend/default/.../layout/downloadplus.xml
<?xml version="1.0" encoding="UTF-8"?> <layout version="0.1.0"> <default> <reference name="right"> <block type="downloadplus/topdownloads" name="downloadplus_topdownloads_sidebar" template="downloadplus/sidebar/topdownloads.phtml" /> </reference> </default> </layout>
By default only the Top 5 entries are shown, to modify this limit or to change the appearance or content of this block customize the related Template File:
app/design/frontend/default/.../template/downloadplus/sidebar/topdownloads.phtml
<?php /* * Get recent updated files, limit to 5 max. * To get all, ommit limit. */ $_downloads = $this->getTopDownloads(5); ?> <?php if(count($_downloads) > 0): ?> <div class="box base-mini"> <div class="head"> <h4 class="title"><?php echo $this->__('Top Downloads') ?></h4> </div> <div class="content"> ...
You may change the type of top rated and shown Downloads to:
$this->getTopDownloads() // ... Returns all Product and Sample Downloads $this->getTopLinks() // ... Returns only Product Downloads $this->getTopSamples() // ... Returns only Sample Downloads
4. Recently Updated Sidebar Block for Frontend
DownloadPlus delivers with a Sidebar Block showing the most recent updated downloads. This Block shows the Downloads sorted by the Modification Date of the related file, allowing to display recently updated files. The associated templates are located by default in the following path:
Location of the Top Downloads Sidebar Block Template
app/design/frontend/default/default/template/downloadplus/sidebar/updated.phtml
In case you are using a different template from the Magento default, copy the downloadplus
folder to the same location in your templates path. Also copy the downloadplus.xml
layout definition file located in the layout
folder of the default template.
To customize the layout position of this Block, use the downloadplus.xml
layout definition file:
app/design/frontend/default/.../layout/downloadplus.xml
<?xml version="1.0" encoding="UTF-8"?> <layout version="0.1.0"> <default> <reference name="right"> <block type="downloadplus/updated" name="downloadplus_updated_sidebar" template="downloadplus/sidebar/updated.phtml" /> </reference> </default> </layout>
By default only the Latest 5 entries are shown, to modify this limit or to change the appearance or content of this block customize the related Template File:
app/design/frontend/default/.../template/downloadplus/sidebar/updated.phtml
<?php /* * Get recent updated files, limit to 5 max. * To get all, ommit limit. */ $_updates = $this->getUpdated(5); ?> <?php if(count($_updates) > 0): ?> <div class="box base-mini"> <div class="head"> <h4 class="title"><?php echo $this->__('Recently Updated') ?></h4> </div> <div class="content"> ...
You may change the type of shown Downloads to:
$this->getUpdated() // ... Returns all Product and Sample Downloads $this->getUpdatesLinks() // ... Returns only Product Downloads $this->getUpadtedSamples() // ... Returns only Sample Downloads
5. Replacement of Default 'My Downloadable Products' Page in Customer Account
To replace the default 'My Downloadable Products' page of Magento with a new page, that shows all related Versions of each purchased Link, you need to update the following layout file to change the Block and Template to the DownloadPlus delivered page:
Magento 1.3: app/design/frontend/default/.../layout/downloadable.xml
<downloadable_customer_products> <update handle="customer_account"/> <reference name="content"> <!-- Update the line below to replace the default page with the DownloadPlus page --> <block type="downloadplus/customer_products_list" name="downloadable_customer_products_list" template="downloadplus/customer/products/list.phtml" /> </reference> </downloadable_customer_products>
Magento 1.4 and higher: app/design/frontend/default/.../layout/downloadable.xml
<downloadable_customer_products translate="label"> <label>Customer My Account Downloadable Items</label> <update handle="customer_account"/> <reference name="my.account.wrapper"> <!-- Update the line below to replace the default page with the DownloadPlus page --> <block type="downloadplus/customer_products_list" name="downloadable_customer_products_list" template="downloadplus/customer/products/list.phtml" /> </reference> </downloadable_customer_products>
To change the sort order of the Products and Purchased Items, see the template file template/downloadplus/customer/products/list.phtml
where the documented code is required to be uncommented and change to your preferences.
Removing the Pager
To remove the pager, and show all downloads as list without the paging function, add the following to the block definition (requires DownloadPlus 0.3.33 or above):
app/design/frontend/default/.../layout/downloadable.xml
<block type="downloadplus/customer_products_list" name="downloadable_customer_products_list" template="downloadplus/customer/products/list.phtml"> <!-- Disables the Pager --> <action method="setPager"><value>false</value></action> </block>
Changing the Sort Order
To change the sort order of the entries of the Downloadable Links use the Layout File downloadplus.xml
, copy it to your Themes layout
directory and modify it as described in the downloadplus.xml
Layout File:
app/design/frontend/default/.../layout/downloadplus.xml
<customer_account_index> <reference name="customer_account_dashboard"> <block type="downloadplus/customer_products_list" name="downloadable_customer_products_list" as="downloads" template="downloadplus/customer/account/dashboard/downloads.phtml"> <!-- To modify sort order of the items: --> <action method="setSortProducts"><value>purchased_links.product_name ASC</value></action> <action method="setSortPurchasedItems"><value>purchased_links.order_increment_id DESC</value></action> <action method="setSortVersionHistory"><value>version DESC</value></action> --> </block> </reference> </customer_account_index>
The sorting parameter is a SQL based ORDER BY
parameter. To sort based on the Purchased Links Product Name
in ascending order use:
<!-- Sort Ascending on Purchased Links Product Name --> <action method="setSortProducts"><value>purchased_links.product_name ASC</value></action>
To Sort based on the Purchased History Order
use the Purchased Links Order Increment ID
in descending order:
<action method="setSortPurchasedItems"><value>purchased_links.order_increment_id DESC</value></action>
To sort based on the Version History
use the Version
column:
<action method="setSortVersionHistory"><value>version DESC</value></action> -->
Customer Account Dashboard
To add the list of current purchased downloads to the Customer Account Dashboard add the following code to the Dashboard template file:
app/design/frontend/default/.../template/customer/account/dashboard.phtml
<div class="dashboard"> <div class="page-title"> <h1><?php echo $this->__('My Dashboard') ?></h1> </div> <?php echo $this->getMessagesBlock()->getGroupedHtml() ?> <?php echo $this->getChildHtml('hello') ?> <!-- This is adding the Purchased Downloads List to the Customer Account Dashboard page --> <?php echo $this->getChildHtml('downloads') ?> ... </div>
6. RSS Feed on Recently Updated Downloads
DownloadPlus allows to offer a RSS 2.0 Feed with the data from the Version History of your Downloadable Products. You may need to enable the RSS Feed in your Stores Configuration of DownloadPlus.
The feed content is customizeable by modifying the default template files used for generating the feed:
Customizing the Feed Header
To customize the Feed Header use the following templates, all default templates to be found in app/design/frontend/default/default/template
:
downloadplus/rss/updates/header/title.phtml ... The feed title. downloadplus/rss/updates/header/description.phtml ... The feed description.
Customizing the Feed Entries
To customize the Feed Entries use the following templates, all default templates to be found in app/design/frontend/default/default/template
:
downloadplus/rss/updates/feed/title.phtml ... The feed entry title. downloadplus/rss/updates/feed/description.phtml ... The feed entry description (Text only). downloadplus/rss/updates/feed/content.phtml ... The feed entry content (may get used with the description, HTML allowed).
Adding the RSS Feed Link to your Product Page
You may add the RSS Feed Link to your Product Page by adding the related Block to your Layout:
app/design/frontend/default/.../layout/catalog.xml
<catalog_product_view> ... <reference name="content"> ... <!-- This is adding the RSS Feed Link on the updates to Downloadable Products --> <block type="downloadplus/rss_feed" name="rss.updates" template="downloadplus/rss/updates/link.phtml" /> ... </reference> </catalog_product_view>
7. Adding the 'My Serial Numbers' Page to Customer Account
By default the Layout coming with DownloadPlus is adding a Tab for showing Serial Numbers in the Customer Account Page of the frontend template. This layout definition is found here to modify or comment out if not needed:
app/design/frontend/default/.../layout/downloadplus.xml
<!-- Customer Account Dashboard --> <customer_account> <reference name="customer_account_navigation"> <action method="addLink" translate="label" module="downloadplus"> <name>downloadplus_navigation_downloadable_serialnumbers</name> <path>downloadable/customer/serialnumbers</path> <label>My Serial Numbers</label> </action> </reference> </customer_account>
To make Serialnumbers downloadable as file, set the configuration option “Make Serialnumbers downloadable” to Yes and define a “Filename Pattern” for the serialnumber files:
In case the link 'My Serialnumbers' shows and the serialnumber page however shows empty, that may be caused by your templates layout definition. You may need to modify the default layout definition file of DownloadPlus in this case.
Before doing that copy the file into the layout
folder of the template you are using, to keep the customization from being overwritten by future updates:
app/design/frontend/...your template.../layout/downloadplus.xml
<!-- Serialnumbers for Customer purchased Downloadable Products --> <downloadable_customer_serialnumbers> <update handle="customer_account"/> <!-- Set the following reference name to the layout are where the serialnumbers shall show --> <!-- Mostly named 'content', may differ in your template --> <reference name="content"> ... </reference>
To remove the pager, and show all serialnumbers as list without the paging function, add the following to the block definition (requires DownloadPlus 0.3.33 or above):
app/design/frontend/default/.../layout/downloadplus.xml
<downloadable_customer_serialnumbers> ... <reference name="content"> <block type="downloadplus/customer_products_serialnumber" name="downloadable_customer_products_serialnumber" template="downloadplus/customer/products/serialnumber.phtml"> <action method="setPager"><value>false</value></action> </block> </reference> ... </downloadable_customer_serialnumbers>
8. Adding the custom attributes to the Download Link
When using Custom Attributes for Downloadable Links add the related widget to the frontend template pages for showing them:
By default the Link Attributes are added to the Link Title of the different pages and transactional emails automatically, if you want to change the design of that use the Widget included in DownloadPlus as shown in the template code examples below. The different default Magento template files used for this are located in:
Product Page: frontend/.../template/downloadable/catalog/product/links.phtml Shopping Cart: frontend/.../template/downloadable/checkout/cart/item/default.phtml frontend/.../template/downloadable/checkout/multishipping/item/downloadable.phtml Checkout: frontend/.../template/downloadable/checkout/onepage/review/item.phtml Order: frontend/.../template/downloadable/sales/order/creditmemo/items/renderer/downloadable.phtml frontend/.../template/downloadable/sales/order/invoice/items/renderer/downloadable.phtml frontend/.../template/downloadable/sales/order/items/renderer/downloadable.phtml
For the transactional emails the related Magento default block templates are located here:
frontend/.../template/downloadable/email/order/items/creditmemo/downloadable.phtml frontend/.../template/downloadable/email/order/items/invoice/downloadable.phtml frontend/.../template/downloadable/email/order/items/order/downloadable.phtml
When customizing one of the above template files, first make a copy of it to the stores template directory and modify the template file there.
If the custom attributes show as HTML code (instead of rendering) then look in the above template files and change the following template code:
<span class="label"> <label for="links_<?php echo $_link->getId() ?>"> <!-- Change this: <?php echo $this->escapeHtml($_link->getTitle()); ?> to this: --> <?php echo $_link->getTitle(); ?> </label> ... </span>
For customization of the widget make a copy of the template file to your stores template directory:
Location of the Link Attributes Widget
app/design/frontend/default/default/template/downloadplus/widget/link/attributes.phtml
Product View Page
To implement the widget into the Product Page, add the related widget code to it as shown in this excerpt from the related template page:
app/design/frontend/.../template/downloadable/catalog/product/links.phtml
<span class="label"> <label for="links_<?php echo $_link->getId() ?>"> <!-- Change this line as shown here (otherwise the Link Attributes will be part of the Link Title: --> <?php echo $_link->getTitle(false) ?> </label> <?php if ($_link->getSampleFile() || $_link->getSampleUrl()): ?> (<a href="<?php echo $this->getLinkSampleUrl($_link) ?>" <?php echo $this->getIsOpenInNewWindow()?'onclick="this.target=\'_blank\'"':''; ?>><?php echo Mage::helper('downloadable')->__('Sample') ?></a>) <?php endif; ?> <?php if ($_linksPurchasedSeparately): ?> <?php echo $this->getFormattedLinkPrice($_link); ?> <?php endif; ?> <!-- The Widget for the Link Attributes: --> <?php echo $this->getLayout()->createBlock('downloadplus/widget_link_attributes')->setLink($_link)->toHtml(); ?> </span>
Checkout Cart Page
To implement the widget into the Checkout Cart Page, add the related widget code to it as shown in this excerpt from the related template page:
app/design/frontend/.../template/downloadable/checkout/cart/item/default.phtml
<!-- downloadable --> <!-- Change this line below shown here (otherwise the Link Attributes will be part of the Link Title): --> <?php if ($links = $this->getLinks(false)): ?> <dl class="item-options"> <dt><?php echo $this->getLinksTitle() ?></dt> <?php foreach ($links as $link): ?> <dd> <?php echo $this->escapeHtml($link->getTitle()); ?> <!-- This below is the Downloadable Product Attribute widget: --> <?php echo $this->getLayout()->createBlock('downloadplus/widget_link_attributes')->setLink($link)->toHtml(); ?> </dd> <?php endforeach; ?> </dl> <?php endif; ?> <!-- EOF downloadable -->
9. Additional Downloads for Product Block on CMS or other Page
DownloadPlus allows to add files to Products as free direct downloads (“Additional Downloads”) as described here. To show a block on a CMS page, or any other page, of your store the following Block may get used for this:
Additional Downloads for a specific Product
This block shows the available additional downloads for a specific product, select the product by specifying its SKU in the layout definition:
"layout.xml" or Custom Layout of Page
<block type="downloadplus/product_view_downloads" name="block.additional.downloads" template="downloadplus/product/additional/downloads.phtml" > <!-- Use the below to set a Product SKU as filter to only show additional downloads for a particular product --> <action method="setData"><key>product_sku</key><value>PRODUCT-SKU</value></action> </block>
Additional Downloads grouped by Product
This block shows all products having additional downloads attached, with the downloads grouped per product:
"layout.xml" or Custom Layout of Page
<block type="downloadplus/product_view_downloads" name="block.additional.downloads.grouped" template="downloadplus/product/additional/downloads/grouped.phtml" />
Translation and Customization of Messages
DownloadPlus delivers with language files for English (en_US) and German (de_DE). The language files are located in:
DownloadPlus Translation Files
locale/en_US/Pisc_Downloadplus.csv locale/de_DE/Pisc_Downloadplus.csv
To customize the default Messages, you may put the language file entries to be customized into the customized language file of your Frontend Template:
Customized Translations for your Template
app/design/frontend/default/<your-template>/locale/en_US/translate.csv app/design/frontend/default/<your-template>/locale/de_DE/translate.csv