Skip to content

Commit cec2126

Browse files
author
Lucas van Staden
committed
Initial Release
1 parent 676d9f6 commit cec2126

File tree

6 files changed

+97
-0
lines changed

6 files changed

+97
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,11 @@ UpdateDownloadLinks
22
===================
33

44
Update Magento Download Links with New File Information
5+
6+
This FREE module will update all the download links for purchased downloadable products to the latest uploaded file.
7+
The name will also be updated accordingly.
8+
9+
Created that super update to your downloadable product? Customers contacting you complaining that the latest and greatest version is not in their downloadable section? No more. This module will update all the links for past orders to reflect the new version. This is a FREE module.
10+
11+
http://www.proxiblue.com.au/magento-modules/update-download-links.html
12+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
class ProxiBlue_UpdateDownloadLinks_Model_Observer {
4+
5+
public function catalog_product_save_after($observer) {
6+
$product = $observer->getEvent()->getProduct();
7+
if ($product->getTypeId() == Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE) {
8+
$date = new DateTime();
9+
$productPurItem = Mage::getModel('downloadable/link_purchased_item')->getCollection()
10+
->addFieldToFilter('product_id', $product->getId());
11+
if ($product->getTypeInstance(true)->hasLinks($product)) {
12+
$fl = $product->getTypeInstance(true)->getLinks($product);
13+
foreach ($fl as $fl1) {
14+
if (!is_null($productPurItem)) {
15+
foreach ($productPurItem as $_itemPur) {
16+
$_itemPur->setLinkUrl(null)
17+
->setLinkId($fl1["link_id"])
18+
->setLinkType('file')
19+
->setLinkTitle($fl1["default_title"])
20+
->setStatus($_itemPur->getStatus())
21+
->setLinkFile($fl1["link_file"])
22+
->setUpdatedAt($date->format('Y-m-d H:i:s'))
23+
->save();
24+
}
25+
}
26+
}
27+
}
28+
}
29+
}
30+
31+
}
32+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0"?>
2+
<config>
3+
<modules>
4+
<ProxiBlue_UpdateDownloadLinks>
5+
<version>0.0.1</version>
6+
<depends>
7+
<Mage_Catalog/>
8+
</depends>
9+
</ProxiBlue_UpdateDownloadLinks>
10+
</modules>
11+
<global>
12+
<models>
13+
<updatedownloadlinks>
14+
<class>ProxiBlue_UpdateDownloadLinks_Model</class>
15+
</updatedownloadlinks>
16+
</models>
17+
<events>
18+
<catalog_product_save_after>
19+
<observers>
20+
<updatedownloadlinks>
21+
<type>singleton</type>
22+
<class>updatedownloadlinks/observer</class>
23+
<method>catalog_product_save_after</method>
24+
</updatedownloadlinks>
25+
</observers>
26+
</catalog_product_save_after>
27+
</events>
28+
<resources>
29+
<proxiblue_updatedownloadlinks_setup>
30+
<setup>
31+
<module>ProxiBlue_UpdateDownloadLinks</module>
32+
</setup>
33+
<connection>
34+
<use>core_setup</use>
35+
</connection>
36+
</proxiblue_updatedownloadlinks_setup>
37+
</resources>
38+
</global>
39+
</config>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/app/code/local/ProxiBlue/UpdateDownloadLinks
2+
/app/etc/modules/ProxiBlue_UpdateDownloadLinks.xml
3+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
$installer = $this;
4+
$installer->startSetup();
5+
6+
$installer->endSetup();
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0"?>
2+
<config>
3+
<modules>
4+
<ProxiBlue_UpdateDownloadLinks>
5+
<active>true</active>
6+
<codePool>local</codePool>
7+
</ProxiBlue_UpdateDownloadLinks>
8+
</modules>
9+
</config>

0 commit comments

Comments
 (0)