Version Notes
v1.1.1 - This version has removed some common product code into the community package 1.2.0
Download this release
Release Info
Developer | Michael |
Extension | AdvertiseRelatedProducts |
Version | 1.1.1 |
Comparing to | |
See all releases |
Code changes from version 1.1.0 to 1.1.1
- README.txt → README-Advertise-Related-Products.txt +1 -1
- app/code/community/Advertise/Dataexport/Block/Adminhtml/Dataexportbackend.php +0 -74
- app/code/community/Advertise/Dataexport/Block/Index.php +0 -5
- app/code/community/Advertise/Dataexport/Helper/Data.php +0 -8
- app/code/community/Advertise/Dataexport/Model/Config.php +0 -160
- app/code/community/Advertise/Dataexport/Model/Exporter.php +0 -168
- app/code/community/Advertise/Dataexport/Model/Exporter/Cart.php +0 -121
- app/code/community/Advertise/Dataexport/Model/Exporter/Customer.php +0 -58
- app/code/community/Advertise/Dataexport/Model/Exporter/Interface.php +0 -27
- app/code/community/Advertise/Dataexport/Model/Exporter/Order.php +0 -177
- app/code/community/Advertise/Dataexport/Model/Modelname.php +0 -12
- app/code/community/Advertise/Dataexport/Model/Mysql4/Modelname.php +0 -9
- app/code/community/Advertise/Dataexport/Model/Mysql4/Modelname/Collection.php +0 -9
- app/code/community/Advertise/Dataexport/Model/Orderstatus.php +0 -19
- app/code/community/Advertise/Dataexport/Model/Scheduler.php +0 -67
- app/code/community/Advertise/Dataexport/Model/Xmlwriter.php +0 -209
- app/code/community/Advertise/Dataexport/controllers/Adminhtml/DataexportbackendController.php +0 -78
- app/code/community/Advertise/Dataexport/controllers/IndexController.php +0 -41
- app/code/community/Advertise/Dataexport/controllers/TestController.php +0 -238
- app/code/community/Advertise/Dataexport/etc/adminhtml.xml +0 -43
- app/code/community/Advertise/Dataexport/etc/config.xml +0 -186
- app/code/community/Advertise/Dataexport/etc/system.xml +0 -137
- app/code/community/Advertise/Dataexport/sql/dataexport_setup/mysql4-install-0.1.0.php +0 -12
- app/code/community/Advertise/RelatedProducts/Block/Related.php +5 -0
- app/code/community/Advertise/RelatedProducts/Helper/Data.php +0 -89
- app/code/community/Advertise/RelatedProducts/controllers/RelatedProductsController.php +0 -9
- app/design/adminhtml/default/default/layout/dataexport.xml +0 -14
- app/design/adminhtml/default/default/template/dataexport/dataexportbackend.phtml +0 -142
- app/design/frontend/base/default/layout/advertiserelatedproducts.xml +4 -12
- app/design/frontend/base/default/layout/dataexport.xml +0 -12
- app/design/frontend/base/default/layout/local.xml +0 -18
- app/design/frontend/base/default/template/advertise/relatedproducts/related.phtml +0 -92
- app/design/frontend/base/default/template/dataexport/index.phtml +0 -8
- app/etc/modules/Advertise_Dataexport.xml +0 -10
- package.xml +7 -9
README.txt → README-Advertise-Related-Products.txt
RENAMED
@@ -16,4 +16,4 @@ Find the template file head.phtml used by your theme. You should find it in:
|
|
16 |
app/design/frontend/<theme-package>/<theme-name>/template/page/html
|
17 |
|
18 |
Add this script tag within the head:
|
19 |
-
<script type="text/javascript"><?php echo Mage::helper('
|
16 |
app/design/frontend/<theme-package>/<theme-name>/template/page/html
|
17 |
|
18 |
Add this script tag within the head:
|
19 |
+
<script type="text/javascript"><?php echo Mage::helper('advertise_retailintelligence')->getAdvertiseHeaderScript(); ?></script>
|
app/code/community/Advertise/Dataexport/Block/Adminhtml/Dataexportbackend.php
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Advertise_Dataexport_Block_Adminhtml_Dataexportbackend extends Mage_Adminhtml_Block_Template
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
* @var Advertise_Dataexport_Model_Config
|
7 |
-
*/
|
8 |
-
protected $_config;
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Get the config model
|
12 |
-
*
|
13 |
-
* @return Advertise_Dataexport_Model_Config
|
14 |
-
*/
|
15 |
-
protected function _getConfig()
|
16 |
-
{
|
17 |
-
if($this->_config === NULL) {
|
18 |
-
$this->_config = Mage::getModel('dataexport/config');
|
19 |
-
}
|
20 |
-
|
21 |
-
return $this->_config;
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Are the orders enabled
|
26 |
-
*
|
27 |
-
* @return string
|
28 |
-
*/
|
29 |
-
protected function _isOrdersEnabledText()
|
30 |
-
{
|
31 |
-
return $this->_getConfig()->isOrderExportEnabled() ? 'Enabled' : 'Disabled';
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Are the customers export enabled?
|
36 |
-
*
|
37 |
-
* @return string
|
38 |
-
*/
|
39 |
-
protected function _isCustomersEnabledText()
|
40 |
-
{
|
41 |
-
return $this->_getConfig()->isCustomerExportEnabled() ? 'Enabled' : 'Disabled';
|
42 |
-
}
|
43 |
-
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Are the customers export enabled?
|
47 |
-
*
|
48 |
-
* @return string
|
49 |
-
*/
|
50 |
-
protected function _isCartsEnabledText()
|
51 |
-
{
|
52 |
-
return $this->_getConfig()->isCartExportEnabled() ? 'Enabled' : 'Disabled';
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Is th emodule enabled??
|
57 |
-
*
|
58 |
-
* @return string
|
59 |
-
*/
|
60 |
-
protected function _isEnabled()
|
61 |
-
{
|
62 |
-
return $this->_getConfig()->getIsEnabled() ? 'Enabled' : 'Disabled';
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Get the form action
|
67 |
-
*
|
68 |
-
* @return string
|
69 |
-
*/
|
70 |
-
protected function _getFormAction()
|
71 |
-
{
|
72 |
-
return Mage::getUrl('*/*/export');
|
73 |
-
}
|
74 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/Block/Index.php
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Advertise_Dataexport_Block_Index extends Mage_Core_Block_Template
|
3 |
-
{
|
4 |
-
|
5 |
-
}
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/Helper/Data.php
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Data.php
|
4 |
-
*/
|
5 |
-
class Advertise_Dataexport_Helper_Data extends Mage_Core_Helper_Abstract
|
6 |
-
{
|
7 |
-
|
8 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/Model/Config.php
DELETED
@@ -1,160 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Config.php
|
4 |
-
*
|
5 |
-
* @package Dataexport
|
6 |
-
*/
|
7 |
-
class Advertise_Dataexport_Model_Config extends Varien_Object
|
8 |
-
{
|
9 |
-
/**
|
10 |
-
* Config keys
|
11 |
-
*/
|
12 |
-
const ENABLED = 'dataexport/dataexport_group/enabled';
|
13 |
-
const ENABLED_CRON = 'dataexport/dataexport_group/enabled_cron';
|
14 |
-
const EXPORT_URL = 'dataexport/dataexport_group/export_url';
|
15 |
-
const CUSTOMERS_ENABLED = 'dataexport/dataexport_group/export_customers';
|
16 |
-
const ORDERS_ENABLED = 'dataexport/dataexport_group/export_orders';
|
17 |
-
const ORDER_STATUS = 'dataexport/dataexport_group/order_status';
|
18 |
-
const CARTS_ENABLED = 'dataexport/dataexport_group/export_carts';
|
19 |
-
const ADVERTISE_EMAIL = 'advertise_settings/settings/settings_email';
|
20 |
-
|
21 |
-
// No need for this as use ORDERS_ENABLED for same thing
|
22 |
-
//const ENABLE_IDS_HEAD = 'dataexport/dataexport_group/export_productids';
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Is the module enabled?
|
26 |
-
*
|
27 |
-
* @return bool
|
28 |
-
*/
|
29 |
-
public function getIsEnabled()
|
30 |
-
{
|
31 |
-
return (bool) Mage::getStoreConfig(self::ENABLED);
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Is the module enabled?
|
36 |
-
*
|
37 |
-
* @return bool
|
38 |
-
*/
|
39 |
-
public function isCronEnabled()
|
40 |
-
{
|
41 |
-
return (bool) Mage::getStoreConfig(self::ENABLED_CRON);
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Do we want to output the product ids to the head of the doc?
|
46 |
-
*
|
47 |
-
* @return bool
|
48 |
-
*/
|
49 |
-
public function isHeadProductIdsEnabled()
|
50 |
-
{
|
51 |
-
//return (bool) Mage::getStoreConfig(self::ENABLE_IDS_HEAD);
|
52 |
-
return (bool) Mage::getStoreConfig(self::ORDERS_ENABLED);
|
53 |
-
}
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Customer exportr enabled?
|
57 |
-
*
|
58 |
-
* @return bool
|
59 |
-
*/
|
60 |
-
public function isCustomerExportEnabled()
|
61 |
-
{
|
62 |
-
return (bool) Mage::getStoreConfig(self::CUSTOMERS_ENABLED);
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* orders exportr enabled?
|
67 |
-
*
|
68 |
-
* @return bool
|
69 |
-
*/
|
70 |
-
public function isOrderExportEnabled()
|
71 |
-
{
|
72 |
-
return (bool) Mage::getStoreConfig(self::ORDERS_ENABLED);
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* cart exportr enabled?
|
77 |
-
*
|
78 |
-
* @return bool
|
79 |
-
*/
|
80 |
-
public function isCartExportEnabled()
|
81 |
-
{
|
82 |
-
return (bool) Mage::getStoreConfig(self::CARTS_ENABLED);
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Get the advertise Email settings.
|
87 |
-
*
|
88 |
-
* @return string
|
89 |
-
*/
|
90 |
-
public function getAdvertiseEmail()
|
91 |
-
{
|
92 |
-
return Mage::getStoreConfig(self::ADVERTISE_EMAIL);
|
93 |
-
}
|
94 |
-
|
95 |
-
/**
|
96 |
-
* Get the status we want to download products as
|
97 |
-
*
|
98 |
-
* @return array
|
99 |
-
*/
|
100 |
-
public function getOrderExportStatus()
|
101 |
-
{
|
102 |
-
$status = Mage::getStoreConfig(self::ORDER_STATUS);
|
103 |
-
|
104 |
-
return explode(',', $status);
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Get the base url
|
109 |
-
*
|
110 |
-
* @return string
|
111 |
-
*/
|
112 |
-
public function getBaseUrl()
|
113 |
-
{
|
114 |
-
return str_replace('http://', '', Mage::getStoreConfig('web/unsecure/base_url'));
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Get export URL
|
119 |
-
*
|
120 |
-
* @return string
|
121 |
-
*/
|
122 |
-
public function getExportUrl()
|
123 |
-
{
|
124 |
-
// Hard-coded URL to export data for all stores to
|
125 |
-
return 'http://related.adverti.se:8888/servlets/uploadfiles';
|
126 |
-
|
127 |
-
// Use this version to take export URL from config settings
|
128 |
-
//return Mage::getStoreConfig(self::EXPORT_URL);
|
129 |
-
}
|
130 |
-
|
131 |
-
/**
|
132 |
-
* GEt a temp folder we'll use to store the exported data.
|
133 |
-
*
|
134 |
-
* @return string
|
135 |
-
*/
|
136 |
-
public function getTempFolder()
|
137 |
-
{
|
138 |
-
return Mage::getBaseDir('var') . DS . 'advertisedata';
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Is the temp folder there and writable??
|
143 |
-
*
|
144 |
-
* @return bool
|
145 |
-
*/
|
146 |
-
public function tempFolderWritable()
|
147 |
-
{
|
148 |
-
return is_writable($this->getTempFolder());
|
149 |
-
}
|
150 |
-
|
151 |
-
/**
|
152 |
-
* Create the temp folder we need
|
153 |
-
*/
|
154 |
-
public function createTempFolder()
|
155 |
-
{
|
156 |
-
if( ! is_dir($this->getTempFolder())) {
|
157 |
-
mkdir($this->getTempFolder(), 0777);
|
158 |
-
}
|
159 |
-
}
|
160 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/Model/Exporter.php
DELETED
@@ -1,168 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
set_time_limit(0);
|
3 |
-
ini_set('memory_limit', '512M');
|
4 |
-
//Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
5 |
-
/**
|
6 |
-
* Exporter.php
|
7 |
-
*
|
8 |
-
* @package Dataexport
|
9 |
-
*/
|
10 |
-
class Advertise_Dataexport_Model_Exporter extends Varien_Object
|
11 |
-
{
|
12 |
-
/**
|
13 |
-
* @var Xmlwriter
|
14 |
-
*/
|
15 |
-
protected $_writer;
|
16 |
-
/**
|
17 |
-
* @var Advertise_Dataexort_Model_Config
|
18 |
-
*/
|
19 |
-
protected $_config;
|
20 |
-
/**
|
21 |
-
* Exporters to use
|
22 |
-
*
|
23 |
-
* @var array
|
24 |
-
*/
|
25 |
-
protected $_exporters = array();
|
26 |
-
/**
|
27 |
-
* @var string
|
28 |
-
*/
|
29 |
-
protected $_filname;
|
30 |
-
/**
|
31 |
-
* Remove temp data files after import?
|
32 |
-
*
|
33 |
-
* @var bool
|
34 |
-
*/
|
35 |
-
protected $_removeTempFiles = FALSE;
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Constructor
|
39 |
-
*/
|
40 |
-
public function __construct()
|
41 |
-
{
|
42 |
-
parent::__construct();
|
43 |
-
|
44 |
-
/**
|
45 |
-
* @todo change this!!
|
46 |
-
*/
|
47 |
-
$this->_filename = Mage::getModel('dataexport/config')->getTempFolder() . DS . 'generate_' . time() . '.xml';
|
48 |
-
|
49 |
-
$this->_writer = new Advertise_Dataexport_Model_Xmlwriter($this->_filename);
|
50 |
-
$this->_config = Mage::getModel('dataexport/config');
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Do the export! GO GO GO
|
55 |
-
*
|
56 |
-
* @return void
|
57 |
-
*/
|
58 |
-
public function export()
|
59 |
-
{
|
60 |
-
$totalItems = 0;
|
61 |
-
/**
|
62 |
-
* 1) Generate the XML feed as a file
|
63 |
-
*/
|
64 |
-
foreach($this->_getExporters() as $exporter) {
|
65 |
-
/* @var $exporter Advertise_Dataexport_Model_Exporter_Interface */
|
66 |
-
$totalItems += $exporter->write($this->_getWriter());
|
67 |
-
}
|
68 |
-
$this->_getWriter()->writeDocument();
|
69 |
-
/**
|
70 |
-
* 2) Send the feed
|
71 |
-
*/
|
72 |
-
$this->_sendFeed($this->_filename);
|
73 |
-
Mage::log('Data export Completed.');
|
74 |
-
|
75 |
-
return $totalItems;
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Send the feed!
|
80 |
-
*
|
81 |
-
* @param filename
|
82 |
-
*/
|
83 |
-
protected function _sendFeed($filename)
|
84 |
-
{
|
85 |
-
if( ! file_exists($filename)) {
|
86 |
-
Mage::throwException($this->__('Feed Not Found! ' . $filename));
|
87 |
-
}
|
88 |
-
|
89 |
-
$target = $this->_getConfig()->getExportUrl();
|
90 |
-
//$filename = $this->_getConfig()->getTempFolder() . DS . 'test.xml';
|
91 |
-
$putFileSize = filesize($filename);
|
92 |
-
$putFileHandle = fopen($filename, "r");
|
93 |
-
|
94 |
-
$adapter = new Zend_Http_Client_Adapter_Curl();
|
95 |
-
$client = new Zend_Http_Client($target);
|
96 |
-
$client->setAdapter($adapter);
|
97 |
-
//$client->setHeaders('Content-Type','text/xml');
|
98 |
-
|
99 |
-
$adapter->setConfig(array(
|
100 |
-
'curloptions' => array(
|
101 |
-
CURLOPT_INFILE => $putFileHandle,
|
102 |
-
CURLOPT_INFILESIZE => (string) $putFileSize,
|
103 |
-
//CURLOPT_SSL_VERIFYHOST => 0,
|
104 |
-
//CURLOPT_SSL_VERIFYPEER => 0,
|
105 |
-
)
|
106 |
-
));
|
107 |
-
|
108 |
-
$response = $client->request(Zend_Http_Client::PUT);
|
109 |
-
}
|
110 |
-
|
111 |
-
/**
|
112 |
-
* Add an exporter
|
113 |
-
*
|
114 |
-
* @param Advertise_Dataexport_Model_Exporter_Interface
|
115 |
-
*/
|
116 |
-
public function addExporter(Advertise_Dataexport_Model_Exporter_Interface $exporter)
|
117 |
-
{
|
118 |
-
$this->_exporters[] = $exporter;
|
119 |
-
|
120 |
-
return $this;
|
121 |
-
}
|
122 |
-
|
123 |
-
/**
|
124 |
-
* Get our exporters
|
125 |
-
*
|
126 |
-
* @return array
|
127 |
-
*/
|
128 |
-
protected function _getExporters()
|
129 |
-
{
|
130 |
-
return $this->_exporters;
|
131 |
-
}
|
132 |
-
|
133 |
-
/**
|
134 |
-
* Get all sotre ids
|
135 |
-
*
|
136 |
-
* @return array
|
137 |
-
*/
|
138 |
-
protected function _getAllStoreIds()
|
139 |
-
{
|
140 |
-
$allStores = Mage::app()->getStores();
|
141 |
-
$ids = array();
|
142 |
-
foreach ($allStores as $_eachStoreId => $val) {
|
143 |
-
$ids[] = Mage::app()->getStore($_eachStoreId)->getId();
|
144 |
-
}
|
145 |
-
|
146 |
-
return $ids;
|
147 |
-
}
|
148 |
-
|
149 |
-
/**
|
150 |
-
* Get the config model
|
151 |
-
*
|
152 |
-
* @return Advertise_Dataexport_Model_Config
|
153 |
-
*/
|
154 |
-
protected function _getConfig()
|
155 |
-
{
|
156 |
-
return $this->_config;
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Get the writer
|
161 |
-
*
|
162 |
-
* @return Xmlwriter
|
163 |
-
*/
|
164 |
-
protected function _getWriter()
|
165 |
-
{
|
166 |
-
return $this->_writer;
|
167 |
-
}
|
168 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/Model/Exporter/Cart.php
DELETED
@@ -1,121 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Cart.php
|
4 |
-
*
|
5 |
-
* @package Dataexport
|
6 |
-
*/
|
7 |
-
class Advertise_Dataexport_Model_Exporter_Cart extends Varien_Object implements Advertise_Dataexport_Model_Exporter_Interface
|
8 |
-
{
|
9 |
-
/**
|
10 |
-
* @var string
|
11 |
-
*/
|
12 |
-
protected $_from;
|
13 |
-
/**
|
14 |
-
* @var string
|
15 |
-
*/
|
16 |
-
protected $_to;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Get the abandoned carts
|
20 |
-
*/
|
21 |
-
public function getCollection()
|
22 |
-
{
|
23 |
-
$collection = Mage::getResourceModel('reports/quote_collection');
|
24 |
-
$data = array();
|
25 |
-
$storeIds = $this->_getAllStoreIds();
|
26 |
-
|
27 |
-
$collection->prepareForAbandonedReport($storeIds); // $data param can be passed too
|
28 |
-
|
29 |
-
/**
|
30 |
-
* Handle to and from dates!
|
31 |
-
*/
|
32 |
-
if($this->_from || $this->_to) {
|
33 |
-
$dateParams = array('date' => true);
|
34 |
-
if($this->_from) {
|
35 |
-
$dateParams['from'] = date('Y-m-d', strtotime($this->_from));
|
36 |
-
}
|
37 |
-
if($this->_to) {
|
38 |
-
$dateParams['to'] = date('Y-m-d', strtotime($this->_to));
|
39 |
-
}
|
40 |
-
$collection->addAttributeToFilter('created_at', $dateParams);
|
41 |
-
}
|
42 |
-
|
43 |
-
return $collection;
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Write any items to the given writer
|
48 |
-
*
|
49 |
-
* @param XMLWriter
|
50 |
-
* @return int
|
51 |
-
*/
|
52 |
-
public function write(XMLWriter $writer)
|
53 |
-
{
|
54 |
-
$writer->startElement('Carts');
|
55 |
-
$count = 0;
|
56 |
-
|
57 |
-
foreach($this->getCollection() as $cart) {
|
58 |
-
/* @var $cart Mage_Sales_Model_Quote */
|
59 |
-
$data = $cart->toArray();
|
60 |
-
$writer->writeArray($data, 'Cart');
|
61 |
-
$this->_writeItems($writer, $cart);
|
62 |
-
$count++;
|
63 |
-
}
|
64 |
-
|
65 |
-
$writer->endElement(); // Carts
|
66 |
-
|
67 |
-
return $count;
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Write the queote items.
|
72 |
-
*
|
73 |
-
* @param Xmlwriter
|
74 |
-
* @param Mage_Sales_Model_Quote
|
75 |
-
*/
|
76 |
-
protected function _writeItems($writer, $cart)
|
77 |
-
{
|
78 |
-
$writer->startElement('QuoteItems');
|
79 |
-
|
80 |
-
foreach($cart->getItemsCollection() as $item) {
|
81 |
-
/* @var $cart Mage_Sales_Model_Quote_Item */
|
82 |
-
$data = $item->getData();
|
83 |
-
$writer->writeArray($data, 'Item');
|
84 |
-
}
|
85 |
-
|
86 |
-
$writer->endElement(); // OrderItems
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Get all sotre ids
|
91 |
-
*
|
92 |
-
* @return array
|
93 |
-
*/
|
94 |
-
protected function _getAllStoreIds()
|
95 |
-
{
|
96 |
-
$allStores = Mage::app()->getStores();
|
97 |
-
$ids = array();
|
98 |
-
foreach ($allStores as $_eachStoreId => $val) {
|
99 |
-
//$_storeCode = Mage::app()->getStore($_eachStoreId)->getCode();
|
100 |
-
//$_storeName = Mage::app()->getStore($_eachStoreId)->getName();
|
101 |
-
//$_storeId = Mage::app()->getStore($_eachStoreId)->getId();
|
102 |
-
$ids[] = Mage::app()->getStore($_eachStoreId)->getId();
|
103 |
-
}
|
104 |
-
|
105 |
-
return $ids;
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Set the date range
|
110 |
-
*
|
111 |
-
* @param string
|
112 |
-
* @param string
|
113 |
-
*/
|
114 |
-
public function setDateRange($from, $to)
|
115 |
-
{
|
116 |
-
$this->_from = $from;
|
117 |
-
$this->_to = $to;
|
118 |
-
|
119 |
-
return $this;
|
120 |
-
}
|
121 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/Model/Exporter/Customer.php
DELETED
@@ -1,58 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Customer.php
|
4 |
-
*
|
5 |
-
* @package Dataexport
|
6 |
-
*/
|
7 |
-
class Advertise_Dataexport_Model_Exporter_Customer extends Varien_Object implements Advertise_Dataexport_Model_Exporter_Interface
|
8 |
-
{
|
9 |
-
/**
|
10 |
-
* Get the collection
|
11 |
-
*
|
12 |
-
* @return
|
13 |
-
*/
|
14 |
-
public function getCollection()
|
15 |
-
{
|
16 |
-
$collection = Mage::getModel('customer/customer')
|
17 |
-
->getCollection()
|
18 |
-
->addAttributeToSelect('*')
|
19 |
-
;
|
20 |
-
|
21 |
-
return $collection;
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Write any items to the given writer
|
26 |
-
*
|
27 |
-
* @param XMLWriter
|
28 |
-
* @return int
|
29 |
-
*/
|
30 |
-
public function write(XMLWriter $writer)
|
31 |
-
{
|
32 |
-
$writer->startElement('Customers');
|
33 |
-
$count = 0;
|
34 |
-
|
35 |
-
foreach($this->getCollection() as $customer) {
|
36 |
-
/* @var $customer Mage_Customer_Model_Customer */
|
37 |
-
$data = $customer->toArray();
|
38 |
-
$billing = $customer->getDefaultBillingAddress();
|
39 |
-
$billing = $billing === FALSE
|
40 |
-
? FALSE
|
41 |
-
: $billing->toArray();
|
42 |
-
|
43 |
-
$shipping = $customer->getDefaultShippingAddress();
|
44 |
-
$shipping = $shipping === FALSE
|
45 |
-
? FALSE
|
46 |
-
: $shipping->toArray();
|
47 |
-
|
48 |
-
$data['billing_address'] = $billing;
|
49 |
-
$data['shipping_address'] = $shipping;
|
50 |
-
$writer->writeArray($data, 'Customer');
|
51 |
-
$count++;
|
52 |
-
}
|
53 |
-
|
54 |
-
$writer->endElement(); // Customer
|
55 |
-
|
56 |
-
return $count;
|
57 |
-
}
|
58 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/Model/Exporter/Interface.php
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Interface.php
|
4 |
-
*
|
5 |
-
* Interface for export "adapters"
|
6 |
-
*
|
7 |
-
* @package Dataexport
|
8 |
-
*/
|
9 |
-
interface Advertise_Dataexport_Model_Exporter_Interface
|
10 |
-
{
|
11 |
-
//public function getCollection();
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Write any items to the given writer
|
15 |
-
*
|
16 |
-
* @param XMLWriter
|
17 |
-
* @return int
|
18 |
-
*/
|
19 |
-
public function write(XMLWriter $writer);
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Get the name of the items we're writing in this adpater.
|
23 |
-
*
|
24 |
-
* @return string
|
25 |
-
*/
|
26 |
-
//public function getObjectName();
|
27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/Model/Exporter/Order.php
DELETED
@@ -1,177 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Order.php
|
4 |
-
*
|
5 |
-
* @package Dataexport
|
6 |
-
*/
|
7 |
-
class Advertise_Dataexport_Model_Exporter_Order extends Varien_Object implements Advertise_Dataexport_Model_Exporter_Interface
|
8 |
-
{
|
9 |
-
/**
|
10 |
-
* @var string
|
11 |
-
*/
|
12 |
-
protected $_from;
|
13 |
-
/**
|
14 |
-
* @var string
|
15 |
-
*/
|
16 |
-
protected $_to;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Set the date range
|
20 |
-
*
|
21 |
-
* @param string
|
22 |
-
* @param string
|
23 |
-
*/
|
24 |
-
public function setDateRange($from, $to)
|
25 |
-
{
|
26 |
-
$this->_from = $from;
|
27 |
-
$this->_to = $to;
|
28 |
-
|
29 |
-
return $this;
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Get the orders we need as a collection
|
34 |
-
*
|
35 |
-
* @param int
|
36 |
-
* @return Varien_Data_Collection
|
37 |
-
*/
|
38 |
-
public function getCollection($storeId = NULL)
|
39 |
-
{
|
40 |
-
//$storeId = Mage::app()->getStore($storeId)->getId();
|
41 |
-
$downloadStatus = Mage::getModel('dataexport/config')->getOrderExportStatus(); //array('complete', 'pending');
|
42 |
-
$orderCollection = Mage::getResourceModel('sales/order_collection')
|
43 |
-
->addAttributeToSelect('*')
|
44 |
-
->addFieldToFilter('status', array('or' => $downloadStatus))
|
45 |
-
//->addFieldToFilter('store_id', array('eq' => $storeId))
|
46 |
-
;
|
47 |
-
/**
|
48 |
-
* Handle to and from dates!
|
49 |
-
*/
|
50 |
-
if($this->_from || $this->_to) {
|
51 |
-
$dateParams = array('date' => true);
|
52 |
-
if($this->_from) {
|
53 |
-
$dateParams['from'] = date('Y-m-d', strtotime($this->_from));
|
54 |
-
}
|
55 |
-
if($this->_to) {
|
56 |
-
$dateParams['to'] = date('Y-m-d', strtotime($this->_to));
|
57 |
-
}
|
58 |
-
$orderCollection->addAttributeToFilter('created_at', $dateParams);
|
59 |
-
}
|
60 |
-
|
61 |
-
return $orderCollection;
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Write any items to the given writer
|
66 |
-
*
|
67 |
-
* @param XMLWriter
|
68 |
-
* @return int
|
69 |
-
*/
|
70 |
-
public function write(XMLWriter $writer)
|
71 |
-
{
|
72 |
-
$writer->startElement('Orders');
|
73 |
-
$count = 0;
|
74 |
-
|
75 |
-
foreach($this->getCollection() as $order) {
|
76 |
-
/* @var $order Mage_Sales_Model_Order */
|
77 |
-
//$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
|
78 |
-
/*$data = array(
|
79 |
-
'Id' => $order->getCustomerId(),
|
80 |
-
'CompanyName' => $order->getBillingAddress()->getCompany(),
|
81 |
-
'CustomerInvoiceAddress' => $this->_getConvertedAddress($order->getBillingAddress()),
|
82 |
-
'CustomerDeliveryAddress' => $this->_getConvertedAddress($order->getShippingAddress()),
|
83 |
-
);*/
|
84 |
-
$data = $order->toArray();
|
85 |
-
$writer->writeArray($data, 'Order');
|
86 |
-
$this->_writeOrderItems($writer, $order);
|
87 |
-
$count++;
|
88 |
-
}
|
89 |
-
|
90 |
-
$writer->endElement(); // Order
|
91 |
-
|
92 |
-
return $count;
|
93 |
-
}
|
94 |
-
|
95 |
-
/**
|
96 |
-
* Convert the address from Magento format to an array we need
|
97 |
-
*
|
98 |
-
* @param Mage_Sales_Model_Order_Address $address
|
99 |
-
* @return array
|
100 |
-
*/
|
101 |
-
protected function _getConvertedAddress(Mage_Sales_Model_Order_Address $address)
|
102 |
-
{
|
103 |
-
$company = $address->getCompany();
|
104 |
-
$company = ! empty($company)
|
105 |
-
? $address->getCompany()
|
106 |
-
: $address->getFirstname() . ' ' . $address->getLastname();
|
107 |
-
|
108 |
-
return array(
|
109 |
-
'Id' => $address->getId(),
|
110 |
-
'Title' => $address->getPrefix(),
|
111 |
-
'Forename' => $address->getFirstname(),
|
112 |
-
'Surname' => $address->getLastname(),
|
113 |
-
'Company' => $company,
|
114 |
-
'Address1' => $address->getStreet1(),
|
115 |
-
'Address2' => $address->getStreet2(),
|
116 |
-
'Town' => $address->getCity(),
|
117 |
-
'County' => $address->getRegion(),
|
118 |
-
'Country' => $address->getData('country_id'), //getCountry()?
|
119 |
-
'Postcode' => $address->getPostcode(),
|
120 |
-
'Email' => $address->getCustomerEmail(),
|
121 |
-
'Telephone' => $address->getTelephone(),
|
122 |
-
);
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Write iterms out too
|
127 |
-
*
|
128 |
-
* @param XmlWriter
|
129 |
-
* @param Mage_Core_Sales_Order
|
130 |
-
*/
|
131 |
-
protected function _writeOrderItems($writer, $order)
|
132 |
-
{
|
133 |
-
$writer->startElement('OrderItems');
|
134 |
-
//foreach($order->getItemsCollection() as $item) {
|
135 |
-
foreach($order->getAllVisibleItems() as $item) {
|
136 |
-
//$totalNet = $item->getQtyOrdered() * $item->getPrice(); // basePrice breaks with multi-currency
|
137 |
-
//$to = Varien_Object_Mapper::accumulateByMap($from, $to, $map); // example mapper
|
138 |
-
/*$data = array(
|
139 |
-
'Id' => $item->getId(),
|
140 |
-
'Sku' => $this->_getItemSkuCode($item),
|
141 |
-
'Name' => $item->getName(),
|
142 |
-
'QtyOrdered' => $item->getQtyOrdered(),
|
143 |
-
'TaxRate' => $item->getData('tax_percent'),
|
144 |
-
'UnitPrice' => $item->getPrice(),
|
145 |
-
'UnitDiscountAmount' => $item->getData('discount_amount'),
|
146 |
-
'UnitDiscountPercentage'=> $item->getData('discount_percent'),
|
147 |
-
);*/
|
148 |
-
|
149 |
-
$data = $item->getData();
|
150 |
-
$writer->writeArray($data, 'Item');
|
151 |
-
}
|
152 |
-
$writer->endElement(); // OrderItems
|
153 |
-
}
|
154 |
-
|
155 |
-
/**
|
156 |
-
* Get the Sku code to use for a particular item.
|
157 |
-
* If we are using bundles / configurable items we need to search
|
158 |
-
* because by default we get the parents Sku...
|
159 |
-
*
|
160 |
-
* @param Mage_Sales_Model_Order_Item
|
161 |
-
* @return string
|
162 |
-
*/
|
163 |
-
protected function _getItemSkuCode($item)
|
164 |
-
{
|
165 |
-
/**
|
166 |
-
* Use Child SKU if it's a configurable product..etc
|
167 |
-
*/
|
168 |
-
if($options = $item->getData('product_options')) {
|
169 |
-
$optionsData = unserialize($options);
|
170 |
-
if(isset($optionsData['simple_sku'])) {
|
171 |
-
return $optionsData['simple_sku'];
|
172 |
-
}
|
173 |
-
}
|
174 |
-
|
175 |
-
return $item->getSku();
|
176 |
-
}
|
177 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/Model/Modelname.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Advertise_Dataexport_Model_Modelname extends Mage_Core_Model_Abstract
|
4 |
-
{
|
5 |
-
protected function _construct(){
|
6 |
-
|
7 |
-
$this->_init("dataexport/modelname");
|
8 |
-
|
9 |
-
}
|
10 |
-
|
11 |
-
}
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/Model/Mysql4/Modelname.php
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Advertise_Dataexport_Model_Mysql4_Modelname extends Mage_Core_Model_Mysql4_Abstract
|
3 |
-
{
|
4 |
-
protected function _construct()
|
5 |
-
{
|
6 |
-
$this->_init("dataexport/modelname", "tablename_id");
|
7 |
-
}
|
8 |
-
}
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/Model/Mysql4/Modelname/Collection.php
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
class Advertise_Dataexport_Model_Mysql4_Modelname_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
3 |
-
{
|
4 |
-
|
5 |
-
public function _construct(){
|
6 |
-
$this->_init("dataexport/modelname");
|
7 |
-
}
|
8 |
-
}
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/Model/Orderstatus.php
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Orderstatus.php
|
4 |
-
*
|
5 |
-
* @package dataexport
|
6 |
-
*/
|
7 |
-
class Advertise_Dataexport_Model_Orderstatus
|
8 |
-
{
|
9 |
-
/**
|
10 |
-
* Options getter
|
11 |
-
*
|
12 |
-
* @return array
|
13 |
-
*/
|
14 |
-
public function toOptionArray()
|
15 |
-
{
|
16 |
-
$collection = Mage::getResourceModel('sales/order_status_collection');
|
17 |
-
return $collection->toOptionArray();
|
18 |
-
}
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/Model/Scheduler.php
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
set_time_limit(0);
|
3 |
-
ini_set('memory_limit', '512M');
|
4 |
-
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
|
5 |
-
/**
|
6 |
-
* Scheduler.php
|
7 |
-
*
|
8 |
-
* @package Dataexport
|
9 |
-
*/
|
10 |
-
class Advertise_Dataexport_Model_Scheduler extends Varien_Object
|
11 |
-
{
|
12 |
-
/**
|
13 |
-
* Lets do this!
|
14 |
-
*/
|
15 |
-
public static function export()
|
16 |
-
{
|
17 |
-
$config = Mage::getModel('dataexport/config');
|
18 |
-
|
19 |
-
if( ! ($config->getIsEnabled() && $config->isCronEnabled())) {
|
20 |
-
return;
|
21 |
-
//Mage::throwException($this->__('Module Disabled!'));
|
22 |
-
}
|
23 |
-
|
24 |
-
try {
|
25 |
-
//$post = $this->getRequest()->getPost();
|
26 |
-
$exporter = Mage::getModel('dataexport/exporter');
|
27 |
-
/* @var $exporter Advertise_Dataexport_Model_Exporter */
|
28 |
-
/**
|
29 |
-
* Add Order Export
|
30 |
-
*/
|
31 |
-
if($config->isOrderExportEnabled()) {
|
32 |
-
//$toDate = $this->getRequest()->getParam('date_to', NULL);
|
33 |
-
//$fromDate = $this->getRequest()->getParam('date_from', NULL);
|
34 |
-
|
35 |
-
$exportAdapter = Mage::getModel('dataexport/exporter_order');
|
36 |
-
//$exportAdapter->setDateRange($fromDate, $toDate);
|
37 |
-
$exporter->addExporter($exportAdapter);
|
38 |
-
}
|
39 |
-
/**
|
40 |
-
* Add Customer Export
|
41 |
-
*/
|
42 |
-
if($config->isCustomerExportEnabled()) {
|
43 |
-
$exportAdapter = Mage::getModel('dataexport/exporter_customer');
|
44 |
-
$exporter->addExporter($exportAdapter);
|
45 |
-
}
|
46 |
-
/**
|
47 |
-
* Add Cart Export
|
48 |
-
*/
|
49 |
-
if($config->isCartExportEnabled()) {
|
50 |
-
$exportAdapter = Mage::getModel('dataexport/exporter_cart');
|
51 |
-
$exporter->addExporter($exportAdapter);
|
52 |
-
}
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Do it!
|
56 |
-
*/
|
57 |
-
$totalItems = $exporter->export();
|
58 |
-
|
59 |
-
$message = $this->__('Your form has been submitted successfully.');
|
60 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
61 |
-
Mage::getSingleton('adminhtml/session')->addSuccess("{$totalItems} Items successfully Exported.");
|
62 |
-
}
|
63 |
-
catch (Exception $e) {
|
64 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
65 |
-
}
|
66 |
-
}
|
67 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/Model/Xmlwriter.php
DELETED
@@ -1,209 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Xmlwriter.php
|
4 |
-
*
|
5 |
-
* Extension to PHPs native XML Writer.
|
6 |
-
* We are writing directly to the output buffer every X elements.
|
7 |
-
* We are only counting Objects or Arrays in the flush count as "elements"
|
8 |
-
*
|
9 |
-
* We are currently using the MemoryBuffer, but we could use
|
10 |
-
* direct output if we wanted, maybe tinker with this in the future:
|
11 |
-
* out->openURI('php://output')
|
12 |
-
* We are using memorybuffers as it's easier to change to file writing
|
13 |
-
* for debug/loggin.
|
14 |
-
*
|
15 |
-
* @package Dataexport
|
16 |
-
*/
|
17 |
-
class Advertise_Dataexport_Model_Xmlwriter extends XMLWriter
|
18 |
-
{
|
19 |
-
/**
|
20 |
-
* Number of entries before each flush
|
21 |
-
* @var int
|
22 |
-
*/
|
23 |
-
protected $_flushAfter = 20;
|
24 |
-
/**
|
25 |
-
* Keep count of written elements before we flush
|
26 |
-
* @var int
|
27 |
-
*/
|
28 |
-
protected $_flushCount = 0;
|
29 |
-
/**
|
30 |
-
* Enable flushing buffer? If we disable
|
31 |
-
* we won't write the buffer until the end!
|
32 |
-
* @var bool
|
33 |
-
*/
|
34 |
-
protected $_flushEnabled = TRUE;
|
35 |
-
/**
|
36 |
-
* Name of our root element
|
37 |
-
* @var string
|
38 |
-
*/
|
39 |
-
protected $_rootElement = 'Advertise';
|
40 |
-
/**
|
41 |
-
* filename
|
42 |
-
* @var string
|
43 |
-
*/
|
44 |
-
protected $_filename;
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Constructor
|
48 |
-
*
|
49 |
-
* @param string
|
50 |
-
*/
|
51 |
-
public function __construct($filename)
|
52 |
-
{
|
53 |
-
$this->_filename = $filename;
|
54 |
-
|
55 |
-
$this->openMemory();
|
56 |
-
//$this->openURI($this->_getFilename());
|
57 |
-
$this->startDocument('1.0', 'UTF-8');
|
58 |
-
/** only indent in development mode **/
|
59 |
-
if(Mage::getIsDeveloperMode()) {
|
60 |
-
$this->setIndent(TRUE);
|
61 |
-
$this->setIndentString(' ');
|
62 |
-
}
|
63 |
-
else {
|
64 |
-
$this->setIndent(FALSE);
|
65 |
-
}
|
66 |
-
$this->startElement($this->_rootElement);
|
67 |
-
}
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Get the filename we'll use
|
71 |
-
*
|
72 |
-
* @return string
|
73 |
-
*/
|
74 |
-
protected function _getFilename()
|
75 |
-
{
|
76 |
-
//if($this->_filename === NULL) {
|
77 |
-
// generate??
|
78 |
-
//}
|
79 |
-
|
80 |
-
return $this->_filename;
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Set the filename to use
|
85 |
-
*
|
86 |
-
* @param string
|
87 |
-
*/
|
88 |
-
public function setFilename($filename)
|
89 |
-
{
|
90 |
-
$this->_filename = $filename;
|
91 |
-
|
92 |
-
return $this;
|
93 |
-
}
|
94 |
-
|
95 |
-
/**
|
96 |
-
* Write a collection to the XML stream
|
97 |
-
*
|
98 |
-
* @param Varien_Data_Collection
|
99 |
-
* @param string node name
|
100 |
-
* @return $this
|
101 |
-
*/
|
102 |
-
public function writeCollection(Varien_Data_Collection $collection, $nodeName)
|
103 |
-
{
|
104 |
-
$this->startElement($nodeName);
|
105 |
-
foreach($collection as $item) {
|
106 |
-
$this->writeObject($item, $this->_getSingularName($nodeName));
|
107 |
-
}
|
108 |
-
$this->endElement();
|
109 |
-
|
110 |
-
return $this;
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Just an alias to save me hunting through the code and changing
|
115 |
-
* references to write array.. lazy
|
116 |
-
*
|
117 |
-
* @param mixed
|
118 |
-
* @param string
|
119 |
-
*/
|
120 |
-
public function writeArray($item, $nodeName = NULL)
|
121 |
-
{
|
122 |
-
$this->writeObject($item, $nodeName);
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Recursive function to replace the garbage above..
|
127 |
-
*
|
128 |
-
* @param mixed
|
129 |
-
* @param string
|
130 |
-
*/
|
131 |
-
public function writeObject($item, $nodeName = NULL)
|
132 |
-
{
|
133 |
-
if(isset($nodeName)) {
|
134 |
-
$this->startElement($nodeName);
|
135 |
-
}
|
136 |
-
/** Array **/
|
137 |
-
if(is_array($item)) {
|
138 |
-
foreach($item as $field => $val) {
|
139 |
-
$this->writeObject($val, $field);
|
140 |
-
}
|
141 |
-
}
|
142 |
-
/** Object */
|
143 |
-
elseif($item instanceof Varien_Object) {
|
144 |
-
foreach($item->getData() as $field => $val) {
|
145 |
-
$this->writeObject($val, $field);
|
146 |
-
}
|
147 |
-
}
|
148 |
-
/** collection **/
|
149 |
-
elseif($item instanceof Varien_Data_Collection) {
|
150 |
-
|
151 |
-
}
|
152 |
-
/** node **/
|
153 |
-
else {
|
154 |
-
$this->text((string) $item);
|
155 |
-
}
|
156 |
-
|
157 |
-
if(isset($nodeName)) {
|
158 |
-
$this->endElement();
|
159 |
-
}
|
160 |
-
$this->_doFlush();
|
161 |
-
|
162 |
-
return $this;
|
163 |
-
}
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Generate the Xml document
|
167 |
-
*/
|
168 |
-
public function writeDocument()
|
169 |
-
{
|
170 |
-
$this->endElement();
|
171 |
-
$this->endDocument();
|
172 |
-
|
173 |
-
//return $this->outputMemory();
|
174 |
-
|
175 |
-
/**
|
176 |
-
* @todo if Writing to file:
|
177 |
-
*/
|
178 |
-
file_put_contents($this->_getFilename(), $this->flush(true), FILE_APPEND);
|
179 |
-
//return $this->flush();
|
180 |
-
}
|
181 |
-
|
182 |
-
/**
|
183 |
-
* Check if we need to flush, if we do then
|
184 |
-
* let's do it!
|
185 |
-
*/
|
186 |
-
protected function _doFlush()
|
187 |
-
{
|
188 |
-
if($this->_flushEnabled && $this->_flushCount >= $this->_flushAfter) {
|
189 |
-
//echo $this->outputMemory();
|
190 |
-
file_put_contents($this->_getFilename(), $this->flush(true), FILE_APPEND);
|
191 |
-
$this->_flushCount = 0;
|
192 |
-
}
|
193 |
-
|
194 |
-
$this->_flushCount++;
|
195 |
-
}
|
196 |
-
|
197 |
-
/**
|
198 |
-
* Get the singular version of a collection
|
199 |
-
* eg. Customers will return Customer
|
200 |
-
*
|
201 |
-
* @param string $name
|
202 |
-
* @return string - singlular name
|
203 |
-
*/
|
204 |
-
protected function _getSingularName($name)
|
205 |
-
{
|
206 |
-
/** not handle irregular names yet.. **/
|
207 |
-
return rtrim($name, 's');
|
208 |
-
}
|
209 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/controllers/Adminhtml/DataexportbackendController.php
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* DataexportbackendController.php
|
4 |
-
*/
|
5 |
-
class Advertise_Dataexport_Adminhtml_DataexportbackendController extends Mage_Adminhtml_Controller_Action
|
6 |
-
{
|
7 |
-
/**
|
8 |
-
* index action
|
9 |
-
*/
|
10 |
-
public function indexAction()
|
11 |
-
{
|
12 |
-
$this->loadLayout();
|
13 |
-
$this->_title($this->__("Adverti.se Related Products (Advanced)"));
|
14 |
-
$this->renderLayout();
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Run the export
|
19 |
-
*/
|
20 |
-
public function exportAction()
|
21 |
-
{
|
22 |
-
$config = Mage::getModel('dataexport/config');
|
23 |
-
|
24 |
-
if( ! $config->getIsEnabled()) {
|
25 |
-
Mage::throwException($this->__('Module Disabled!'));
|
26 |
-
}
|
27 |
-
|
28 |
-
if($this->getRequest()->isPost()) {
|
29 |
-
try {
|
30 |
-
//$post = $this->getRequest()->getPost();
|
31 |
-
$exporter = Mage::getModel('dataexport/exporter');
|
32 |
-
/* @var $exporter Advertise_Dataexport_Model_Exporter */
|
33 |
-
/**
|
34 |
-
* Add Order Export
|
35 |
-
*/
|
36 |
-
if($config->isOrderExportEnabled()) {
|
37 |
-
$toDate = $this->getRequest()->getParam('date_to', NULL);
|
38 |
-
$fromDate = $this->getRequest()->getParam('date_from', NULL);
|
39 |
-
|
40 |
-
$exportAdapter = Mage::getModel('dataexport/exporter_order');
|
41 |
-
$exportAdapter->setDateRange($fromDate, $toDate);
|
42 |
-
$exporter->addExporter($exportAdapter);
|
43 |
-
}
|
44 |
-
/**
|
45 |
-
* Add Customer Export
|
46 |
-
*/
|
47 |
-
if($config->isCustomerExportEnabled()) {
|
48 |
-
$exportAdapter = Mage::getModel('dataexport/exporter_customer');
|
49 |
-
$exporter->addExporter($exportAdapter);
|
50 |
-
}
|
51 |
-
/**
|
52 |
-
* Add Cart Export
|
53 |
-
*/
|
54 |
-
if($config->isCartExportEnabled()) {
|
55 |
-
$exportAdapter = Mage::getModel('dataexport/exporter_cart');
|
56 |
-
$exporter->addExporter($exportAdapter);
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Do it!
|
61 |
-
*/
|
62 |
-
$totalItems = $exporter->export();
|
63 |
-
|
64 |
-
$message = $this->__('Your form has been submitted successfully.');
|
65 |
-
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
66 |
-
Mage::getSingleton('adminhtml/session')->addSuccess("{$totalItems} Items successfully Exported.");
|
67 |
-
}
|
68 |
-
catch (Exception $e) {
|
69 |
-
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
70 |
-
}
|
71 |
-
|
72 |
-
$this->_redirect('*/*');
|
73 |
-
}
|
74 |
-
else {
|
75 |
-
Mage::throwException($this->__('Invalid form data.'));
|
76 |
-
}
|
77 |
-
}
|
78 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/controllers/IndexController.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* IndexController.php
|
4 |
-
*/
|
5 |
-
class Advertise_Dataexport_IndexController extends Mage_Core_Controller_Front_Action
|
6 |
-
{
|
7 |
-
/**
|
8 |
-
* index action
|
9 |
-
*/
|
10 |
-
public function indexAction()
|
11 |
-
{
|
12 |
-
exit;
|
13 |
-
}
|
14 |
-
|
15 |
-
/**
|
16 |
-
* We will post data here as a test.
|
17 |
-
* We can juust log it!
|
18 |
-
*/
|
19 |
-
public function debugAction()
|
20 |
-
{
|
21 |
-
$config = Mage::getModel('dataexport/config');
|
22 |
-
$post = file_get_contents('php://input');
|
23 |
-
|
24 |
-
//echo $post;
|
25 |
-
|
26 |
-
if(empty($post)) {
|
27 |
-
die('nothing to do.');
|
28 |
-
}
|
29 |
-
|
30 |
-
if( !is_dir($config->getTempFolder())) {
|
31 |
-
mkdir($config->getTempFolder(), 0777);
|
32 |
-
}
|
33 |
-
|
34 |
-
$filename = $config->getTempFolder() . DS . 'debug_' . time() . '.xml';
|
35 |
-
if( ! file_put_contents($filename, $post)) {
|
36 |
-
Mage::log('Error writing debug file: ' . $filename);
|
37 |
-
}
|
38 |
-
|
39 |
-
unset($post);
|
40 |
-
}
|
41 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/controllers/TestController.php
DELETED
@@ -1,238 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* IndexController.php
|
4 |
-
*/
|
5 |
-
class Advertise_Dataexport_TestController extends Mage_Core_Controller_Front_Action
|
6 |
-
{
|
7 |
-
/**
|
8 |
-
* Predispatch: should set layout area
|
9 |
-
*
|
10 |
-
* @return Mage_Core_Controller_Front_Action
|
11 |
-
*/
|
12 |
-
public function preDispatch()
|
13 |
-
{
|
14 |
-
if( ! Mage::getIsDeveloperMode()) {
|
15 |
-
die('no access.');
|
16 |
-
}
|
17 |
-
|
18 |
-
parent::preDispatch();
|
19 |
-
|
20 |
-
return $this;
|
21 |
-
}
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Test product string
|
25 |
-
*/
|
26 |
-
public function stringAction()
|
27 |
-
{
|
28 |
-
// shortcut method, to be used inside a template
|
29 |
-
echo Mage::helper('advertise_relatedproducts')->getHeaderProductIds();
|
30 |
-
|
31 |
-
// output encoded string
|
32 |
-
$string = Mage::helper('advertise_relatedproducts')->getProductDataString();
|
33 |
-
echo $string . "<br />";
|
34 |
-
|
35 |
-
// get back the value we want
|
36 |
-
var_dump(Mage::helper('advertise_relatedproducts')->getProductIdsFromString($string));
|
37 |
-
}
|
38 |
-
|
39 |
-
/**
|
40 |
-
* index action
|
41 |
-
*/
|
42 |
-
public function indexAction()
|
43 |
-
{
|
44 |
-
try {
|
45 |
-
//$target = 'http://www.google.com/';
|
46 |
-
$config = Mage::getModel('dataexport/config');
|
47 |
-
$target = $config->getExportUrl();
|
48 |
-
$adapter = new Zend_Http_Client_Adapter_Curl();
|
49 |
-
$client = new Zend_Http_Client($target);
|
50 |
-
$client->setAdapter($adapter);
|
51 |
-
|
52 |
-
$adapter->setConfig(array(
|
53 |
-
'timeout' => 60,
|
54 |
-
'curloptions' => array(
|
55 |
-
CURLOPT_SSL_VERIFYHOST => 0,
|
56 |
-
CURLOPT_SSL_VERIFYPEER => 0,
|
57 |
-
CURLOPT_TIMEOUT => 60,
|
58 |
-
//CURLOPT_ENCODING => 'gzip',
|
59 |
-
//CURLOPT_CONNECTTIMEOUT => 60,
|
60 |
-
//CURLOPT_POSTFIELDS => 'data',
|
61 |
-
//CURLOPT_FOLLOWLOCATION => true
|
62 |
-
//CURLOPT_INFILE => $putFileHandle,
|
63 |
-
//CURLOPT_INFILESIZE => $putFileSize
|
64 |
-
)
|
65 |
-
));
|
66 |
-
//$client->setParameterPost('name', 'value');
|
67 |
-
$client->setHeaders('Content-Type','text/xml');
|
68 |
-
$client->setRawData('THIS IS A TEST!', 'text/xml');
|
69 |
-
|
70 |
-
$response = $client->request(Zend_Http_Client::POST);
|
71 |
-
//echo $client->read();
|
72 |
-
echo $response->getBody();
|
73 |
-
}
|
74 |
-
catch(Exception $e) {
|
75 |
-
$debug['http_error'] = array(
|
76 |
-
'error' => $e->getMessage(),
|
77 |
-
'code' => $e->getCode()
|
78 |
-
);
|
79 |
-
var_dump($debug);
|
80 |
-
//throw $e;
|
81 |
-
}
|
82 |
-
exit;
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Test sending a file.
|
87 |
-
*/
|
88 |
-
public function sendFileAction()
|
89 |
-
{
|
90 |
-
$config = Mage::getModel('dataexport/config');
|
91 |
-
$target = $config->getExportUrl();
|
92 |
-
|
93 |
-
$filename = $config->getTempFolder() . DS . 'test.xml';
|
94 |
-
|
95 |
-
$putFileSize = filesize($filename);
|
96 |
-
$putFileHandle = fopen($filename, "r");
|
97 |
-
|
98 |
-
$adapter = new Zend_Http_Client_Adapter_Curl();
|
99 |
-
$client = new Zend_Http_Client($target);
|
100 |
-
$client->setAdapter($adapter);
|
101 |
-
|
102 |
-
$adapter->setConfig(array(
|
103 |
-
'curloptions' => array(
|
104 |
-
CURLOPT_INFILE => $putFileHandle,
|
105 |
-
CURLOPT_INFILESIZE => (string) $putFileSize,
|
106 |
-
//CURLOPT_SSL_VERIFYHOST => 0,
|
107 |
-
//CURLOPT_SSL_VERIFYPEER => 0,
|
108 |
-
)
|
109 |
-
));
|
110 |
-
|
111 |
-
$response = $client->request(Zend_Http_Client::PUT);
|
112 |
-
//echo $response->getBody();
|
113 |
-
|
114 |
-
//$client->request("PUT");
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Test the customer feed
|
119 |
-
*/
|
120 |
-
public function customerAction()
|
121 |
-
{
|
122 |
-
$collection = Mage::getModel('customer/customer')
|
123 |
-
->getCollection()
|
124 |
-
->addAttributeToSelect('*')
|
125 |
-
;
|
126 |
-
|
127 |
-
$result = array();
|
128 |
-
|
129 |
-
foreach ($collection as $customer) {
|
130 |
-
/* @var $customer Mage_Customer_Model_Customer */
|
131 |
-
$data = $customer->toArray();
|
132 |
-
$data['billing_address'] = $customer->getDefaultBillingAddress()->toArray();
|
133 |
-
$data['shipping_address'] = $customer->getDefaultShippingAddress()->toArray();
|
134 |
-
$result[] = $data;
|
135 |
-
}
|
136 |
-
|
137 |
-
var_dump($result);
|
138 |
-
}
|
139 |
-
|
140 |
-
/**
|
141 |
-
* Test getting order feed.
|
142 |
-
*/
|
143 |
-
public function orderAction()
|
144 |
-
{
|
145 |
-
//$post = $this->getRequest()->getPost();
|
146 |
-
$exporter = Mage::getModel('dataexport/exporter');
|
147 |
-
/* @var $exporter Advertise_Dataexport_Model_Exporter */
|
148 |
-
|
149 |
-
$toDate = $this->getRequest()->getParam('date_to', NULL);
|
150 |
-
$fromDate = $this->getRequest()->getParam('date_from', NULL);
|
151 |
-
|
152 |
-
$exportAdapter = Mage::getModel('dataexport/exporter_order');
|
153 |
-
$exportAdapter->setDateRange($fromDate, $toDate);
|
154 |
-
$exporter->addExporter($exportAdapter);
|
155 |
-
|
156 |
-
/**
|
157 |
-
* Do it!
|
158 |
-
*/
|
159 |
-
$totalItems = $exporter->export();
|
160 |
-
}
|
161 |
-
|
162 |
-
/**
|
163 |
-
* Get the orders we need as a collection
|
164 |
-
*
|
165 |
-
* @param int
|
166 |
-
* @return Varien_Data_Collection
|
167 |
-
*/
|
168 |
-
protected function _getOrderCollection($storeId = NULL)
|
169 |
-
{
|
170 |
-
$storeId = Mage::app()->getStore($storeId)->getId();
|
171 |
-
$downloadStatus = Mage::getModel('dataexport/config')->getOrderExportStatus(); //array('complete', 'pending');
|
172 |
-
$orderCollection = Mage::getResourceModel('sales/order_collection')
|
173 |
-
->addAttributeToSelect('*')
|
174 |
-
->addFieldToFilter('status', array('or' => $downloadStatus))
|
175 |
-
->addFieldToFilter('store_id', array('eq' => $storeId))
|
176 |
-
;
|
177 |
-
/**
|
178 |
-
* Handle to and from dates
|
179 |
-
* @todo refactor away from here...
|
180 |
-
*/
|
181 |
-
$fromDate = $this->getRequest()->getParam('from', FALSE);
|
182 |
-
$toDate = $this->getRequest()->getParam('to', FALSE);
|
183 |
-
if($fromDate || $toDate) {
|
184 |
-
$dateParams = array('date' => true);
|
185 |
-
if($fromDate) {
|
186 |
-
$dateParams['from'] = date('Y-m-d', strtotime($fromDate));
|
187 |
-
}
|
188 |
-
if($toDate) {
|
189 |
-
$dateParams['to'] = date('Y-m-d', strtotime($toDate));
|
190 |
-
}
|
191 |
-
$orderCollection->addAttributeToFilter('created_at', $dateParams);
|
192 |
-
}
|
193 |
-
|
194 |
-
return $orderCollection;
|
195 |
-
}
|
196 |
-
|
197 |
-
/**
|
198 |
-
* List abandoned carts!
|
199 |
-
*/
|
200 |
-
public function cartAction()
|
201 |
-
{
|
202 |
-
$collection = Mage::getResourceModel('reports/quote_collection');
|
203 |
-
$data = array();
|
204 |
-
$storeIds = $this->_getAllStoreIds();
|
205 |
-
|
206 |
-
if (!empty($data)) {
|
207 |
-
$collection->prepareForAbandonedReport($storeIds, $data);
|
208 |
-
} else {
|
209 |
-
$collection->prepareForAbandonedReport($storeIds);
|
210 |
-
}
|
211 |
-
|
212 |
-
foreach($collection as $cart) {
|
213 |
-
/* @var $cart Mage_Sales_Model_Quote */
|
214 |
-
$cart->getItemsCollection();
|
215 |
-
|
216 |
-
var_dump($cart->getData());
|
217 |
-
}
|
218 |
-
}
|
219 |
-
|
220 |
-
/**
|
221 |
-
* Get all sotre ids
|
222 |
-
*
|
223 |
-
* @return array
|
224 |
-
*/
|
225 |
-
protected function _getAllStoreIds()
|
226 |
-
{
|
227 |
-
$allStores = Mage::app()->getStores();
|
228 |
-
$ids = array();
|
229 |
-
foreach ($allStores as $_eachStoreId => $val) {
|
230 |
-
//$_storeCode = Mage::app()->getStore($_eachStoreId)->getCode();
|
231 |
-
//$_storeName = Mage::app()->getStore($_eachStoreId)->getName();
|
232 |
-
//$_storeId = Mage::app()->getStore($_eachStoreId)->getId();
|
233 |
-
$ids[] = Mage::app()->getStore($_eachStoreId)->getId();
|
234 |
-
}
|
235 |
-
|
236 |
-
return $ids;
|
237 |
-
}
|
238 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/etc/adminhtml.xml
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
|
3 |
-
<config>
|
4 |
-
<menu>
|
5 |
-
<catalog>
|
6 |
-
<children>
|
7 |
-
<!-- Add Adverti.se item to Catalog menu - same for all Adverti.se modules -->
|
8 |
-
<advertise_menu translate="title">
|
9 |
-
<title>Adverti.se</title>
|
10 |
-
<sort_order>199</sort_order>
|
11 |
-
<!-- Add Related Products to Adverti.se sub-menu -->
|
12 |
-
<children>
|
13 |
-
<advertise_relatedproducts translate="title" module="dataexport">
|
14 |
-
<title>Related Products</title>
|
15 |
-
<sort_order>2</sort_order>
|
16 |
-
<action>dataexport/adminhtml_dataexportbackend</action>
|
17 |
-
</advertise_relatedproducts>
|
18 |
-
</children>
|
19 |
-
</advertise_menu>
|
20 |
-
</children>
|
21 |
-
</catalog>
|
22 |
-
</menu>
|
23 |
-
<acl>
|
24 |
-
<resources>
|
25 |
-
<admin>
|
26 |
-
<children>
|
27 |
-
<catalog>
|
28 |
-
<children>
|
29 |
-
<advertise_menu translate="title">
|
30 |
-
<title>Adverti.se</title>
|
31 |
-
<children>
|
32 |
-
<advertise_relatedproducts translate="title" module="dataexport">
|
33 |
-
<title>Related Products</title>
|
34 |
-
</advertise_relatedproducts>
|
35 |
-
</children>
|
36 |
-
</advertise_menu>
|
37 |
-
</children>
|
38 |
-
</catalog>
|
39 |
-
</children>
|
40 |
-
</admin>
|
41 |
-
</resources>
|
42 |
-
</acl>
|
43 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/etc/config.xml
DELETED
@@ -1,186 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Advertise_Dataexport>
|
5 |
-
<version>0.1.0</version>
|
6 |
-
</Advertise_Dataexport>
|
7 |
-
</modules>
|
8 |
-
|
9 |
-
<frontend>
|
10 |
-
<routers>
|
11 |
-
<dataexport>
|
12 |
-
<use>standard</use>
|
13 |
-
<args>
|
14 |
-
<module>Advertise_Dataexport</module>
|
15 |
-
<frontName>dataexport</frontName>
|
16 |
-
</args>
|
17 |
-
</dataexport>
|
18 |
-
</routers>
|
19 |
-
<layout>
|
20 |
-
<updates>
|
21 |
-
<dataexport>
|
22 |
-
<file>dataexport.xml</file>
|
23 |
-
</dataexport>
|
24 |
-
</updates>
|
25 |
-
</layout>
|
26 |
-
</frontend>
|
27 |
-
<global>
|
28 |
-
<helpers>
|
29 |
-
<dataexport>
|
30 |
-
<class>Advertise_Dataexport_Helper</class>
|
31 |
-
</dataexport>
|
32 |
-
</helpers>
|
33 |
-
<blocks>
|
34 |
-
<dataexport>
|
35 |
-
<class>Advertise_Dataexport_Block</class>
|
36 |
-
</dataexport>
|
37 |
-
</blocks>
|
38 |
-
<models>
|
39 |
-
<dataexport>
|
40 |
-
<class>Advertise_Dataexport_Model</class>
|
41 |
-
<resourceModel>dataexport_mysql4</resourceModel>
|
42 |
-
</dataexport>
|
43 |
-
<dataexport_mysql4>
|
44 |
-
<class>Advertise_Dataexport_Model_Mysql4</class>
|
45 |
-
<entities>
|
46 |
-
<modelname>
|
47 |
-
<table>tablename</table>
|
48 |
-
</modelname>
|
49 |
-
</entities>
|
50 |
-
</dataexport_mysql4>
|
51 |
-
</models>
|
52 |
-
<resources>
|
53 |
-
<dataexport_setup>
|
54 |
-
<setup>
|
55 |
-
<module>Advertise_Dataexport</module>
|
56 |
-
</setup>
|
57 |
-
<connection>
|
58 |
-
<use>core_setup</use>
|
59 |
-
</connection>
|
60 |
-
</dataexport_setup>
|
61 |
-
<dataexport_write>
|
62 |
-
<connection>
|
63 |
-
<use>core_write</use>
|
64 |
-
</connection>
|
65 |
-
</dataexport_write>
|
66 |
-
<dataexport_read>
|
67 |
-
<connection>
|
68 |
-
<use>core_read</use>
|
69 |
-
</connection>
|
70 |
-
</dataexport_read>
|
71 |
-
</resources>
|
72 |
-
<!-- events -->
|
73 |
-
<!-- <events>
|
74 |
-
<advertise_export_event>
|
75 |
-
<observers>
|
76 |
-
<advertise_export_observer>
|
77 |
-
<type>singleton</type>
|
78 |
-
<class>dataexport/observer</class>
|
79 |
-
<method>something</method>
|
80 |
-
</advertise_export_observer>
|
81 |
-
</observers>
|
82 |
-
</advertise_export_event>
|
83 |
-
</events>
|
84 |
-
-->
|
85 |
-
</global>
|
86 |
-
<admin>
|
87 |
-
<routers>
|
88 |
-
<dataexport>
|
89 |
-
<use>admin</use>
|
90 |
-
<args>
|
91 |
-
<module>Advertise_Dataexport</module>
|
92 |
-
<frontName>dataexport</frontName>
|
93 |
-
</args>
|
94 |
-
</dataexport>
|
95 |
-
</routers>
|
96 |
-
</admin>
|
97 |
-
<adminhtml>
|
98 |
-
<!-- REMOVE EXTRA MENU ITEM
|
99 |
-
<menu>
|
100 |
-
<dataexport module="dataexport">
|
101 |
-
<title>Advertise Data Export</title>
|
102 |
-
<sort_order>100</sort_order>
|
103 |
-
<children>
|
104 |
-
<dataexportbackend module="dataexport">
|
105 |
-
<title>Export Data</title>
|
106 |
-
<sort_order>0</sort_order>
|
107 |
-
<action>dataexport/adminhtml_dataexportbackend</action>
|
108 |
-
</dataexportbackend>
|
109 |
-
</children>
|
110 |
-
</dataexport>
|
111 |
-
</menu>
|
112 |
-
-->
|
113 |
-
|
114 |
-
<!-- acl -->
|
115 |
-
<acl>
|
116 |
-
<resources>
|
117 |
-
<all>
|
118 |
-
<title>Allow Everything</title>
|
119 |
-
</all>
|
120 |
-
<admin>
|
121 |
-
<children>
|
122 |
-
<!--
|
123 |
-
<dataexport translate="title" module="dataexport">
|
124 |
-
<title>Dataexport</title>
|
125 |
-
<sort_order>1000</sort_order>
|
126 |
-
<children>
|
127 |
-
<dataexportbackend translate="title">
|
128 |
-
<title>Data Export</title>
|
129 |
-
</dataexportbackend>
|
130 |
-
</children>
|
131 |
-
</dataexport>
|
132 |
-
-->
|
133 |
-
<system>
|
134 |
-
<children>
|
135 |
-
<config>
|
136 |
-
<children>
|
137 |
-
<dataexport>
|
138 |
-
<title>Data Export Module</title>
|
139 |
-
</dataexport>
|
140 |
-
</children>
|
141 |
-
</config>
|
142 |
-
</children>
|
143 |
-
</system>
|
144 |
-
</children>
|
145 |
-
</admin>
|
146 |
-
</resources>
|
147 |
-
</acl>
|
148 |
-
|
149 |
-
<layout>
|
150 |
-
<updates>
|
151 |
-
<dataexport>
|
152 |
-
<file>dataexport.xml</file>
|
153 |
-
</dataexport>
|
154 |
-
</updates>
|
155 |
-
</layout>
|
156 |
-
</adminhtml>
|
157 |
-
<!-- cron jobs -->
|
158 |
-
<crontab>
|
159 |
-
<jobs>
|
160 |
-
<advertise_dataexport>
|
161 |
-
<schedule>
|
162 |
-
<!--<cron_expr>0,15,30,45 * * * *</cron_expr>-->
|
163 |
-
<cron_expr>0 0 * * *</cron_expr><!-- each day at midnight! -->
|
164 |
-
</schedule>
|
165 |
-
<run>
|
166 |
-
<model>dataexport/Scheduler::export</model>
|
167 |
-
</run>
|
168 |
-
</advertise_dataexport>
|
169 |
-
</jobs>
|
170 |
-
</crontab>
|
171 |
-
<!-- defaults -->
|
172 |
-
<default>
|
173 |
-
<dataexport><!-- section -->
|
174 |
-
<dataexport_group><!-- group -->
|
175 |
-
<enabled>1</enabled>
|
176 |
-
<enabled_cron>0</enabled_cron>
|
177 |
-
<enable_gzip>0</enable_gzip>
|
178 |
-
<export_carts>1</export_carts>
|
179 |
-
<export_orders>1</export_orders>
|
180 |
-
<order_status>complete</order_status>
|
181 |
-
<export_customers>1</export_customers>
|
182 |
-
<export_url></export_url>
|
183 |
-
</dataexport_group>
|
184 |
-
</dataexport>
|
185 |
-
</default>
|
186 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/etc/system.xml
DELETED
@@ -1,137 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<!-- This Adverti.se tab is used by all Adverti.se extensions for config menu!
|
4 |
-
So if you change it then need to change in ALL extensions! -->
|
5 |
-
|
6 |
-
<!-- Top Level Tab -->
|
7 |
-
<tabs>
|
8 |
-
<Advertise translate="label">
|
9 |
-
<label>Advertise</label>
|
10 |
-
<sort_order>405</sort_order>
|
11 |
-
</Advertise>
|
12 |
-
</tabs>
|
13 |
-
|
14 |
-
<!-- Sections under Adverti.se tab -->
|
15 |
-
<sections>
|
16 |
-
<dataexport translate="label" module="dataexport">
|
17 |
-
<tab>Advertise</tab>
|
18 |
-
<label>Related Products (Advanced)</label>
|
19 |
-
<frontend_type>text</frontend_type>
|
20 |
-
<sort_order>500</sort_order>
|
21 |
-
<show_in_default>1</show_in_default>
|
22 |
-
<show_in_website>1</show_in_website>
|
23 |
-
<show_in_store>1</show_in_store>
|
24 |
-
<groups>
|
25 |
-
<dataexport_group translate="label">
|
26 |
-
<label>Related Products - Advanced Options</label>
|
27 |
-
<frontend_type>text</frontend_type>
|
28 |
-
<sort_order>1</sort_order>
|
29 |
-
<show_in_default>1</show_in_default>
|
30 |
-
<show_in_website>1</show_in_website>
|
31 |
-
<show_in_store>1</show_in_store>
|
32 |
-
<fields>
|
33 |
-
<enabled translate="label">
|
34 |
-
<label>Enable Advanced Options</label>
|
35 |
-
<frontend_type>select</frontend_type>
|
36 |
-
<sort_order>1</sort_order>
|
37 |
-
<show_in_default>1</show_in_default>
|
38 |
-
<show_in_website>1</show_in_website>
|
39 |
-
<show_in_store>1</show_in_store>
|
40 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
41 |
-
</enabled>
|
42 |
-
<enabled_cron translate="label">
|
43 |
-
<label>Enable Scheduled Exports</label>
|
44 |
-
<frontend_type>select</frontend_type>
|
45 |
-
<sort_order>2</sort_order>
|
46 |
-
<show_in_default>1</show_in_default>
|
47 |
-
<show_in_website>1</show_in_website>
|
48 |
-
<show_in_store>1</show_in_store>
|
49 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
50 |
-
<comment>Scheduled exports help us to keep your related products fresh.</comment>
|
51 |
-
</enabled_cron>
|
52 |
-
<!--
|
53 |
-
<enable_gzip translate="label">
|
54 |
-
<label>Enable GZip Compression</label>
|
55 |
-
<frontend_type>select</frontend_type>
|
56 |
-
<sort_order>2</sort_order>
|
57 |
-
<show_in_default>1</show_in_default>
|
58 |
-
<show_in_website>1</show_in_website>
|
59 |
-
<show_in_store>1</show_in_store>
|
60 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
61 |
-
<comment>Exported data can be compressed before being sent</comment>
|
62 |
-
</enable_gzip>
|
63 |
-
-->
|
64 |
-
<!--
|
65 |
-
<export_url>
|
66 |
-
<label>Data Export Endpoint URL</label>
|
67 |
-
<frontend_type>text</frontend_type>
|
68 |
-
<sort_order>3</sort_order>
|
69 |
-
<show_in_default>1</show_in_default>
|
70 |
-
<show_in_website>1</show_in_website>
|
71 |
-
<show_in_store>1</show_in_store>
|
72 |
-
<comment>location the data will be exported to **to be removed**</comment>
|
73 |
-
</export_url>
|
74 |
-
-->
|
75 |
-
<export_orders translate="label">
|
76 |
-
<label>Export Orders?</label>
|
77 |
-
<frontend_type>select</frontend_type>
|
78 |
-
<sort_order>10</sort_order>
|
79 |
-
<show_in_default>1</show_in_default>
|
80 |
-
<show_in_website>1</show_in_website>
|
81 |
-
<show_in_store>1</show_in_store>
|
82 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
83 |
-
<comment>Sending us your order information will allow us to add "Customers who bought this also bought..." type related products.</comment>
|
84 |
-
</export_orders>
|
85 |
-
|
86 |
-
<order_status translate="label">
|
87 |
-
<label>Order Export Status</label>
|
88 |
-
<comment>Only orders with this status will be exported.</comment>
|
89 |
-
<frontend_type>multiselect</frontend_type>
|
90 |
-
<sort_order>11</sort_order>
|
91 |
-
<!-- for multiselects! -->
|
92 |
-
<show_in_default>1</show_in_default>
|
93 |
-
<show_in_website>1</show_in_website>
|
94 |
-
<show_in_store>1</show_in_store>
|
95 |
-
<source_model>dataexport/orderstatus</source_model>
|
96 |
-
</order_status>
|
97 |
-
|
98 |
-
<export_customers translate="label">
|
99 |
-
<label>Export Customers?</label>
|
100 |
-
<frontend_type>select</frontend_type>
|
101 |
-
<sort_order>20</sort_order>
|
102 |
-
<show_in_default>1</show_in_default>
|
103 |
-
<show_in_website>1</show_in_website>
|
104 |
-
<show_in_store>1</show_in_store>
|
105 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
106 |
-
<comment>Exporting your customers enables us to do social targeting.</comment>
|
107 |
-
</export_customers>
|
108 |
-
<export_carts translate="label">
|
109 |
-
<label>Export Abandoned Carts?</label>
|
110 |
-
<frontend_type>select</frontend_type>
|
111 |
-
<sort_order>30</sort_order>
|
112 |
-
<show_in_default>1</show_in_default>
|
113 |
-
<show_in_website>1</show_in_website>
|
114 |
-
<show_in_store>1</show_in_store>
|
115 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
116 |
-
<comment>Exporting your abandoned carts gives us additional data on which products are chosen together.</comment>
|
117 |
-
</export_carts>
|
118 |
-
|
119 |
-
<!-- This is covered by "Export Orders" - no need for extra field.
|
120 |
-
<export_productids translate="label">
|
121 |
-
<label>Export Product IDs to Header?</label>
|
122 |
-
<frontend_type>select</frontend_type>
|
123 |
-
<sort_order>10</sort_order>
|
124 |
-
<show_in_default>1</show_in_default>
|
125 |
-
<show_in_website>1</show_in_website>
|
126 |
-
<show_in_store>1</show_in_store>
|
127 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
128 |
-
<comment>Product ID hash will be added to the head of the document.</comment>
|
129 |
-
</export_productids>
|
130 |
-
-->
|
131 |
-
|
132 |
-
</fields>
|
133 |
-
</dataexport_group>
|
134 |
-
</groups>
|
135 |
-
</dataexport>
|
136 |
-
</sections>
|
137 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/Dataexport/sql/dataexport_setup/mysql4-install-0.1.0.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$installer = $this;
|
3 |
-
$installer->startSetup();
|
4 |
-
//$installer->run("create table tablename(tablename_id int not null auto_increment, name varchar(100), primary key(tablename_id));
|
5 |
-
// insert into tablename values(1,'tablename1');
|
6 |
-
// insert into tablename values(2,'tablename2');
|
7 |
-
//");
|
8 |
-
//demo
|
9 |
-
//Mage::getModel('core/url_rewrite')->setId(null);
|
10 |
-
//demo
|
11 |
-
$installer->endSetup();
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Advertise/RelatedProducts/Block/Related.php
CHANGED
@@ -125,6 +125,11 @@ class Advertise_RelatedProducts_Block_Related extends Mage_Catalog_Block_Product
|
|
125 |
if ($id) {
|
126 |
$toexclude[] = $id;
|
127 |
}
|
|
|
|
|
|
|
|
|
|
|
128 |
$randCollection->addIdFilter($toexclude, true);
|
129 |
foreach($randCollection as $randProduct)
|
130 |
{
|
125 |
if ($id) {
|
126 |
$toexclude[] = $id;
|
127 |
}
|
128 |
+
// Don't include basket items as related products
|
129 |
+
$session = Mage::getSingleton('checkout/session');
|
130 |
+
foreach ($session->getQuote()->getAllVisibleItems() as $item) {
|
131 |
+
$toexclude[] = $item->getProductId();
|
132 |
+
}
|
133 |
$randCollection->addIdFilter($toexclude, true);
|
134 |
foreach($randCollection as $randProduct)
|
135 |
{
|
app/code/community/Advertise/RelatedProducts/Helper/Data.php
CHANGED
@@ -9,95 +9,6 @@
|
|
9 |
class Advertise_RelatedProducts_Helper_Data extends Mage_Core_Helper_Abstract
|
10 |
{
|
11 |
|
12 |
-
public function getAdvertiseHeaderScript()
|
13 |
-
{
|
14 |
-
if(Mage::registry('current_product')) {
|
15 |
-
$prodid = Mage::registry('current_product')->getId();
|
16 |
-
} else {
|
17 |
-
$prodid = '';
|
18 |
-
}
|
19 |
-
if(Mage::getModel('dataexport/config')->isHeadProductIdsEnabled()) {
|
20 |
-
$basket=$this->getProductDataString();
|
21 |
-
} else {
|
22 |
-
$basket = '';
|
23 |
-
}
|
24 |
-
|
25 |
-
$jsoutput = "
|
26 |
-
var adv_store_base_url = '".Mage::getBaseUrl()."';
|
27 |
-
var adv_reload = true;
|
28 |
-
var adv_productid = '".$prodid."';
|
29 |
-
var adv_bsk = '".$basket."';
|
30 |
-
";
|
31 |
-
// var cartcount = '".Mage::helper('checkout/cart')->getCart()->getItemsCount()."';
|
32 |
-
|
33 |
-
return $jsoutput;
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Get the product IDs to output, but first check we want to show them
|
38 |
-
* just a shortcut for displaying inside template files
|
39 |
-
*
|
40 |
-
* @return string
|
41 |
-
*/
|
42 |
-
public function getHeaderProductIds()
|
43 |
-
{
|
44 |
-
if(Mage::getModel('dataexport/config')->isHeadProductIdsEnabled()) {
|
45 |
-
return $this->getProductDataString();
|
46 |
-
}
|
47 |
-
|
48 |
-
return "";
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Get product data as a string
|
53 |
-
*
|
54 |
-
* @return string|FALSE
|
55 |
-
*/
|
56 |
-
public function getProductDataString()
|
57 |
-
{
|
58 |
-
if(Mage::helper('checkout/cart')->getCart()->getItemsCount() < 1) {
|
59 |
-
return FALSE;
|
60 |
-
}
|
61 |
-
|
62 |
-
//$cartHelper = Mage::helper('checkout/cart');
|
63 |
-
//$items = $cartHelper->getCart()->getItems();
|
64 |
-
//$cart = Mage::helper('checkout/cart')->getCart()->getItemsCount();
|
65 |
-
$session = Mage::getSingleton('checkout/session');
|
66 |
-
$products = array();
|
67 |
-
//$productIds = Mage::getModel('checkout/cart')->getProductIds();
|
68 |
-
//return implode(',', $productIds);
|
69 |
-
|
70 |
-
// getAllItems OR getAllVisibleItems()
|
71 |
-
foreach ($session->getQuote()->getAllVisibleItems() as $item) {
|
72 |
-
$products[] = $item->getProductId();
|
73 |
-
}
|
74 |
-
|
75 |
-
if( ! empty($products)) {
|
76 |
-
//return Mage::helper('core')->encrypt(implode(',', $products));
|
77 |
-
return implode(',', $products);
|
78 |
-
}
|
79 |
-
|
80 |
-
return FALSE;
|
81 |
-
}
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Get product ids from encrypted string
|
85 |
-
*
|
86 |
-
* @param string
|
87 |
-
* @return array|FALSE
|
88 |
-
*/
|
89 |
-
// NOT CURRENTLY USED AS NO ENCRYPTION DONE
|
90 |
-
public function getProductIdsFromString($dataString)
|
91 |
-
{
|
92 |
-
$return = array();
|
93 |
-
$productString = Mage::helper('core')->decrypt($dataString);
|
94 |
-
|
95 |
-
if( ! empty($productString)) {
|
96 |
-
$return = explode(',', $productString);
|
97 |
-
}
|
98 |
-
|
99 |
-
return $return;
|
100 |
-
}
|
101 |
}
|
102 |
|
103 |
?>
|
9 |
class Advertise_RelatedProducts_Helper_Data extends Mage_Core_Helper_Abstract
|
10 |
{
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
}
|
13 |
|
14 |
?>
|
app/code/community/Advertise/RelatedProducts/controllers/RelatedProductsController.php
CHANGED
@@ -8,15 +8,6 @@ class Advertise_RelatedProducts_RelatedProductsController extends Mage_Core_Cont
|
|
8 |
{
|
9 |
$this->loadLayout();
|
10 |
$this->_title($this->__("Adverti.se Related Products"));
|
11 |
-
|
12 |
-
//$this->_addContent($this->getLayout()->createBlock('relatedproducts'));
|
13 |
-
$block = $this->getLayout()->createBlock(
|
14 |
-
'Mage_Core_Block_Template',
|
15 |
-
'relatedproducts',
|
16 |
-
array('template' => 'advertise/relatedproducts.phtml')
|
17 |
-
);
|
18 |
-
$this->getLayout()->getBlock('content')->append($block);
|
19 |
-
|
20 |
$this->renderLayout();
|
21 |
}
|
22 |
|
8 |
{
|
9 |
$this->loadLayout();
|
10 |
$this->_title($this->__("Adverti.se Related Products"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
$this->renderLayout();
|
12 |
}
|
13 |
|
app/design/adminhtml/default/default/layout/dataexport.xml
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
<dataexport_adminhtml_dataexportbackend_index>
|
4 |
-
<reference name="content">
|
5 |
-
<block type="dataexport/adminhtml_dataexportbackend" name="dataexportbackend" template="dataexport/dataexportbackend.phtml"/>
|
6 |
-
</reference>
|
7 |
-
</dataexport_adminhtml_dataexportbackend_index>
|
8 |
-
|
9 |
-
<dataexport_adminhtml_dataexportbackend_export>
|
10 |
-
<reference name="content">
|
11 |
-
<block type="dataexport/adminhtml_dataexportbackend" name="dataexportbackend" template="dataexport/dataexportbackend.phtml"/>
|
12 |
-
</reference>
|
13 |
-
</dataexport_adminhtml_dataexportbackend_export>
|
14 |
-
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/dataexport/dataexportbackend.phtml
DELETED
@@ -1,142 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package dataexport
|
4 |
-
*
|
5 |
-
*/
|
6 |
-
?>
|
7 |
-
<div class="content-header">
|
8 |
-
<table cellspacing="0">
|
9 |
-
<tbody>
|
10 |
-
<tr>
|
11 |
-
<td style="width:50%;">
|
12 |
-
<h3 class="icon-head head-cms-page">Adverti.se Related Products (Advanced)</h3>
|
13 |
-
</td>
|
14 |
-
<td class="form-buttons">
|
15 |
-
|
16 |
-
</td>
|
17 |
-
</tr>
|
18 |
-
</tbody>
|
19 |
-
</table>
|
20 |
-
</div>
|
21 |
-
|
22 |
-
<table class="form-list">
|
23 |
-
<tr>
|
24 |
-
<td class="label">
|
25 |
-
Related Products (Advanced) Module
|
26 |
-
</td>
|
27 |
-
<td class="value">
|
28 |
-
<strong><?php echo $this->_isEnabled() ?></strong>
|
29 |
-
</td>
|
30 |
-
</tr>
|
31 |
-
<!-- Placeholder for when gzip is implemented
|
32 |
-
<tr>
|
33 |
-
<td class="label">
|
34 |
-
Gzip Compression
|
35 |
-
</td>
|
36 |
-
<td class="value">
|
37 |
-
<strong>Disabled</strong>
|
38 |
-
</td>
|
39 |
-
</tr>
|
40 |
-
-->
|
41 |
-
<tr>
|
42 |
-
<td class="label">
|
43 |
-
Customer Export
|
44 |
-
</td>
|
45 |
-
<td class="value">
|
46 |
-
<strong><?php echo $this->_isCustomersEnabledText() ?></strong>
|
47 |
-
</td>
|
48 |
-
</tr>
|
49 |
-
<tr>
|
50 |
-
<td class="label">
|
51 |
-
Order Export
|
52 |
-
</td>
|
53 |
-
<td class="value">
|
54 |
-
<strong><?php echo $this->_isOrdersEnabledText() ?></strong>
|
55 |
-
</td>
|
56 |
-
</tr>
|
57 |
-
<tr>
|
58 |
-
<td class="label">
|
59 |
-
Abandoned Carts Export
|
60 |
-
</td>
|
61 |
-
<td class="value">
|
62 |
-
<strong><?php echo $this->_isCartsEnabledText() ?></strong>
|
63 |
-
</td>
|
64 |
-
</tr>
|
65 |
-
</table>
|
66 |
-
|
67 |
-
<div class="content-header">
|
68 |
-
<h3>Export Options</h3>
|
69 |
-
</div>
|
70 |
-
|
71 |
-
<form id="dataexportForm" action="<?php echo $this->_getFormAction() ?>" method="post">
|
72 |
-
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
73 |
-
<table class="form-list">
|
74 |
-
<tr>
|
75 |
-
<td class="label">
|
76 |
-
<label for="date_from">Date from</label>
|
77 |
-
</td>
|
78 |
-
<td class="value">
|
79 |
-
<input id="date_from" name="date_from" type="text" class="text-input" value="" />
|
80 |
-
<img title="Select date" id="fromTrigger"
|
81 |
-
src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) . 'adminhtml/default/default/images/grid-cal.gif' ?>"
|
82 |
-
class="v-middle"
|
83 |
-
/>
|
84 |
-
</td>
|
85 |
-
</tr>
|
86 |
-
<tr>
|
87 |
-
<td class="label">
|
88 |
-
<label for="date_to">Date To</label>
|
89 |
-
</td>
|
90 |
-
<td class="value">
|
91 |
-
<input id="date_to" name="date_to" type="text" class="text-input" value="" />
|
92 |
-
<img title="Select date" id="toTrigger"
|
93 |
-
src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) . 'adminhtml/default/default/images/grid-cal.gif' ?>"
|
94 |
-
class="v-middle"
|
95 |
-
/>
|
96 |
-
</td>
|
97 |
-
</tr>
|
98 |
-
<tr>
|
99 |
-
<td colspan="2">
|
100 |
-
<?php $disabled = $this->_getConfig()->getIsEnabled() ? '' : ' disabled="disabled"' ?>
|
101 |
-
<?php $classDisabled = $this->_getConfig()->getIsEnabled() ? '' : ' disabled' ?>
|
102 |
-
<button<?php echo $disabled ?> onclick="" class="scalable<?php echo $classDisabled ?>" type="submit" title="Run Export" id="exportBtn">
|
103 |
-
<span><span><span>Run Export</span></span></span>
|
104 |
-
</button>
|
105 |
-
</td>
|
106 |
-
</tr>
|
107 |
-
</table>
|
108 |
-
</form>
|
109 |
-
|
110 |
-
<script type="text/javascript">
|
111 |
-
//<![CDATA[
|
112 |
-
//var editForm = new varienForm('dataexportForm');
|
113 |
-
Calendar.setup({
|
114 |
-
inputField : 'date_from',
|
115 |
-
ifFormat : '%m/%e/%y',
|
116 |
-
button : 'fromTrigger',
|
117 |
-
align : 'Bl',
|
118 |
-
singleClick : true
|
119 |
-
});
|
120 |
-
|
121 |
-
Calendar.setup({
|
122 |
-
inputField : 'date_to',
|
123 |
-
ifFormat : '%m/%e/%y',
|
124 |
-
button : 'toTrigger',
|
125 |
-
align : 'Bl',
|
126 |
-
singleClick : true
|
127 |
-
});
|
128 |
-
//]]>
|
129 |
-
|
130 |
-
/*var reloadurl = '<?php echo $this->getUrl('router/controller/action') ?>';
|
131 |
-
Element.show('loadingmask');
|
132 |
-
new Ajax.Request(reloadurl, {
|
133 |
-
method: 'post',
|
134 |
-
parameters: "Params_Here",
|
135 |
-
onComplete: function(transport) {
|
136 |
-
Element.hide('loadingmask');
|
137 |
-
$('output-div').innerHTML = "";
|
138 |
-
$('output-div').innerHTML = transport.responseText;
|
139 |
-
|
140 |
-
}
|
141 |
-
});*/
|
142 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/layout/advertiserelatedproducts.xml
CHANGED
@@ -1,13 +1,5 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<layout version="0.1.0">
|
3 |
-
<!-- Override the default related.phtml -->
|
4 |
-
<advertise_relatedproducts_catalog_index>
|
5 |
-
<reference name="catalog.product.related">
|
6 |
-
<action method="setTemplate">
|
7 |
-
<template>advertise_relatedproducts/related.phtml</template>
|
8 |
-
</action>
|
9 |
-
</reference>
|
10 |
-
</advertise_relatedproducts_catalog_index>
|
11 |
|
12 |
<!-- Add Adverti.se scripts and css to head of product pages (handle for product pages is 'catalog_product_view') -->
|
13 |
<catalog_product_view>
|
@@ -20,16 +12,16 @@
|
|
20 |
</block>
|
21 |
|
22 |
<!-- Adverti.se JavaScript for related products -->
|
23 |
-
<block type="core/text" name="adverti.se.
|
24 |
<action method="setText">
|
25 |
-
<text><![CDATA[<script type="text/javascript" src="http://retail.adverti.se/js/
|
26 |
</action>
|
27 |
</block>
|
28 |
|
29 |
<!-- Adverti.se CSS for related products -->
|
30 |
-
<block type="core/text" name="adverti.se.
|
31 |
<action method="setText">
|
32 |
-
<text><![CDATA[<link rel="stylesheet" type="text/css" href="http://retail.adverti.se/css/
|
33 |
</action>
|
34 |
</block>
|
35 |
</reference>
|
1 |
<?xml version="1.0"?>
|
2 |
<layout version="0.1.0">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
<!-- Add Adverti.se scripts and css to head of product pages (handle for product pages is 'catalog_product_view') -->
|
5 |
<catalog_product_view>
|
12 |
</block>
|
13 |
|
14 |
<!-- Adverti.se JavaScript for related products -->
|
15 |
+
<block type="core/text" name="adverti.se.retailintelligence.js">
|
16 |
<action method="setText">
|
17 |
+
<text><![CDATA[<script type="text/javascript" src="http://retail.adverti.se/js/retailintelligence-1_0_0.js"></script>]]></text>
|
18 |
</action>
|
19 |
</block>
|
20 |
|
21 |
<!-- Adverti.se CSS for related products -->
|
22 |
+
<block type="core/text" name="adverti.se.retailintelligence.css">
|
23 |
<action method="setText">
|
24 |
+
<text><![CDATA[<link rel="stylesheet" type="text/css" href="http://retail.adverti.se/css/retailintelligence-1_0_0.css" media="all" />]]></text>
|
25 |
</action>
|
26 |
</block>
|
27 |
</reference>
|
app/design/frontend/base/default/layout/dataexport.xml
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
<dataexport_index_index>
|
4 |
-
<reference name="root">
|
5 |
-
<action method="setTemplate"><template>page/1column.phtml</template></action>
|
6 |
-
</reference>
|
7 |
-
|
8 |
-
<reference name="content">
|
9 |
-
<block type="dataexport/index" name="dataexport_index" template="dataexport/index.phtml"/>
|
10 |
-
</reference>
|
11 |
-
</dataexport_index_index>
|
12 |
-
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/layout/local.xml
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
<!-- handle for product pages is 'catalog_product_view' -->
|
4 |
-
<catalog_product_view>
|
5 |
-
<block type="catalog/product_list_related" name="catalog.product.related" before="-" template="advertise/relatedproducts/related.phtml"/>
|
6 |
-
</catalog_product_view>
|
7 |
-
|
8 |
-
<!-- Is this a different way of doing the same thing? Doesn't seem to work though...-->
|
9 |
-
<!--
|
10 |
-
<advertise_relatedproducts_catalog_index>
|
11 |
-
<reference name="catalog.product.related">
|
12 |
-
<action method="setTemplate">
|
13 |
-
<template>advertise_relatedproducts/related.phtml</template>
|
14 |
-
</action>
|
15 |
-
</reference>
|
16 |
-
</advertise_relatedproducts_catalog_index>
|
17 |
-
-->
|
18 |
-
</layout>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/advertise/relatedproducts/related.phtml
DELETED
@@ -1,92 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Overrides Magento base template file base/default/template/catalog/product/list/related.phtml
|
4 |
-
* @package Advertise_RelatedProducts
|
5 |
-
*/
|
6 |
-
?>
|
7 |
-
|
8 |
-
<div id="advrelated">
|
9 |
-
<script type="text/javascript">if(adv_reload){loadAdvertiseRelatedProducts();adv_reload=false;}</script>
|
10 |
-
<?php
|
11 |
-
/* TODO: Replace copied Magento code with a call to load directly from default Magento installation
|
12 |
-
* using something like the following:
|
13 |
-
$block = $this->getLayout()->createBlock(
|
14 |
-
'Mage_Core_Block_Template',
|
15 |
-
'relatedproducts',
|
16 |
-
array('template' => 'advertise/relatedproducts.phtml')
|
17 |
-
);
|
18 |
-
$this->getLayout()->getBlock('content')->append($block);
|
19 |
-
*/
|
20 |
-
?>
|
21 |
-
<!-- START OF DEFAULT MAGENTO RELATED.PHP ------------------------------------->
|
22 |
-
<?php if($this->getItems()->getSize()): ?>
|
23 |
-
<div class="block block-related">
|
24 |
-
<div class="block-title">
|
25 |
-
<strong><span><?php echo $this->__('Related Products') ?></span></strong>
|
26 |
-
</div>
|
27 |
-
<div class="block-content">
|
28 |
-
<p class="block-subtitle"><?php echo $this->__('Check items to add to the cart or') ?> <a href="#" onclick="selectAllRelated(this); return false;"><?php echo $this->__('select all') ?></a></p>
|
29 |
-
<ol class="mini-products-list" id="block-related">
|
30 |
-
<?php foreach($this->getItems() as $_item): ?>
|
31 |
-
<li class="item">
|
32 |
-
<?php if(!$_item->isComposite() && $_item->isSaleable()): ?>
|
33 |
-
<?php if (!$_item->getRequiredOptions()): ?>
|
34 |
-
<input type="checkbox" class="checkbox related-checkbox" id="related-checkbox<?php echo $_item->getId() ?>" name="related_products[]" value="<?php echo $_item->getId() ?>" />
|
35 |
-
<?php endif; ?>
|
36 |
-
<?php endif; ?>
|
37 |
-
<div class="product">
|
38 |
-
<a href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_item->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(50) ?>" width="50" height="50" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" /></a>
|
39 |
-
<div class="product-details">
|
40 |
-
<p class="product-name"><a href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->htmlEscape($_item->getName()) ?></a></p>
|
41 |
-
<?php echo $this->getPriceHtml($_item, true, '-related') ?>
|
42 |
-
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
43 |
-
<a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a>
|
44 |
-
<?php endif; ?>
|
45 |
-
</div>
|
46 |
-
</div>
|
47 |
-
</li>
|
48 |
-
<?php endforeach ?>
|
49 |
-
</ol>
|
50 |
-
<script type="text/javascript">decorateList('block-related', 'none-recursive')</script>
|
51 |
-
</div>
|
52 |
-
<script type="text/javascript">
|
53 |
-
//<![CDATA[
|
54 |
-
$$('.related-checkbox').each(function(elem){
|
55 |
-
Event.observe(elem, 'click', addRelatedToProduct)
|
56 |
-
});
|
57 |
-
|
58 |
-
var relatedProductsCheckFlag = false;
|
59 |
-
function selectAllRelated(txt){
|
60 |
-
if (relatedProductsCheckFlag == false) {
|
61 |
-
$$('.related-checkbox').each(function(elem){
|
62 |
-
elem.checked = true;
|
63 |
-
});
|
64 |
-
relatedProductsCheckFlag = true;
|
65 |
-
txt.innerHTML="<?php echo $this->__('unselect all') ?>";
|
66 |
-
} else {
|
67 |
-
$$('.related-checkbox').each(function(elem){
|
68 |
-
elem.checked = false;
|
69 |
-
});
|
70 |
-
relatedProductsCheckFlag = false;
|
71 |
-
txt.innerHTML="<?php echo $this->__('select all') ?>";
|
72 |
-
}
|
73 |
-
addRelatedToProduct();
|
74 |
-
}
|
75 |
-
|
76 |
-
function addRelatedToProduct(){
|
77 |
-
var checkboxes = $$('.related-checkbox');
|
78 |
-
var values = [];
|
79 |
-
for(var i=0;i<checkboxes.length;i++){
|
80 |
-
if(checkboxes[i].checked) values.push(checkboxes[i].value);
|
81 |
-
}
|
82 |
-
if($('related-products-field')){
|
83 |
-
$('related-products-field').value = values.join(',');
|
84 |
-
}
|
85 |
-
}
|
86 |
-
//]]>
|
87 |
-
</script>
|
88 |
-
</div>
|
89 |
-
<?php endif ?>
|
90 |
-
<!-- END OF DEFAULT MAGENTO RELATED.PHP --------------------------------------->
|
91 |
-
<div><a href="http://www.adverti.se" target="_blank"><img class="adv_logo" align="right" src="http://www.adverti.se/img/magento/frontend-advertise-logo.png" height="20" width="80" alt="Adverti.se" /></a></div>
|
92 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/dataexport/index.phtml
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* To change this template, choose Tools | Templates
|
5 |
-
* and open the template in the editor.
|
6 |
-
*/
|
7 |
-
?>
|
8 |
-
TEST
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/etc/modules/Advertise_Dataexport.xml
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<config>
|
3 |
-
<modules>
|
4 |
-
<Advertise_Dataexport>
|
5 |
-
<active>true</active>
|
6 |
-
<codePool>community</codePool>
|
7 |
-
<version>0.1.0</version>
|
8 |
-
</Advertise_Dataexport>
|
9 |
-
</modules>
|
10 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,22 +1,20 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>AdvertiseRelatedProducts</name>
|
4 |
-
<version>1.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Adverti.se Related Products for Magento - Dynamically Updated and Individually Personalised</summary>
|
10 |
<description>With Adverti.se Related Products you get automated dynamic related products.</description>
|
11 |
-
<notes>v1.1.0
|
12 |

|
13 |
-
|
14 |
-

|
15 |
-
It also moves to stable branch.</notes>
|
16 |
<authors><author><name>Michael</name><user>Oxley</user><email>mike@adverti.se</email></author></authors>
|
17 |
-
<date>2012-
|
18 |
-
<time>
|
19 |
-
<contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Advertise_RelatedProducts.xml" hash="7d880814a0e0f3db2d70cf18a819df36"
|
20 |
<compatible/>
|
21 |
-
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>AdvertiseCommunity</name><channel>community</channel><min>1.
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>AdvertiseRelatedProducts</name>
|
4 |
+
<version>1.1.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Adverti.se Related Products for Magento - Dynamically Updated and Individually Personalised</summary>
|
10 |
<description>With Adverti.se Related Products you get automated dynamic related products.</description>
|
11 |
+
<notes>v1.1.1 - This version has removed some common product code into the community package 1.2.0
|
12 |

|
13 |
+
</notes>
|
|
|
|
|
14 |
<authors><author><name>Michael</name><user>Oxley</user><email>mike@adverti.se</email></author></authors>
|
15 |
+
<date>2012-10-07</date>
|
16 |
+
<time>13:21:55</time>
|
17 |
+
<contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Advertise_RelatedProducts.xml" hash="7d880814a0e0f3db2d70cf18a819df36"/></dir></dir><dir name="code"><dir name="community"><dir name="Advertise"><dir name="RelatedProducts"><dir name="Block"><dir name="Adminhtml"><file name="RelatedProducts.php" hash="bf83e04772f63d840d5240109b7f0ddb"/></dir><file name="Index.php" hash="1a29b9a0cefc7ee40f0c1f4f0d1737a4"/><file name="Related.php" hash="9741ce76d47ebf68935538800f325e7a"/></dir><dir name="Helper"><file name="Data.php" hash="b94a3f896b1dc7ea574bf287e852257a"/></dir><dir name="Model"><file name="Config.php" hash="1c21e575b9a1cff46da1c300a8f967e9"/><dir name="Resource"><file name="Setup.php" hash="27ecf3f264e8617c8d204ffdbd85eaee"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="RelatedProductsController.php" hash="b0f198b978db71f4d33e68830684b46f"/></dir><file name="IndexController.php" hash="b7e7f7cbdf6c7f37aa8f543897be592a"/><file name="RelatedProductsController.php" hash="987796c54d8a94f206862cbcd959b8e7"/></dir><dir name="data"><dir name="relatedproducts_setup"><file name="data-install-1.0.1.php" hash="9c7b575ef4e16e61a6491ae6b3c9f64f"/><file name="data-upgrade-1.0.0-1.0.1.php" hash="ff4c3d76476d9fbabdc5e02b9f3413b1"/></dir></dir><dir name="etc"><file name="config.xml" hash="9ac0c607fc9e0924afa2c01d8bd7d9db"/><file name="system.xml" hash="dfe73d77d21aa76c4eb0d02e95b65c5e"/></dir><dir name="sql"><dir name="relatedproducts_setup"><file name="install-1.0.1.php" hash="8c2149f87b02b37efc2a755705f24a61"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="advertiserelatedproducts.xml" hash="f9ff40283aab0531320ae896e70983d5"/></dir></dir></dir></dir></dir></dir><dir name="."><file name="README-Advertise-Related-Products.txt" hash="1d756ded96e8e8800589148ae6b9c519"/></dir></target></contents>
|
18 |
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>AdvertiseCommunity</name><channel>community</channel><min>1.2.0</min><max>1.2.9</max></package></required></dependencies>
|
20 |
</package>
|