Version Notes
It is stable version
Download this release
Release Info
Developer | Dynamic Dreamz |
Extension | Cart_Fileupload |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/community/DD/Upload/Block/Upload.php +17 -0
- app/code/community/DD/Upload/Helper/Data.php +59 -0
- app/code/community/DD/Upload/Model/Mysql4/Order.php +18 -0
- app/code/community/DD/Upload/Model/Mysql4/Order/Collection.php +18 -0
- app/code/community/DD/Upload/Model/Mysql4/Upload.php +18 -0
- app/code/community/DD/Upload/Model/Mysql4/Upload/Collection.php +18 -0
- app/code/community/DD/Upload/Model/Observer.php +53 -0
- app/code/community/DD/Upload/Model/Order.php +43 -0
- app/code/community/DD/Upload/Model/Upload.php +44 -0
- app/code/community/DD/Upload/controllers/IndexController.php +130 -0
- app/code/community/DD/Upload/etc/adminhtml.xml +31 -0
- app/code/community/DD/Upload/etc/config.xml +129 -0
- app/code/community/DD/Upload/etc/system.xml +69 -0
- app/code/community/DD/Upload/sql/upload_setup/mysql4-install-0.1.0.php +33 -0
- app/design/adminhtml/default/default/layout/upload.xml +17 -0
- app/design/adminhtml/default/default/template/upload/sales/order/view/info.phtml +10 -0
- app/design/adminhtml/default/default/template/upload/sales/order/view/uploadfile.phtml +92 -0
- app/design/frontend/base/default/layout/upload.xml +80 -0
- app/design/frontend/base/default/template/upload/checkout/uploads.phtml +88 -0
- app/design/frontend/base/default/template/upload/sales/order/info.phtml +165 -0
- app/etc/modules/DD_Upload.xml +10 -0
- cart_fileupload_features.odt +0 -0
- cart_fileupload_manual.docx +0 -0
- media/uploads/icons/csv.png +0 -0
- media/uploads/icons/csv2.png +0 -0
- media/uploads/icons/default.png +0 -0
- media/uploads/icons/doc.png +0 -0
- media/uploads/icons/docx.png +0 -0
- media/uploads/icons/error4.jpg +0 -0
- media/uploads/icons/missing.png +0 -0
- media/uploads/icons/missing1.png +0 -0
- media/uploads/icons/ods.png +0 -0
- media/uploads/icons/odt.png +0 -0
- media/uploads/icons/odt2.png +0 -0
- media/uploads/icons/pdf.png +0 -0
- media/uploads/icons/pptx.png +0 -0
- media/uploads/icons/txt.png +0 -0
- media/uploads/icons/unknown.png +0 -0
- media/uploads/icons/unknown1.png +0 -0
- media/uploads/icons/unkown2.png +0 -0
- media/uploads/icons/xls.png +0 -0
- media/uploads/icons/xml.png +0 -0
- package.xml +36 -0
- skin/frontend/base/default/css/upload/upload.css +73 -0
app/code/community/DD/Upload/Block/Upload.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Upload
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
class DD_Upload_Block_Upload extends Mage_Core_Block_Template {
|
13 |
+
|
14 |
+
public function __construct() {
|
15 |
+
parent::__construct();
|
16 |
+
}
|
17 |
+
}
|
app/code/community/DD/Upload/Helper/Data.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Upload
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
|
11 |
+
class DD_Upload_Helper_Data extends Mage_Core_Helper_Abstract {
|
12 |
+
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Check uploaded file extnsion and return file type
|
16 |
+
* @param string $ext
|
17 |
+
* @return string
|
18 |
+
*/
|
19 |
+
|
20 |
+
public function checkFileType($ext) {
|
21 |
+
switch ($ext) {
|
22 |
+
case 'jpeg':return 'Image';
|
23 |
+
break;
|
24 |
+
case 'jpg':return 'Image';
|
25 |
+
break;
|
26 |
+
case 'gif':return 'Image';
|
27 |
+
break;
|
28 |
+
case 'png':return 'Image';
|
29 |
+
break;
|
30 |
+
case 'ico':return 'Tmage';
|
31 |
+
break;
|
32 |
+
case 'doc':return 'Document';
|
33 |
+
break;
|
34 |
+
case 'docx':return 'Document';
|
35 |
+
break;
|
36 |
+
case 'odt':return 'Document';
|
37 |
+
break;
|
38 |
+
case 'pdf':return 'PDF';
|
39 |
+
break;
|
40 |
+
case 'txt':return 'Text';
|
41 |
+
break;
|
42 |
+
case 'xls':return 'Excel';
|
43 |
+
break;
|
44 |
+
case 'ppt':return 'Powerpoint';
|
45 |
+
break;
|
46 |
+
case 'pptx':return 'Powerpoint';
|
47 |
+
break;
|
48 |
+
case 'csv':return 'CSV';
|
49 |
+
break;
|
50 |
+
case 'ods':return 'Document';
|
51 |
+
break;
|
52 |
+
case 'xml':return 'XML';
|
53 |
+
break;
|
54 |
+
default:return 'Unknown';
|
55 |
+
break;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
}
|
app/code/community/DD/Upload/Model/Mysql4/Order.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Upload
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
class DD_Upload_Model_Mysql4_Order extends Mage_Core_Model_Mysql4_Abstract {
|
13 |
+
|
14 |
+
protected function _construct() {
|
15 |
+
$this->_init("upload/order", "id");
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/community/DD/Upload/Model/Mysql4/Order/Collection.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Upload
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
class DD_Upload_Model_Mysql4_Order_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
13 |
+
|
14 |
+
public function _construct() {
|
15 |
+
$this->_init("upload/order");
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/community/DD/Upload/Model/Mysql4/Upload.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Upload
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
class DD_Upload_Model_Mysql4_Upload extends Mage_Core_Model_Mysql4_Abstract {
|
13 |
+
|
14 |
+
protected function _construct() {
|
15 |
+
$this->_init("upload/upload", "id");
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/community/DD/Upload/Model/Mysql4/Upload/Collection.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Upload
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
class DD_Upload_Model_Mysql4_Upload_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
|
13 |
+
|
14 |
+
public function _construct() {
|
15 |
+
$this->_init("upload/upload");
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
app/code/community/DD/Upload/Model/Observer.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Upload
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Upload_Model_Observer {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* runs after product added to cart
|
14 |
+
* @param object $evt
|
15 |
+
*/
|
16 |
+
public function saveQuoteAfter($evt) {
|
17 |
+
$quote = $evt->getQuote();
|
18 |
+
try {
|
19 |
+
$flag = '';
|
20 |
+
$data = Mage::getSingleton('core/session')->getData();
|
21 |
+
$flag = Mage::getSingleton('core/session')->getFlag();
|
22 |
+
if (isset($data['file_upload_path']) && $flag == 'on') {
|
23 |
+
$quote_id = $quote->getId();
|
24 |
+
Mage::getModel('upload/upload')->saveFile($quote_id, $data['file_upload_path'], $data['file_upload_type']);
|
25 |
+
Mage::getSingleton('core/session')->unsData();
|
26 |
+
Mage::getSingleton('core/session')->unsFlag();
|
27 |
+
$flag = 'off';
|
28 |
+
}
|
29 |
+
} catch (Exception $e) {
|
30 |
+
Mage::log($e->getMessage());
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* runs after placing order
|
36 |
+
* @param object $event
|
37 |
+
*/
|
38 |
+
public function placeOrderAfter($event) {
|
39 |
+
try {
|
40 |
+
$order_id = $event->getEvent()->getOrder()->getId();
|
41 |
+
$order = Mage::getModel('sales/order')->load($order_id);
|
42 |
+
$quote_id = $order->getQuoteId();
|
43 |
+
$collection = Mage::getModel('upload/upload')->getCollection();
|
44 |
+
$collection->addFieldToFilter('quote_id', $quote_id);
|
45 |
+
foreach ($collection as $object) {
|
46 |
+
Mage::getModel('upload/order')->saveFile($order_id, $object->getFilename(), $object->getType());
|
47 |
+
}
|
48 |
+
} catch (Exception $e) {
|
49 |
+
Mage::log($e->getMessage());
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
}
|
app/code/community/DD/Upload/Model/Order.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Upload
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
class DD_Upload_Model_Order extends Mage_Core_Model_Abstract {
|
13 |
+
|
14 |
+
protected function _construct() {
|
15 |
+
|
16 |
+
$this->_init("upload/order");
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* save record of particular uploaded file
|
21 |
+
* @param string $order_id
|
22 |
+
* @param string $filename
|
23 |
+
* @param string $type
|
24 |
+
*/
|
25 |
+
public function saveFile($order_id, $filename, $type) {
|
26 |
+
$this->setFilename($filename);
|
27 |
+
$this->setOrderId($order_id);
|
28 |
+
$this->setType($type);
|
29 |
+
$this->save();
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* get all uploaded file records
|
34 |
+
* @param object $order
|
35 |
+
* @return object
|
36 |
+
*/
|
37 |
+
public function getFiles($order) {
|
38 |
+
$collection = Mage::getSingleton('upload/order')->getCollection();
|
39 |
+
$collection->addFieldToFilter('order_id', $order->getId());
|
40 |
+
return $collection;
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
app/code/community/DD/Upload/Model/Upload.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Upload
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
class DD_Upload_Model_Upload extends Mage_Core_Model_Abstract {
|
13 |
+
|
14 |
+
protected function _construct() {
|
15 |
+
|
16 |
+
$this->_init("upload/upload");
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* save record of particular uploaded file
|
21 |
+
* @param string $quote_id
|
22 |
+
* @param string $filename
|
23 |
+
* @param string $type
|
24 |
+
*/
|
25 |
+
public function saveFile($quote_id, $filename, $type) {
|
26 |
+
$this->setFilename($filename);
|
27 |
+
$this->setQuoteId($quote_id);
|
28 |
+
$this->setType($type);
|
29 |
+
$this->save();
|
30 |
+
Mage::getSingleton('core/session')->unsData();
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* get details of last uploded file
|
35 |
+
* @param string $quote_id
|
36 |
+
* @return object
|
37 |
+
*/
|
38 |
+
public function getCurrentUploadedFiles($quote_id) {
|
39 |
+
$collection = Mage::getModel('upload/upload')->getCollection();
|
40 |
+
$collection->addFieldToFilter('quote_id', $quote_id);
|
41 |
+
return $collection;
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
app/code/community/DD/Upload/controllers/IndexController.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Upload
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
class DD_Upload_IndexController extends Mage_Core_Controller_Front_Action {
|
11 |
+
|
12 |
+
/**
|
13 |
+
* file upload action
|
14 |
+
*/
|
15 |
+
public function uploadAction() {
|
16 |
+
$totalItemsInCart = Mage::helper('checkout/cart')->getItemsCount();
|
17 |
+
$_flag = 0;
|
18 |
+
if ($totalItemsInCart > 0) {
|
19 |
+
if ($data = $this->getRequest()->getPost()) {
|
20 |
+
$arrData = array();
|
21 |
+
$type = 'file';
|
22 |
+
$flag = 'on';
|
23 |
+
$_fileSize = Mage::getStoreConfig("generalsettings/configuration/upload_filesize");
|
24 |
+
$_maxNoFile = (int)Mage::getStoreConfig("generalsettings/configuration/maxuploadlimit");
|
25 |
+
if (isset($_FILES[$type]['name']) && $_FILES[$type]['name'] != '' && isset($_FILES[$type]['size'])) {
|
26 |
+
try {
|
27 |
+
$_fileSizeCreate = $_FILES[$type]['size'];
|
28 |
+
$quote_id = Mage::getSingleton('checkout/session')->getQuoteId();
|
29 |
+
$collection = Mage::getModel('upload/upload')->getCurrentUploadedFiles($quote_id);
|
30 |
+
if ($_fileSizeCreate > (1024 * 1024 * $_fileSize)) {
|
31 |
+
$_flag = 1;
|
32 |
+
throw new Exception();
|
33 |
+
}
|
34 |
+
if (count($collection->getData()) >= $_maxNoFile) {
|
35 |
+
$_flag = 2;
|
36 |
+
throw new Exception();
|
37 |
+
}
|
38 |
+
$filetype = Mage::helper('upload')->checkFileType(pathinfo($_FILES[$type]['name'], PATHINFO_EXTENSION));
|
39 |
+
$arrData['file_upload_type'] = $filetype;
|
40 |
+
$uploader = new Varien_File_Uploader($type);
|
41 |
+
$uploader->setAllowRenameFiles(true);
|
42 |
+
$uploader->setFilesDispersion(true);
|
43 |
+
$path = Mage::getBaseDir('media') . DS . 'uploads' . DS;
|
44 |
+
$uploader->save($path, $_FILES[$type]['name']);
|
45 |
+
$arrData['file_upload_path'] = $uploader->getUploadedFileName();
|
46 |
+
Mage::getSingleton('core/session')->setData($arrData);
|
47 |
+
Mage::getSingleton('core/session')->setFlag($flag);
|
48 |
+
$this->_redirect('checkout/cart');
|
49 |
+
$message = $this->__($filetype . ' type file has been uploaded successfully.');
|
50 |
+
Mage::getSingleton('core/session')->addSuccess($message);
|
51 |
+
} catch (Exception $e) {
|
52 |
+
if ($_flag == 1) {
|
53 |
+
$this->_redirect('checkout/cart');
|
54 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('upload')->__("Maximum file size allowed is " . $_fileSize . " Mb"));
|
55 |
+
}
|
56 |
+
if ($_flag == 2) {
|
57 |
+
$this->_redirect('checkout/cart');
|
58 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('upload')->__("Upload limit exceeds. You can upload maximum " . $_maxNoFile . " files"));
|
59 |
+
}
|
60 |
+
$this->_redirect('checkout/cart');
|
61 |
+
Mage::log($e->getMessage());
|
62 |
+
}
|
63 |
+
} else {
|
64 |
+
$this->_redirect('checkout/cart');
|
65 |
+
$message = $this->__('Please choose file to upload.');
|
66 |
+
Mage::getSingleton('core/session')->addError($message);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
} else {
|
70 |
+
$this->_redirect('checkout/cart');
|
71 |
+
$message = $this->__('Cart is empty. Please add item to cart.');
|
72 |
+
Mage::getSingleton('core/session')->addError($message);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* file delete action
|
78 |
+
*/
|
79 |
+
public function deleteAction() {
|
80 |
+
if ($this->getRequest()->getParam("id") > 0) {
|
81 |
+
try {
|
82 |
+
$params = $this->getRequest()->getParams();
|
83 |
+
$filename = $params["filename"];
|
84 |
+
$filepath = str_replace('&', '/', $params["filepath"]);
|
85 |
+
$model = Mage::getModel('upload/upload');
|
86 |
+
$model->setId($this->getRequest()->getParam("id"))->delete();
|
87 |
+
$path = Mage::getBaseDir('media') . DS . 'uploads' . $filepath;
|
88 |
+
unlink($path);
|
89 |
+
$this->_redirect("checkout/cart");
|
90 |
+
Mage::getSingleton("core/session")->addSuccess(Mage::helper("upload")->__($filename . " removed successfully"));
|
91 |
+
} catch (Exception $e) {
|
92 |
+
$this->_redirect("checkout/cart");
|
93 |
+
Mage::getSingleton("core/session")->addError("Opps..Some Error Occured...!!!");
|
94 |
+
Mage::log($e->getMessage());
|
95 |
+
}
|
96 |
+
} else {
|
97 |
+
$this->_redirect("checkout/cart");
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* multiple file delete action
|
103 |
+
*/
|
104 |
+
public function massDeleteAction() {
|
105 |
+
if ($this->getRequest()->getPost() && $this->getRequest()->getParam("files")) {
|
106 |
+
try {
|
107 |
+
$ids = $this->getRequest()->getPost('files', array());
|
108 |
+
foreach ($ids as $id => $val) {
|
109 |
+
$model = Mage::getModel('upload/upload');
|
110 |
+
$model2 = Mage::getModel('upload/upload')->load($id);
|
111 |
+
$filepath = $model2->getData()['filename'];
|
112 |
+
$path = Mage::getBaseDir('media') . DS . 'uploads' . $filepath;
|
113 |
+
$model->setId($id)->delete();
|
114 |
+
unlink($path);
|
115 |
+
}
|
116 |
+
$this->_redirect("checkout/cart");
|
117 |
+
Mage::getSingleton("core/session")->addSuccess(Mage::helper("upload")->__("Selected file(s) removed successfully"));
|
118 |
+
} catch (Exception $e) {
|
119 |
+
$this->_redirect("checkout/cart");
|
120 |
+
Mage::getSingleton("core/session")->addError("Opps..Some Error Occured...!!!");
|
121 |
+
Mage::log($e->getMessage());
|
122 |
+
}
|
123 |
+
} else {
|
124 |
+
$this->_redirect("checkout/cart");
|
125 |
+
$message = $this->__('Please choose files to remove.');
|
126 |
+
Mage::getSingleton('core/session')->addError($message);
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
}
|
app/code/community/DD/Upload/etc/adminhtml.xml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
* Dynamic Dreamz
|
4 |
+
* @category DD
|
5 |
+
* @package DD_Upload
|
6 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
8 |
+
-->
|
9 |
+
|
10 |
+
<config>
|
11 |
+
<acl>
|
12 |
+
<resources>
|
13 |
+
<admin>
|
14 |
+
<children>
|
15 |
+
<system>
|
16 |
+
<children>
|
17 |
+
<config>
|
18 |
+
<children>
|
19 |
+
<generalsettings translate="title" module="upload">
|
20 |
+
<title>General Settings Section</title>
|
21 |
+
<sort_order>0</sort_order>
|
22 |
+
</generalsettings>
|
23 |
+
</children>
|
24 |
+
</config>
|
25 |
+
</children>
|
26 |
+
</system>
|
27 |
+
</children>
|
28 |
+
</admin>
|
29 |
+
</resources>
|
30 |
+
</acl>
|
31 |
+
</config>
|
app/code/community/DD/Upload/etc/config.xml
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<!--
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Upload
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
-->
|
10 |
+
|
11 |
+
<config>
|
12 |
+
<modules>
|
13 |
+
<DD_Upload>
|
14 |
+
<version>0.1.0</version>
|
15 |
+
</DD_Upload>
|
16 |
+
</modules>
|
17 |
+
|
18 |
+
<default>
|
19 |
+
<generalsettings>
|
20 |
+
<configuration>
|
21 |
+
<upload_filesize>3</upload_filesize>
|
22 |
+
<maxuploadlimit>3</maxuploadlimit>
|
23 |
+
</configuration>
|
24 |
+
</generalsettings>
|
25 |
+
</default>
|
26 |
+
<frontend>
|
27 |
+
<routers>
|
28 |
+
<upload>
|
29 |
+
<use>standard</use>
|
30 |
+
<args>
|
31 |
+
<module>DD_Upload</module>
|
32 |
+
<frontName>upload</frontName>
|
33 |
+
</args>
|
34 |
+
</upload>
|
35 |
+
</routers>
|
36 |
+
<layout>
|
37 |
+
<updates>
|
38 |
+
<upload>
|
39 |
+
<file>upload.xml</file>
|
40 |
+
</upload>
|
41 |
+
</updates>
|
42 |
+
</layout>
|
43 |
+
</frontend>
|
44 |
+
<global>
|
45 |
+
<models>
|
46 |
+
<upload>
|
47 |
+
<class>DD_Upload_Model</class>
|
48 |
+
<resourceModel>upload_mysql4</resourceModel>
|
49 |
+
</upload>
|
50 |
+
<upload_mysql4>
|
51 |
+
<class>DD_Upload_Model_Mysql4</class>
|
52 |
+
<entities>
|
53 |
+
<upload>
|
54 |
+
<table>quote_file</table>
|
55 |
+
</upload>
|
56 |
+
<order>
|
57 |
+
<table>order_file</table>
|
58 |
+
</order>
|
59 |
+
</entities>
|
60 |
+
</upload_mysql4>
|
61 |
+
</models>
|
62 |
+
<helpers>
|
63 |
+
<upload>
|
64 |
+
<class>DD_Upload_Helper</class>
|
65 |
+
</upload>
|
66 |
+
</helpers>
|
67 |
+
<resources>
|
68 |
+
<upload_setup>
|
69 |
+
<setup>
|
70 |
+
<module>DD_Upload</module>
|
71 |
+
</setup>
|
72 |
+
<connection>
|
73 |
+
<use>core_setup</use>
|
74 |
+
</connection>
|
75 |
+
</upload_setup>
|
76 |
+
<upload_write>
|
77 |
+
<connection>
|
78 |
+
<use>core_write</use>
|
79 |
+
</connection>
|
80 |
+
</upload_write>
|
81 |
+
<upload_read>
|
82 |
+
<connection>
|
83 |
+
<use>core_read</use>
|
84 |
+
</connection>
|
85 |
+
</upload_read>
|
86 |
+
</resources>
|
87 |
+
<events>
|
88 |
+
<sales_quote_save_after>
|
89 |
+
<observers>
|
90 |
+
<sales_quote_save_after_handler>
|
91 |
+
<type>singleton</type>
|
92 |
+
<class>upload/observer</class>
|
93 |
+
<method>saveQuoteAfter</method>
|
94 |
+
</sales_quote_save_after_handler>
|
95 |
+
</observers>
|
96 |
+
</sales_quote_save_after>
|
97 |
+
|
98 |
+
<sales_order_place_after>
|
99 |
+
<observers>
|
100 |
+
<checkout_submit_all_after_handler>
|
101 |
+
<type>singleton</type>
|
102 |
+
<class>upload/observer</class>
|
103 |
+
<method>placeOrderAfter</method>
|
104 |
+
</checkout_submit_all_after_handler>
|
105 |
+
</observers>
|
106 |
+
</sales_order_place_after>
|
107 |
+
</events>
|
108 |
+
</global>
|
109 |
+
<admin>
|
110 |
+
<routers>
|
111 |
+
<upload>
|
112 |
+
<use>admin</use>
|
113 |
+
<args>
|
114 |
+
<module>DD_Upload</module>
|
115 |
+
<frontName>admin_upload</frontName>
|
116 |
+
</args>
|
117 |
+
</upload>
|
118 |
+
</routers>
|
119 |
+
</admin>
|
120 |
+
<adminhtml>
|
121 |
+
<layout>
|
122 |
+
<updates>
|
123 |
+
<upload>
|
124 |
+
<file>upload.xml</file>
|
125 |
+
</upload>
|
126 |
+
</updates>
|
127 |
+
</layout>
|
128 |
+
</adminhtml>
|
129 |
+
</config>
|
app/code/community/DD/Upload/etc/system.xml
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
* Dynamic Dreamz
|
4 |
+
* @category DD
|
5 |
+
* @package DD_Upload
|
6 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<tabs>
|
11 |
+
<dd_cartfileupload translate="label" module="upload">
|
12 |
+
<label>DD_Cart_FileUpload</label>
|
13 |
+
<sort_order>0</sort_order>
|
14 |
+
</dd_cartfileupload>
|
15 |
+
</tabs>
|
16 |
+
<sections>
|
17 |
+
<generalsettings translate="label" module="upload">
|
18 |
+
<label>General Settings </label>
|
19 |
+
<tab>dd_cartfileupload</tab>
|
20 |
+
<frontend_type>text</frontend_type>
|
21 |
+
<sort_order>0</sort_order>
|
22 |
+
<show_in_default>1</show_in_default>
|
23 |
+
<show_in_website>1</show_in_website>
|
24 |
+
<show_in_store>1</show_in_store>
|
25 |
+
<groups>
|
26 |
+
<configuration translate="label">
|
27 |
+
<label>Configuration</label>
|
28 |
+
<frontend_type>text</frontend_type>
|
29 |
+
<sort_order>0</sort_order>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>1</show_in_website>
|
32 |
+
<show_in_store>1</show_in_store>
|
33 |
+
<fields>
|
34 |
+
<enable_module translate="label">
|
35 |
+
<label>Enable Module</label>
|
36 |
+
<frontend_type>select</frontend_type>
|
37 |
+
<sort_order>0</sort_order>
|
38 |
+
<show_in_default>1</show_in_default>
|
39 |
+
<show_in_website>1</show_in_website>
|
40 |
+
<show_in_store>1</show_in_store>
|
41 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
42 |
+
<comment>Enable/Disable Module</comment>
|
43 |
+
</enable_module>
|
44 |
+
<upload_filesize translate="label">
|
45 |
+
<label>Maximum Upload File Size</label>
|
46 |
+
<frontend_type>text</frontend_type>
|
47 |
+
<validate>validate-digits</validate>
|
48 |
+
<sort_order>1</sort_order>
|
49 |
+
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>1</show_in_website>
|
51 |
+
<show_in_store>1</show_in_store>
|
52 |
+
<comment>File size in Mb. eg. 3</comment>
|
53 |
+
</upload_filesize>
|
54 |
+
<maxuploadlimit translate="label">
|
55 |
+
<label>Upload maximum no of files</label>
|
56 |
+
<frontend_type>text</frontend_type>
|
57 |
+
<validate>validate-digits</validate>
|
58 |
+
<sort_order>2</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>1</show_in_store>
|
62 |
+
<comment></comment>
|
63 |
+
</maxuploadlimit>
|
64 |
+
</fields>
|
65 |
+
</configuration>
|
66 |
+
</groups>
|
67 |
+
</generalsettings>
|
68 |
+
</sections>
|
69 |
+
</config>
|
app/code/community/DD/Upload/sql/upload_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Dynamic Dreamz
|
5 |
+
* @category DD
|
6 |
+
* @package DD_Upload
|
7 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
9 |
+
*/
|
10 |
+
|
11 |
+
$installer = $this;
|
12 |
+
$installer->startSetup();
|
13 |
+
$installer->run(
|
14 |
+
"DROP TABLE IF EXISTS {$this->getTable('quote_file')};
|
15 |
+
CREATE TABLE {$this->getTable('quote_file')} (
|
16 |
+
`id` int(11) unsigned NOT NULL auto_increment,
|
17 |
+
`quote_id` varchar(255) NOT NULL default '',
|
18 |
+
`filename` varchar(255) NOT NULL default '',
|
19 |
+
`type` varchar(255) NOT NULL default '',
|
20 |
+
PRIMARY KEY (`id`)
|
21 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
22 |
+
|
23 |
+
DROP TABLE IF EXISTS {$this->getTable('order_file')};
|
24 |
+
CREATE TABLE {$this->getTable('order_file')} (
|
25 |
+
`id` int(11) unsigned NOT NULL auto_increment,
|
26 |
+
`order_id` varchar(255) NOT NULL default '',
|
27 |
+
`filename` varchar(255) NOT NULL default '',
|
28 |
+
`type` varchar(255) NOT NULL default '',
|
29 |
+
PRIMARY KEY (`id`)
|
30 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
31 |
+
);
|
32 |
+
|
33 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/upload.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
* Dynamic Dreamz
|
4 |
+
* @category design
|
5 |
+
* @package default_default
|
6 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
8 |
+
-->
|
9 |
+
<layout version="0.1.0">
|
10 |
+
<adminhtml_sales_order_view>
|
11 |
+
<reference name="order_info">
|
12 |
+
<action method='setTemplate'><template>upload/sales/order/view/info.phtml</template></action>
|
13 |
+
<block type="adminhtml/sales_order_view_info" name="order_info_main" template="sales/order/view/info.phtml"></block>
|
14 |
+
<block type="adminhtml/sales_order_view" name="uploadfile" template='upload/sales/order/view/uploadfile.phtml'/>
|
15 |
+
</reference>
|
16 |
+
</adminhtml_sales_order_view>
|
17 |
+
</layout>
|
app/design/adminhtml/default/default/template/upload/sales/order/view/info.phtml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--
|
2 |
+
* Dynamic Dreamz
|
3 |
+
* @category design
|
4 |
+
* @package default_default
|
5 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
7 |
+
-->
|
8 |
+
|
9 |
+
<?php echo $this->getChildHtml('order_info_main');?>
|
10 |
+
<?php echo $this->getChildHtml('uploadfile');?>
|
app/design/adminhtml/default/default/template/upload/sales/order/view/uploadfile.phtml
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--
|
2 |
+
* Dynamic Dreamz
|
3 |
+
* @category design
|
4 |
+
* @package default_default
|
5 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
7 |
+
-->
|
8 |
+
|
9 |
+
|
10 |
+
<!--uploaded file Information-->
|
11 |
+
<?php $_order = $this->getOrder() ?>
|
12 |
+
<?php
|
13 |
+
$enable = Mage::getStoreConfig("generalsettings/configuration/enable_module");
|
14 |
+
if ($enable) {
|
15 |
+
?>
|
16 |
+
<div class="clear">
|
17 |
+
<div class="entry-edit">
|
18 |
+
<div class="entry-edit-head">
|
19 |
+
<h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Uploaded File Information') ?></h4>
|
20 |
+
<div class="tools"><?php echo $this->getAccountEditLink() ?></div>
|
21 |
+
</div>
|
22 |
+
<div class="fieldset">
|
23 |
+
<div class="hor-scroll">
|
24 |
+
<table cellspacing="0" class="form-list">
|
25 |
+
<?php
|
26 |
+
try {
|
27 |
+
$collection = Mage::getModel('upload/order')->getFiles($_order);
|
28 |
+
if (count($collection->getData()) > 0) {
|
29 |
+
?>
|
30 |
+
<tr>
|
31 |
+
<td class="label"><label><strong><?php echo Mage::helper('sales')->__('File Type') ?></strong></label></td>
|
32 |
+
<td class="label"><label><strong><?php echo Mage::helper('sales')->__('Thumbnail') ?></strong></label></td>
|
33 |
+
<td class="label"><label><strong><?php echo Mage::helper('sales')->__('File Name') ?></strong></label></td>
|
34 |
+
</tr>
|
35 |
+
<?php
|
36 |
+
$url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads';
|
37 |
+
$path = Mage::getBaseDir('media') . DS . 'uploads';
|
38 |
+
?>
|
39 |
+
<?php foreach ($collection as $data): ?>
|
40 |
+
<tr>
|
41 |
+
<td class="value"><label><?php echo $data['type'] ?></label></td>
|
42 |
+
<?php
|
43 |
+
$_ext = pathinfo($data['filename'], PATHINFO_EXTENSION);
|
44 |
+
if ($_ext == 'jpeg' || $_ext == 'jpg' || $_ext == 'png' || $_ext == 'ico' || $_ext == 'gif') {
|
45 |
+
if (file_exists($path . $data['filename'])) {
|
46 |
+
?>
|
47 |
+
<td class="value"><a href="<?php echo $url . $data['filename']; ?>" target="_blank"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads' . $data['filename']; ?>" height="35" width="40"></a></td>
|
48 |
+
<?php } else { ?>
|
49 |
+
<td class="value"><a href="<?php echo $url . $data['filename']; ?>" target="_blank"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads' . DS . 'icons/default.png'; ?>" height="40" width="45"></a></td>
|
50 |
+
<?php
|
51 |
+
}
|
52 |
+
} else {
|
53 |
+
?>
|
54 |
+
<td class="value">
|
55 |
+
<a href="<?php echo $url . $data['filename']; ?>" target="_blank">
|
56 |
+
<?php if (Mage::helper('upload')->checkFileType($_ext) == 'Unknown') { ?>
|
57 |
+
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads' . DS . 'icons/unknown.png'; ?>" height="40" width="45">
|
58 |
+
<?php } else if (!file_exists($path . $data['filename'])) { ?>
|
59 |
+
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads' . DS . 'icons/missing.png'; ?>" height="40" width="45">
|
60 |
+
<?php } else { ?>
|
61 |
+
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads' . DS . 'icons/' . $_ext . '.png'; ?>" height="40" width="45">
|
62 |
+
<?php } ?>
|
63 |
+
</a>
|
64 |
+
</td>
|
65 |
+
<?php } ?>
|
66 |
+
<?php if (file_exists($path . $data['filename'])) { ?>
|
67 |
+
<td class="value"><a href="<?php echo $url . $data['filename']; ?>" target="_blank"><strong><?php echo $data['filename']; ?></strong></a></td>
|
68 |
+
<?php } else { ?>
|
69 |
+
<td class="value">
|
70 |
+
<a href="#"><strong><?php echo $data['filename']; ?></strong></a>
|
71 |
+
<i><?php echo $this->__(' ( File no longer exists )'); ?></i>
|
72 |
+
</td>
|
73 |
+
|
74 |
+
<?php } ?>
|
75 |
+
</tr>
|
76 |
+
<?php endforeach; ?>
|
77 |
+
<?php } else { ?>
|
78 |
+
<tr>
|
79 |
+
<td class="value"><?php echo $this->__('There is no file uploaded for this order') ?></td>
|
80 |
+
</tr>
|
81 |
+
<?php
|
82 |
+
}
|
83 |
+
} catch (Exception $e) {
|
84 |
+
Mage::log($e->getMessage());
|
85 |
+
}
|
86 |
+
?>
|
87 |
+
</table>
|
88 |
+
</div>
|
89 |
+
</div>
|
90 |
+
</div>
|
91 |
+
</div>
|
92 |
+
<?php } ?>
|
app/design/frontend/base/default/layout/upload.xml
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
* Dynamic Dreamz
|
4 |
+
* @category design
|
5 |
+
* @package base_default
|
6 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
8 |
+
-->
|
9 |
+
<layout version="0.1.0">
|
10 |
+
<checkout_cart_index>
|
11 |
+
<reference name="content">
|
12 |
+
<reference name="checkout.cart">
|
13 |
+
<action method="setTemplate">
|
14 |
+
<template>upload/checkout/uploads.phtml</template>
|
15 |
+
</action>
|
16 |
+
<block type="checkout/cart" name="cart_main" template="checkout/cart.phtml">
|
17 |
+
<action method="setEmptyTemplate">
|
18 |
+
<value>checkout/cart/noItems.phtml</value>
|
19 |
+
</action>
|
20 |
+
<!--<action method="chooseTemplate"/>-->
|
21 |
+
<action method="addItemRender">
|
22 |
+
<type>simple</type>
|
23 |
+
<block>checkout/cart_item_renderer</block>
|
24 |
+
<template>checkout/cart/item/default.phtml</template>
|
25 |
+
</action>
|
26 |
+
<action method="addItemRender">
|
27 |
+
<type>grouped</type>
|
28 |
+
<block>checkout/cart_item_renderer_grouped</block>
|
29 |
+
<template>checkout/cart/item/default.phtml</template>
|
30 |
+
</action>
|
31 |
+
<action method="addItemRender">
|
32 |
+
<type>configurable</type>
|
33 |
+
<block>checkout/cart_item_renderer_configurable</block>
|
34 |
+
<template>checkout/cart/item/default.phtml</template>
|
35 |
+
</action>
|
36 |
+
|
37 |
+
<block type="core/text_list" name="checkout.cart.empty.widget" as="checkout_cart_empty_widget" translate="label">
|
38 |
+
<label>Empty Shopping Cart Content Before</label>
|
39 |
+
</block>
|
40 |
+
|
41 |
+
<block type="core/text_list" name="checkout.cart.top_methods" as="top_methods" translate="label">
|
42 |
+
<label>Payment Methods Before Checkout Button</label>
|
43 |
+
<block type="checkout/onepage_link" name="checkout.cart.methods.onepage.top" template="checkout/onepage/link.phtml" after="-" />
|
44 |
+
</block>
|
45 |
+
|
46 |
+
<block type="page/html_wrapper" name="checkout.cart.form.before" as="form_before" translate="label">
|
47 |
+
<label>Shopping Cart Items Before</label>
|
48 |
+
</block>
|
49 |
+
|
50 |
+
<block type="core/text_list" name="checkout.cart.methods" as="methods" translate="label">
|
51 |
+
<label>Payment Methods After Checkout Button</label>
|
52 |
+
<block type="checkout/onepage_link" name="checkout.cart.methods.onepage.bottom" template="checkout/onepage/link.phtml"/>
|
53 |
+
<block type="checkout/multishipping_link" name="checkout.cart.methods.multishipping" template="checkout/multishipping/link.phtml"/>
|
54 |
+
</block>
|
55 |
+
|
56 |
+
<block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>
|
57 |
+
<block type="core/text_list" name="checkout.cart.extra" translate="label">
|
58 |
+
<label>Checkout Forms Extra</label>
|
59 |
+
</block>
|
60 |
+
<block type="checkout/cart_shipping" name="checkout.cart.shipping" as="shipping" template="checkout/cart/shipping.phtml"/>
|
61 |
+
<block type="core/text_list" name="checkout.cart.widget" as="checkout_cart_widget" translate="label">
|
62 |
+
<label>Shopping Cart Items After</label>
|
63 |
+
</block>
|
64 |
+
<block type="checkout/cart_crosssell" name="checkout.cart.crosssell" as="crosssell" template="checkout/cart/crosssell.phtml"/>
|
65 |
+
|
66 |
+
<block type="checkout/cart_totals" name="checkout.cart.totals" as="totals" template="checkout/cart/totals.phtml"/>
|
67 |
+
</block>
|
68 |
+
|
69 |
+
</reference>
|
70 |
+
</reference>
|
71 |
+
</checkout_cart_index>
|
72 |
+
|
73 |
+
<sales_order_view>
|
74 |
+
<reference name="sales.order.info">
|
75 |
+
<action method="setTemplate">
|
76 |
+
<template>upload/sales/order/info.phtml</template>
|
77 |
+
</action>
|
78 |
+
</reference>
|
79 |
+
</sales_order_view>
|
80 |
+
</layout>
|
app/design/frontend/base/default/template/upload/checkout/uploads.phtml
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--
|
2 |
+
* Dynamic Dreamz
|
3 |
+
* @category design
|
4 |
+
* @package base_default
|
5 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
7 |
+
-->
|
8 |
+
<?php echo $this->getChildHtml('cart_main'); ?>
|
9 |
+
<?php $enable = Mage::getStoreConfig("generalsettings/configuration/enable_module"); ?>
|
10 |
+
<?php if ($enable) { ?>
|
11 |
+
<div class="custom-upload-cart">
|
12 |
+
<div class="custom-cart">
|
13 |
+
<div class="dd_upload">
|
14 |
+
<link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl("css/upload/upload.css") ?>">
|
15 |
+
<form action="<?php echo Mage::getUrl('upload/index/upload') ?>" method="post" enctype="multipart/form-data">
|
16 |
+
<table class="upload-002">
|
17 |
+
<tr class="first last">
|
18 |
+
<td class="a-right cart-footer-actions last">
|
19 |
+
<span class="left-site002"><input id="file_upload" type="file" name="file" class="" /></span>
|
20 |
+
<input id="file_upload_path" type="hidden" name="file_upload_path" class='required-entry' />
|
21 |
+
<input type="hidden" value='billing_file' name="file_upload_type" class='required-entry' />
|
22 |
+
<span class="right-site002"><input type="submit" value="Upload File" name="submit" class="button btn-upload"></span>
|
23 |
+
</td>
|
24 |
+
</tr>
|
25 |
+
</table>
|
26 |
+
</form>
|
27 |
+
<?php
|
28 |
+
try {
|
29 |
+
$quote_id = Mage::getSingleton('checkout/session')->getQuoteId();
|
30 |
+
$collection = Mage::getModel('upload/upload')->getCurrentUploadedFiles($quote_id);
|
31 |
+
?>
|
32 |
+
<form action="<?php echo Mage::getUrl('upload/index/massDelete') ?>" method="post" enctype="multipart/form-data">
|
33 |
+
<table class="dyanamic-table01">
|
34 |
+
<?php
|
35 |
+
$_flag = 0;
|
36 |
+
$imgUrl = '';
|
37 |
+
?>
|
38 |
+
<?php foreach ($collection as $data): ?>
|
39 |
+
<?php $_flag++; ?>
|
40 |
+
<?php $filepath = str_replace('/', '&', $data['filename']); ?>
|
41 |
+
<?php $filename = substr($data['filename'], strrpos($data['filename'], '/') + 1); ?>
|
42 |
+
<tr>
|
43 |
+
<td><input type="checkbox" name="files[<?php echo $data['id'] ?>]" class="" id=""></td>
|
44 |
+
<?php
|
45 |
+
$_ext = pathinfo($data['filename'], PATHINFO_EXTENSION);
|
46 |
+
if ($_ext == 'jpeg' || $_ext == 'jpg' || $_ext == 'png' || $_ext == 'ico' || $_ext == 'gif') {
|
47 |
+
?>
|
48 |
+
<td class="value-img"><a href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads' . $data['filename']; ?>" target="_blank"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads' . $data['filename']; ?>" height="35" width="40"></a></td>
|
49 |
+
<?php } else { ?>
|
50 |
+
<td class="value-img">
|
51 |
+
<a href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads' . $data['filename']; ?>" target="_blank">
|
52 |
+
<?php $fileType=Mage::helper('upload')->checkFileType($_ext);?>
|
53 |
+
<?php if ($fileType == 'Unknown') { ?>
|
54 |
+
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads' . DS . 'icons/unknown.png'; ?>" height="40" width="45">
|
55 |
+
<?php } else { ?>
|
56 |
+
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads' . DS . 'icons/' . $_ext . '.png'; ?>" height="40" width="45">
|
57 |
+
<?php } ?>
|
58 |
+
</a>
|
59 |
+
</td>
|
60 |
+
<?php } ?>
|
61 |
+
<td class="value"><a class="file-link" href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads' . $data['filename']; ?>" target="_blank" value=""><label><?php echo $filename; ?></label></a></td>
|
62 |
+
<td class="btn-remove3"><a class="btn-remove btn-remove2" href="<?php echo Mage::getUrl('upload/index/delete', array('id' => $data['id'], 'filename' => $filename, 'filepath' => $filepath)) ?>" title="Remove File"></a></td>
|
63 |
+
<?php endforeach; ?>
|
64 |
+
</tr>
|
65 |
+
<tr>
|
66 |
+
<?php if ($_flag > 0) { ?>
|
67 |
+
<td colspan="3" ><input class="remove_files button" id="remove_files" type="submit" value="Remove Files" name="submit"></td>
|
68 |
+
<td class="total_files"><?php echo $this->__("Total (".$_flag.") files.")?></td>
|
69 |
+
<?php } else { ?>
|
70 |
+
<!--<td colspan="3" align=""><input style="display: none" class="remove_files" id="remove_files" type="submit" value="Remove Files" name="submit"></td>-->
|
71 |
+
<td class="total_files0"colspan="4"><?php echo $this->__("Total (".$_flag.") files.")?></td>
|
72 |
+
<?php } ?>
|
73 |
+
</tr>
|
74 |
+
</table>
|
75 |
+
</form>
|
76 |
+
|
77 |
+
</div>
|
78 |
+
<?php
|
79 |
+
} catch (Exception $e) {
|
80 |
+
Mage::getSingleton("core/session")->addError("Opps..Some Error Occured...!!!");
|
81 |
+
Mage::log($e->getMessage());
|
82 |
+
}
|
83 |
+
?>
|
84 |
+
</div>
|
85 |
+
</div>
|
86 |
+
<?php
|
87 |
+
}
|
88 |
+
?>
|
app/design/frontend/base/default/template/upload/sales/order/info.phtml
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--
|
2 |
+
* Dynamic Dreamz
|
3 |
+
* @category design
|
4 |
+
* @package base_default
|
5 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
7 |
+
-->
|
8 |
+
|
9 |
+
<?php /** @var $this Mage_Sales_Block_Order_Info */ ?>
|
10 |
+
<?php $_order = $this->getOrder() ?>
|
11 |
+
<?php echo $this->getMessagesBlock()->toHtml() ?>
|
12 |
+
<div class="page-title title-buttons">
|
13 |
+
<h1><?php echo $this->__('Order #%s - %s', $_order->getRealOrderId(), $_order->getStatusLabel()) ?></h1>
|
14 |
+
<?php echo $this->getChildHtml('buttons') ?>
|
15 |
+
</div>
|
16 |
+
<?php echo $this->getStatusHistoryRssUrl($_order) ?>
|
17 |
+
<dl class="order-info">
|
18 |
+
<dt><?php echo $this->__('About This Order:') ?></dt>
|
19 |
+
<dd>
|
20 |
+
<?php $_links = $this->getLinks(); ?>
|
21 |
+
<ul id="order-info-tabs">
|
22 |
+
<?php foreach ($_links as $_link): ?>
|
23 |
+
<?php if ($_link->getUrl()): ?>
|
24 |
+
<li><a href="<?php echo $_link->getUrl() ?>"><?php echo $_link->getLabel() ?></a></li>
|
25 |
+
<?php else: ?>
|
26 |
+
<li class="current"><?php echo $_link->getLabel() ?></li>
|
27 |
+
<?php endif; ?>
|
28 |
+
<?php endforeach; ?>
|
29 |
+
</ul>
|
30 |
+
<script type="text/javascript">decorateGeneric($('order-info-tabs').select('LI'), ['first', 'last']);</script>
|
31 |
+
</dd>
|
32 |
+
</dl>
|
33 |
+
<p class="order-date"><?php echo $this->__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?></p>
|
34 |
+
<?php if (!$_order->getIsVirtual()): ?>
|
35 |
+
<div class="col2-set order-info-box">
|
36 |
+
<div class="col-1">
|
37 |
+
<div class="box">
|
38 |
+
<div class="box-title">
|
39 |
+
<h2><?php echo $this->__('Shipping Address') ?></h2>
|
40 |
+
</div>
|
41 |
+
<div class="box-content">
|
42 |
+
<address><?php echo $_order->getShippingAddress()->format('html') ?></address>
|
43 |
+
</div>
|
44 |
+
</div>
|
45 |
+
</div>
|
46 |
+
<div class="col-2">
|
47 |
+
<div class="box">
|
48 |
+
<div class="box-title">
|
49 |
+
<h2><?php echo $this->__('Shipping Method') ?></h2>
|
50 |
+
</div>
|
51 |
+
<div class="box-content">
|
52 |
+
<?php if ($_order->getShippingDescription()): ?>
|
53 |
+
<?php echo $this->escapeHtml($_order->getShippingDescription()) ?>
|
54 |
+
<?php else: ?>
|
55 |
+
<p><?php echo $this->helper('sales')->__('No shipping information available'); ?></p>
|
56 |
+
<?php endif; ?>
|
57 |
+
</div>
|
58 |
+
</div>
|
59 |
+
</div>
|
60 |
+
</div>
|
61 |
+
<?php endif; ?>
|
62 |
+
<div class="col2-set order-info-box">
|
63 |
+
<div class="col-1">
|
64 |
+
<div class="box">
|
65 |
+
<div class="box-title">
|
66 |
+
<h2><?php echo $this->__('Billing Address') ?></h2>
|
67 |
+
</div>
|
68 |
+
<div class="box-content">
|
69 |
+
<address><?php echo $_order->getBillingAddress()->format('html') ?></address>
|
70 |
+
</div>
|
71 |
+
</div>
|
72 |
+
</div>
|
73 |
+
<div class="col-2">
|
74 |
+
<div class="box box-payment">
|
75 |
+
<div class="box-title">
|
76 |
+
<h2><?php echo $this->__('Payment Method') ?></h2>
|
77 |
+
</div>
|
78 |
+
<div class="box-content">
|
79 |
+
<?php echo $this->getPaymentInfoHtml() ?>
|
80 |
+
</div>
|
81 |
+
</div>
|
82 |
+
</div>
|
83 |
+
</div>
|
84 |
+
<?php
|
85 |
+
$enable = Mage::getStoreConfig("generalsettings/configuration/enable_module");
|
86 |
+
if ($enable) {
|
87 |
+
?>
|
88 |
+
<link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl("css/upload/upload.css") ?>">
|
89 |
+
<div class="col1-set order-info-box fileupload">
|
90 |
+
<div class="box-title">
|
91 |
+
<h2><?php echo $this->__('Uploaded File Information') ?></h2>
|
92 |
+
</div>
|
93 |
+
<div class="box-content">
|
94 |
+
<div class="cart-fileupload">
|
95 |
+
<table class="fileupload-table">
|
96 |
+
<?php
|
97 |
+
try {
|
98 |
+
$collection = Mage::getModel('upload/order')->getFiles($_order);
|
99 |
+
if (count($collection->getData()) > 0) {
|
100 |
+
?>
|
101 |
+
<tr>
|
102 |
+
<td class="head-label"><strong><label><?php echo Mage::helper('sales')->__('File Type') ?></label></strong></td>
|
103 |
+
<td class="head-label"><strong><label><?php echo Mage::helper('sales')->__('Thumbnail') ?></label></strong></td>
|
104 |
+
<td class="head-label"><strong><label><?php echo Mage::helper('sales')->__('File Name') ?></label></strong></td>
|
105 |
+
</tr>
|
106 |
+
<?php
|
107 |
+
$url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads';
|
108 |
+
$path = Mage::getBaseDir('media') . DS . 'uploads';
|
109 |
+
?>
|
110 |
+
<?php foreach ($collection as $data): ?>
|
111 |
+
<?php $filepath = str_replace('/', '&', $data['filename']); ?>
|
112 |
+
<?php $file_name = substr($data['filename'], strrpos($data['filename'], '/') + 1); ?>
|
113 |
+
<tr>
|
114 |
+
<?php //?>
|
115 |
+
<td class="upload-label"><label><strong><?php echo $data['type'] ?></strong></label></td>
|
116 |
+
<?php
|
117 |
+
$_ext = pathinfo($data['filename'], PATHINFO_EXTENSION);
|
118 |
+
if ($_ext == 'jpeg' || $_ext == 'jpg' || $_ext == 'png' || $_ext == 'ico' || $_ext == 'gif') {
|
119 |
+
if (file_exists($path . $data['filename'])) {
|
120 |
+
?>
|
121 |
+
<td class="upload-value"><a href="<?php echo $url . $data['filename']; ?>" target="_blank"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads' . $data['filename']; ?>" height="35" width="40"></a></td>
|
122 |
+
<?php } else { ?>
|
123 |
+
<td class="upload-value"><a href="<?php echo $url . $data['filename']; ?>" target="_blank"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads' . DS . 'icons/default.png'; ?>" height="40" width="45"></a></td>
|
124 |
+
<?php
|
125 |
+
}
|
126 |
+
} else {
|
127 |
+
?>
|
128 |
+
<td class="upload-value">
|
129 |
+
<a href="<?php echo $url . $data['filename']; ?>" target="_blank">
|
130 |
+
<?php if (Mage::helper('upload')->checkFileType($_ext) == 'Unknown') { ?>
|
131 |
+
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads' . DS . 'icons/unknown.png'; ?>" height="40" width="45">
|
132 |
+
<?php } else if (!file_exists($path . $data['filename'])) { ?>
|
133 |
+
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads' . DS . 'icons/missing.png'; ?>" height="40" width="45">
|
134 |
+
<?php } else { ?>
|
135 |
+
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'uploads' . DS . 'icons/' . $_ext . '.png'; ?>" height="40" width="45">
|
136 |
+
<?php } ?>
|
137 |
+
</a>
|
138 |
+
</td>
|
139 |
+
<?php } ?>
|
140 |
+
<?php if (file_exists($path . $data['filename'])) { ?>
|
141 |
+
<td class="upload-value"><a href="<?php echo $url . $data['filename']; ?>" target="_blank"><?php echo $file_name; ?></a></td>
|
142 |
+
<?php } else { ?>
|
143 |
+
<td class="upload-value">
|
144 |
+
<a href="#"><?php echo $file_name; ?></a>
|
145 |
+
<label><strong><i><?php echo $this->__(' ( File no longer exists )'); ?></i></strong></label>
|
146 |
+
</td>
|
147 |
+
|
148 |
+
<?php } ?>
|
149 |
+
</tr>
|
150 |
+
<?php endforeach; ?>
|
151 |
+
<?php } else { ?>
|
152 |
+
<tr>
|
153 |
+
<td class="upload-value"><?php echo $this->__('There is no file uploaded for this order') ?></td>
|
154 |
+
</tr>
|
155 |
+
<?php
|
156 |
+
}
|
157 |
+
} catch (Exception $e) {
|
158 |
+
Mage::log($e->getMessage());
|
159 |
+
}
|
160 |
+
?>
|
161 |
+
</table>
|
162 |
+
</div>
|
163 |
+
</div>
|
164 |
+
</div>
|
165 |
+
<?php } ?>
|
app/etc/modules/DD_Upload.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<DD_Upload>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<version>0.1.0</version>
|
8 |
+
</DD_Upload>
|
9 |
+
</modules>
|
10 |
+
</config>
|
cart_fileupload_features.odt
ADDED
Binary file
|
cart_fileupload_manual.docx
ADDED
Binary file
|
media/uploads/icons/csv.png
ADDED
Binary file
|
media/uploads/icons/csv2.png
ADDED
Binary file
|
media/uploads/icons/default.png
ADDED
Binary file
|
media/uploads/icons/doc.png
ADDED
Binary file
|
media/uploads/icons/docx.png
ADDED
Binary file
|
media/uploads/icons/error4.jpg
ADDED
Binary file
|
media/uploads/icons/missing.png
ADDED
Binary file
|
media/uploads/icons/missing1.png
ADDED
Binary file
|
media/uploads/icons/ods.png
ADDED
Binary file
|
media/uploads/icons/odt.png
ADDED
Binary file
|
media/uploads/icons/odt2.png
ADDED
Binary file
|
media/uploads/icons/pdf.png
ADDED
Binary file
|
media/uploads/icons/pptx.png
ADDED
Binary file
|
media/uploads/icons/txt.png
ADDED
Binary file
|
media/uploads/icons/unknown.png
ADDED
Binary file
|
media/uploads/icons/unknown1.png
ADDED
Binary file
|
media/uploads/icons/unkown2.png
ADDED
Binary file
|
media/uploads/icons/xls.png
ADDED
Binary file
|
media/uploads/icons/xml.png
ADDED
Binary file
|
package.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Cart_Fileupload</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Customer can upload multiple files on cart page according to their needs and admin can see the uploaded files in order view page.</summary>
|
10 |
+
<description>Would you like to give your customer an option to upload Files or Images at cart page? then this extension is for you. This extension provide facility to upload multiple files on cart page. Customer can browse and upload files easily which will be stored in database with their order details. 
|
11 |
+

|
12 |
+
1. This extension gives the facility to upload multiple files on cart page.
|
13 |
+

|
14 |
+
2. Customers can upload multiple types of files like image, text, document, PDF etc.
|
15 |
+

|
16 |
+
3. Customers can easily edit and delete the file(s) as per their custom requirements.
|
17 |
+

|
18 |
+
4. Standard settings for maximum file size and number of files to be uploaded in Admin.
|
19 |
+

|
20 |
+
5. All uploaded files by the customer on cart page for the particular order will show on “order view page” in admin section and as well as it'll show on frontend in “My Orders” section of customer account. 
|
21 |
+

|
22 |
+
6. A separate section in “order view page” for uploading files.
|
23 |
+

|
24 |
+
7. File Sorting is possible because of listing of files with their types, names and thumbnails.
|
25 |
+

|
26 |
+
8. By clicking particular file name or thumbnail admin can access it quickly in new tab.
|
27 |
+

|
28 |
+
9. Compatible with all Magento versions from 1.4 to 1.9.</description>
|
29 |
+
<notes>It is stable version</notes>
|
30 |
+
<authors><author><name>Dynamic Dreamz</name><user>dynamic_dreamz</user><email>info@dynamicdreamz.com</email></author></authors>
|
31 |
+
<date>2015-09-24</date>
|
32 |
+
<time>13:00:59</time>
|
33 |
+
<contents><target name="magecommunity"><dir name="DD"><dir name="Upload"><dir name="Block"><file name="Upload.php" hash="7fc82b99d7f74e36f70e65f18649a7c3"/></dir><dir name="Helper"><file name="Data.php" hash="3f301aec612844a79d5000f24090fd2a"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Order"><file name="Collection.php" hash="4433076a1aa37c0927b0922d3447724f"/></dir><file name="Order.php" hash="e6fff2603115270ea274235aec21dc7d"/><dir name="Upload"><file name="Collection.php" hash="c53e84b113fc62a9ed26023a1f213220"/></dir><file name="Upload.php" hash="8b2f88d113854ad6c25173c0aa319ca5"/></dir><file name="Observer.php" hash="5320919948945035196de4328d2d1fe0"/><file name="Order.php" hash="65ca9ab6e0035b4f4a1b2f72ce10732e"/><file name="Upload.php" hash="6302a8ba4850a97f5eae78da46d17caf"/></dir><dir name="controllers"><file name="IndexController.php" hash="2c55a20ee9d73f832213bc78ad9d3a7a"/></dir><dir name="etc"><file name="adminhtml.xml" hash="ffc0ef8a617de02356a817e1c7ff6920"/><file name="config.xml" hash="efef5ae67d9397e393eb914c566a7afb"/><file name="system.xml" hash="395b8bd0e38d4dfe96833d3b34dcd25a"/></dir><dir name="sql"><dir name="upload_setup"><file name="mysql4-install-0.1.0.php" hash="d811f00387fab3238b1992a58303c614"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="upload"><dir name="sales"><dir name="order"><dir name="view"><file name="info.phtml" hash="ede3cf763b77ff6960b93d71877161c1"/><file name="uploadfile.phtml" hash="67c193b3f21085ffd848ecdbf9fed62e"/></dir></dir></dir></dir></dir><dir name="layout"><file name="upload.xml" hash="81aeb92327bad124a25e014981ffdb4c"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="upload"><dir name="checkout"><file name="uploads.phtml" hash="c92e1e71a8620e283f6af81772672acd"/></dir><dir name="sales"><dir name="order"><file name="info.phtml" hash="78fc1fcd26257f0b16cec5910a10c7d3"/></dir></dir></dir></dir><dir name="layout"><file name="upload.xml" hash="754b8c8e6cbc95bdf28205da341c96eb"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="DD_Upload.xml" hash="ff112bd586d7e53d8db42f2865d35888"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="upload"><file name="upload.css" hash="5bc8d1572d731e85fa60a8120909df65"/></dir></dir></dir></dir></dir></target><target name="magemedia"><dir name="uploads"><dir name="icons"><file name="csv.png" hash="05602a994d5911c675abf7c8f37af763"/><file name="csv2.png" hash="8f6d50c8378ea10f961dc71bcb68c219"/><file name="default.png" hash="1a7a998b053b9397ff911624c3c14d37"/><file name="doc.png" hash="c8fb60063316dc015962021bce731d12"/><file name="docx.png" hash="d8410c4b56dc05dd4142667ed8ec8400"/><file name="error4.jpg" hash="d22c10dcd0da5e58e072a52fe7c0a57f"/><file name="missing.png" hash="fcbb8da751c7c1012d065528f46dd0fd"/><file name="missing1.png" hash="c03b474103ef9f81377556e7d99b8fbe"/><file name="ods.png" hash="edc457d897ef132f188e0ca43014e2b0"/><file name="odt.png" hash="041424c20b31491606a7fe0ca822b21c"/><file name="odt2.png" hash="9191ffe8b5f81ada7b48d0214cefb784"/><file name="pdf.png" hash="285fe75f2229f32aa240cdac26ca2958"/><file name="pptx.png" hash="70eb85ebddc8ff5e803a1d215fd84448"/><file name="txt.png" hash="d6ec5f8e962c7ffb7523314094b653fa"/><file name="unknown.png" hash="e87a7bf4a73d55c6a6c5377a71e7990f"/><file name="unknown1.png" hash="68cab465563cb8f931005815a76afe6d"/><file name="unkown2.png" hash="b5dad7d90ac05941a1472ad50f5a6d05"/><file name="xls.png" hash="a48a26cbd5153f72679d8d3a1fcdc8a5"/><file name="xml.png" hash="5fce69e918a098660dc4c802c5c27d4c"/></dir></dir></target><target name="mage"><dir name="."><file name="cart_fileupload_features.odt" hash="cc514483bba8f193df20f392a4cd6ce6"/><file name="cart_fileupload_manual.docx" hash="b04c89d168815bf7a96533ed3620810e"/></dir></target></contents>
|
34 |
+
<compatible/>
|
35 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.4.0.0</min><max>1.9</max></package><extension><name>gd</name><min>2.0.28</min><max>3.0</max></extension></required></dependencies>
|
36 |
+
</package>
|
skin/frontend/base/default/css/upload/upload.css
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Dynamic Dreamz
|
3 |
+
* @category design
|
4 |
+
* @package base_default
|
5 |
+
* @copyright Copyright (c) 2014-2015 Dynamic Dreamz. (http://www.dynamicdreamz.com/)
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL)
|
7 |
+
*/
|
8 |
+
|
9 |
+
.custom-upload-cart { display: inline-block; vertical-align: top; width: 100%; float:left;margin: 0 0 20px;}
|
10 |
+
.custom-upload-cart .cart-table { width: 100%; }
|
11 |
+
.custom-cart { display: inline-block; vertical-align: top; width: 100%;}
|
12 |
+
.dd_upload { border: 1px solid #ccc; display: block; padding: 8px;}
|
13 |
+
.dd_upload > form { border-bottom: 1px solid #ccc; padding:0 0 5px 0;}
|
14 |
+
|
15 |
+
.dyanamic-table01{ width:100%;}
|
16 |
+
.dyanamic-table01 td { padding: 7px 0;}
|
17 |
+
.dd_upload form + form{ border-bottom: 0;}
|
18 |
+
|
19 |
+
.upload-002{ width:100%;}
|
20 |
+
.left-site002{ float:left;}
|
21 |
+
.right-site002{ float:right;margin-right: 25px;}
|
22 |
+
|
23 |
+
.btn-upload{text-align:right;}
|
24 |
+
.total_files{text-align:center;}
|
25 |
+
.total_files0{text-align:left;}
|
26 |
+
.btn-remove3{text-align:center;}
|
27 |
+
.dd_upload{ background-color: #f4f4f4;}
|
28 |
+
.dyanamic-table01 tr{ border-bottom:1px solid #e6e6e6}
|
29 |
+
.dyanamic-table01 tr:last-child{border-bottom:0 none}
|
30 |
+
.dyanamic-table01 td{ width:3%;}
|
31 |
+
.dyanamic-table01 td + td{ width:7%;}
|
32 |
+
.dyanamic-table01 td + td +td{ width:78%;}
|
33 |
+
.dyanamic-table01 td + td +td+td{ width:12%;}
|
34 |
+
.remove_files {background: #ccc none repeat scroll 0 0;border-radius: 10px; margin: 13px 0 0;}
|
35 |
+
.dyanamic-table01 .value > label {vertical-align: top;}
|
36 |
+
.dyanamic-table01 .value-img > label {vertical-align: top;}
|
37 |
+
a.file-link label{ cursor:pointer;}
|
38 |
+
a:hover.file-link label{text-decoration:underline;}
|
39 |
+
|
40 |
+
|
41 |
+
@media only screen
|
42 |
+
and (min-device-width : 980px)
|
43 |
+
and (max-device-width : 1024px) {
|
44 |
+
|
45 |
+
.custom-upload-cart {
|
46 |
+
|
47 |
+
width: 100%;
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
51 |
+
|
52 |
+
@media only screen
|
53 |
+
and (min-device-width : 768px)
|
54 |
+
and (max-device-width : 979px) {
|
55 |
+
|
56 |
+
.custom-upload-cart {
|
57 |
+
|
58 |
+
width: 100%;
|
59 |
+
}
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
@media only screen and (max-width: 767px){
|
65 |
+
|
66 |
+
.custom-upload-cart { width: 100%;}
|
67 |
+
|
68 |
+
}
|
69 |
+
|
70 |
+
/******** 24-sep 2015 update ********/
|
71 |
+
.order-info-box .box-content { width: 60%;}
|
72 |
+
.order-info-box .box-content .fileupload-table td { padding:10px 15px 10px 0; width:25%; word-wrap: break-word;}
|
73 |
+
|