Scot Ranney • April 16, 2026
If a store has their digital download expiration and max downloads in the global digital download settings (in the store settings area) then the download record will show a -1 for both. In this case you have to load the download settings along with the digital download record to work that stuff out.
<mvt:comment> # # load digital download global settings - global max downloads and expiration # </mvt:comment> <mvt:do name="l.success" file="g.Module_Feature_DDL_DB " value="DigitalDownloadSettings_Load(l.settings:dl_settings)" /> <mvt:comment> # # work out expiration and max downloads and display a download button plus everything else # </mvt:comment> <mvt:if expr="NOT ISNULL l.settings:option:digital_download_url"> <mvt:if expr="NOT ISNULL l.settings:option:data"> <mvt:do name="l.success" file="g.Module_Feature_DDL_DB " value="DigitalDownload_Load_Code(l.settings:option:data,l.settings:dl_data)" /> </mvt:if> <div> <a target="_blank" href="&mvt:option:digital_download_url;" class="btn-carto-primary mt-2 text-decoration-none" style="color: #c9a96e; width: auto; padding: 7px 1.25rem; font-size: var(--carto-size-btn-sm);"> <i class="bi bi-download me-2"></i> Download Item </a> </div> <mvt:if expr="NOT ISNULL l.settings:dl_data"> <mvt:assign name="l.settings:expire_t" value="(l.settings:dl_settings:expiration * 86400) + s.dyn_time_t" /> <div class="small mt-2"> downloads: &mvt:dl_data:total_dl; / &mvt:dl_settings:max_dl; (expires: <mvt:item name="scotstools" param="display_date(l.settings:expire_t,7.2)" />) </div> </mvt:if> </mvt:if>
<mvt:comment> # # load digital download global settings - global max downloads and expiration # </mvt:comment> <mvt:do name="l.success" file="g.Module_Feature_DDL_DB " value="DigitalDownloadSettings_Load(l.settings:dl_settings)" /> <mvt:comment> # # work out expiration and max downloads and display a download button plus everything else # </mvt:comment>
<mvt:if expr="NOT ISNULL l.settings:option:digital_download_url"> <mvt:if expr="NOT ISNULL l.settings:option:data"> <mvt:do name="l.success" file="g.Module_Feature_DDL_DB " value="DigitalDownload_Load_Code(l.settings:option:data,l.settings:dl_data)" /> </mvt:if> <div> <a target="_blank" href="&mvt:option:digital_download_url;" class="btn-carto-primary mt-2 text-decoration-none" style="color: #c9a96e; width: auto; padding: 7px 1.25rem; font-size: var(--carto-size-btn-sm);"> <i class="bi bi-download me-2"></i> Download Item </a> </div> <mvt:if expr="NOT ISNULL l.settings:dl_data"> <mvt:assign name="l.settings:expire_t" value="(l.settings:dl_settings:expiration * 86400) + s.dyn_time_t" /> <div class="small mt-2"> downloads: &mvt:dl_data:total_dl; / &mvt:dl_settings:max_dl; (expires: <mvt:item name="scotstools" param="display_date(l.settings:expire_t,7.2)" />) </div> </mvt:if> </mvt:if>
The order item option that contains the digital download is like this:
l.all_settings:option: 28 elements
:attmpat_id = 0:attr_code = digitaldownload:attr_id = 0:base_price = 0:data = 7d96cb217b17ab631fec6c18a766375f:digital_download_url = https://www.geographicus.com/mm5/download.mvc?Store_Code=AntiqueMaps&DigitalDownload=abcd1234abcd1234:discount_count = 0:formatted_base_price = $0.00:formatted_price = $0.00:formatted_retail = $0.00:formatted_subtotal = $0.00:formatted_subtotal_base_price = $0.00:formatted_subtotal_retail = $0.00:id = 5073:line_id = 141146:option_id = 0:order_id = 11920:price = 0:retail = 0:subtotal = 0:subtotal_base_price = 0:subtotal_retail = 0:weight = 0
The digital download record contains:
l.all_settings:dl_data: 11 elements
:code = 7d96cb217b17ab631fec6c18a766375f:create_dt = 1775857271:expiration = -1:id = 679:line_id = 141146:max_dl = -1:order_id = 11920:product_id = 34717:symlink = e5acbce38a227b444716151db418978d:total_bw = 0:total_dl = 3
Note, if expiration or max_dl is -1 then it means the values are in the global digital download settings in the store setting area. The code above assumes this.
mvkb_download mvkb_order mvkb_smt