Mage_PDF_per_Product - Version 3.0.2

Version Notes

3.0.2 - Added Magento 1.6 compatibility and Tier Price support in data file

Download this release

Release Info

Developer Magento Core Team
Extension Mage_PDF_per_Product
Version 3.0.2
Comparing to
See all releases


Code changes from version 3.0.1 to 3.0.2

app/code/community/Mage/Codi/Helper/Data.php CHANGED
@@ -1,185 +1,246 @@
1
- <?php
2
- class Mage_Codi_Helper_Data extends Mage_Core_Helper_Abstract
3
- {
4
- function output_file($file, $name, $mime_type='')
5
- {
6
- /*
7
- This function takes a path to a file to output ($file),
8
- the filename that the browser will see ($name) and
9
- the MIME type of the file ($mime_type, optional).
10
-
11
- */
12
- if(!is_readable($file)) die('File not found or inaccessible!');
13
-
14
- $size = filesize($file);
15
- $name = rawurldecode($name);
16
-
17
- /* Figure out the MIME type (if not specified) */
18
- $known_mime_types=array(
19
- "pdf" => "application/pdf",
20
- "txt" => "text/plain",
21
- "html" => "text/html",
22
- "htm" => "text/html",
23
- "exe" => "application/octet-stream",
24
- "zip" => "application/zip",
25
- "doc" => "application/msword",
26
- "xls" => "application/vnd.ms-excel",
27
- "ppt" => "application/vnd.ms-powerpoint",
28
- "gif" => "image/gif",
29
- "png" => "image/png",
30
- "jpeg"=> "image/jpg",
31
- "jpg" => "image/jpg",
32
- "php" => "text/plain"
33
- );
34
-
35
- if($mime_type==''){
36
- $file_extension = strtolower(substr(strrchr($file,"."),1));
37
- if(array_key_exists($file_extension, $known_mime_types)){
38
- $mime_type=$known_mime_types[$file_extension];
39
- } else {
40
- $mime_type="application/force-download";
41
- };
42
- };
43
-
44
- @ob_end_clean(); //turn off output buffering to decrease cpu usage
45
-
46
- // required for IE, otherwise Content-Disposition may be ignored
47
- if(ini_get('zlib.output_compression'))
48
- ini_set('zlib.output_compression', 'Off');
49
-
50
- header('Content-Type: ' . $mime_type);
51
- header('Content-Disposition: attachment; filename="'.$name.'"');
52
- header("Content-Transfer-Encoding: binary");
53
- header('Accept-Ranges: bytes');
54
-
55
- /* The three lines below basically make the
56
- download non-cacheable */
57
- header("Cache-control: private");
58
- header('Pragma: private');
59
- header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
60
-
61
- // multipart-download and download resuming support
62
- if(isset($_SERVER['HTTP_RANGE']))
63
- {
64
- list($a, $range) = explode("=",$_SERVER['HTTP_RANGE'],2);
65
- list($range) = explode(",",$range,2);
66
- list($range, $range_end) = explode("-", $range);
67
- $range=intval($range);
68
- if(!$range_end) {
69
- $range_end=$size-1;
70
- } else {
71
- $range_end=intval($range_end);
72
- }
73
-
74
- $new_length = $range_end-$range+1;
75
- header("HTTP/1.1 206 Partial Content");
76
- header("Content-Length: $new_length");
77
- header("Content-Range: bytes $range-$range_end/$size");
78
- } else {
79
- $new_length=$size;
80
- header("Content-Length: ".$size);
81
- }
82
-
83
- /* output the file itself */
84
- $chunksize = 1*(1024*1024); //you may want to change this
85
- $bytes_send = 0;
86
- if ($file = fopen($file, 'r'))
87
- {
88
- if(isset($_SERVER['HTTP_RANGE']))
89
- fseek($file, $range);
90
-
91
- while(!feof($file) &&
92
- (!connection_aborted()) &&
93
- ($bytes_send<$new_length)
94
- )
95
- {
96
- $buffer = fread($file, $chunksize);
97
- print($buffer); //echo($buffer); // is also possible
98
- flush();
99
- $bytes_send += strlen($buffer);
100
- }
101
- fclose($file);
102
- } else die('Error - can not open file.');
103
-
104
- die();
105
- }
106
-
107
- function deleteFile($basePath='',$filename='')
108
- {
109
- @unlink($basePath."CODdataFiles/".$filename);
110
- }
111
- //function for get the theme
112
- function getTheme()
113
- {
114
- foreach (Mage::app()->getWebsites() as $website)
115
- {
116
- $defaultGroup = $website->getDefaultGroup();
117
- $StoreId = $defaultGroup->getDefaultStoreId();
118
- }
119
-
120
- $design = Mage::getSingleton('core/design')->loadChange($StoreId);
121
-
122
- $package = $design->getPackage();
123
- $default_theme = $design->getTheme();
124
-
125
- if ( $package == "" && $default_theme == "" ){
126
-
127
- $package = Mage::getStoreConfig('design/package/name', $StoreId);
128
- $default_theme = Mage::getStoreConfig('design/theme/default', $StoreId);
129
- }
130
-
131
- if ( $package == "" ) $package = "default";
132
- if ( $default_theme == "" ) $default_theme = "default";
133
-
134
- return $package.'/'.$default_theme;
135
-
136
-
137
-
138
- }
139
- function array2json($arr) {
140
-
141
- if(function_exists('json_encode')) return json_encode($arr); //Lastest versions of PHP already has this functionality.
142
- $parts = array();
143
- $is_list = false;
144
-
145
- //Find out if the given array is a numerical array
146
- $keys = array_keys($arr);
147
- $max_length = count($arr)-1;
148
- if(($keys[0] == 0) and ($keys[$max_length] == $max_length)) {//See if the first key is 0 and last key is length - 1
149
- $is_list = true;
150
- for($i=0; $i<count($keys); $i++) { //See if each key correspondes to its position
151
- if($i != $keys[$i]) { //A key fails at position check.
152
- $is_list = false; //It is an associative array.
153
- break;
154
- }
155
- }
156
- }
157
-
158
- foreach($arr as $key=>$value) {
159
- if(is_array($value)) { //Custom handling for arrays
160
- if($is_list) $parts[] = array2json($value); /* :RECURSION: */
161
- else $parts[] = '"' . $key . '":' . array2json($value); /* :RECURSION: */
162
- } else {
163
- $str = '';
164
- if(!$is_list) $str = '"' . $key . '":';
165
-
166
- //Custom handling for multiple data types
167
- if(is_numeric($value)) $str .= $value; //Numbers
168
- elseif($value === false) $str .= 'false'; //The booleans
169
- elseif($value === true) $str .= 'true';
170
- else $str .= '"' . addslashes($value) . '"'; //All other things
171
- // :TODO: Is there any more datatype we should be in the lookout for? (Object?)
172
-
173
- $parts[] = $str;
174
- }
175
- }
176
- $json = implode(',',$parts);
177
-
178
- if($is_list) return '[' . $json . ']';//Return numerical JSON
179
- return '{' . $json . '}';//Return associative JSON
180
- }
181
-
182
-
183
-
184
- }
185
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Mage_Codi_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ function output_file($file, $name, $mime_type='')
5
+ {
6
+ /*
7
+ This function takes a path to a file to output ($file),
8
+ the filename that the browser will see ($name) and
9
+ the MIME type of the file ($mime_type, optional).
10
+
11
+ */
12
+ if(!is_readable($file)) die('File not found or inaccessible!');
13
+
14
+ $size = filesize($file);
15
+ $name = rawurldecode($name);
16
+
17
+ /* Figure out the MIME type (if not specified) */
18
+ $known_mime_types=array(
19
+ "pdf" => "application/pdf",
20
+ "txt" => "text/plain",
21
+ "html" => "text/html",
22
+ "htm" => "text/html",
23
+ "exe" => "application/octet-stream",
24
+ "zip" => "application/zip",
25
+ "doc" => "application/msword",
26
+ "xls" => "application/vnd.ms-excel",
27
+ "ppt" => "application/vnd.ms-powerpoint",
28
+ "gif" => "image/gif",
29
+ "png" => "image/png",
30
+ "jpeg"=> "image/jpg",
31
+ "jpg" => "image/jpg",
32
+ "php" => "text/plain"
33
+ );
34
+
35
+ if($mime_type==''){
36
+ $file_extension = strtolower(substr(strrchr($file,"."),1));
37
+ if(array_key_exists($file_extension, $known_mime_types)){
38
+ $mime_type=$known_mime_types[$file_extension];
39
+ } else {
40
+ $mime_type="application/force-download";
41
+ };
42
+ };
43
+
44
+ @ob_end_clean(); //turn off output buffering to decrease cpu usage
45
+
46
+ // required for IE, otherwise Content-Disposition may be ignored
47
+ if(ini_get('zlib.output_compression'))
48
+ ini_set('zlib.output_compression', 'Off');
49
+
50
+ header('Content-Type: ' . $mime_type);
51
+ header('Content-Disposition: attachment; filename="'.$name.'"');
52
+ header("Content-Transfer-Encoding: binary");
53
+ header('Accept-Ranges: bytes');
54
+
55
+ /* The three lines below basically make the
56
+ download non-cacheable */
57
+ header("Cache-control: private");
58
+ header('Pragma: private');
59
+ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
60
+
61
+ // multipart-download and download resuming support
62
+ if(isset($_SERVER['HTTP_RANGE']))
63
+ {
64
+ list($a, $range) = explode("=",$_SERVER['HTTP_RANGE'],2);
65
+ list($range) = explode(",",$range,2);
66
+ list($range, $range_end) = explode("-", $range);
67
+ $range=intval($range);
68
+ if(!$range_end) {
69
+ $range_end=$size-1;
70
+ } else {
71
+ $range_end=intval($range_end);
72
+ }
73
+
74
+ $new_length = $range_end-$range+1;
75
+ header("HTTP/1.1 206 Partial Content");
76
+ header("Content-Length: $new_length");
77
+ header("Content-Range: bytes $range-$range_end/$size");
78
+ } else {
79
+ $new_length=$size;
80
+ header("Content-Length: ".$size);
81
+ }
82
+
83
+ /* output the file itself */
84
+ $chunksize = 1*(1024*1024); //you may want to change this
85
+ $bytes_send = 0;
86
+ if ($file = fopen($file, 'r'))
87
+ {
88
+ if(isset($_SERVER['HTTP_RANGE']))
89
+ fseek($file, $range);
90
+
91
+ while(!feof($file) &&
92
+ (!connection_aborted()) &&
93
+ ($bytes_send<$new_length)
94
+ )
95
+ {
96
+ $buffer = fread($file, $chunksize);
97
+ print($buffer); //echo($buffer); // is also possible
98
+ flush();
99
+ $bytes_send += strlen($buffer);
100
+ }
101
+ fclose($file);
102
+ } else die('Error - can not open file.');
103
+
104
+ die();
105
+ }
106
+
107
+ function deleteFile($basePath='',$filename='')
108
+ {
109
+ @unlink($basePath."CODdataFiles/".$filename);
110
+ }
111
+ //function for get the theme
112
+ function getTheme()
113
+ {
114
+ foreach (Mage::app()->getWebsites() as $website)
115
+ {
116
+ $defaultGroup = $website->getDefaultGroup();
117
+ $StoreId = $defaultGroup->getDefaultStoreId();
118
+ }
119
+
120
+ $design = Mage::getSingleton('core/design')->loadChange($StoreId);
121
+
122
+ $package = $design->getPackage();
123
+ $default_theme = $design->getTheme();
124
+
125
+ if ( $package == "" && $default_theme == "" ){
126
+
127
+ $package = Mage::getStoreConfig('design/package/name', $StoreId);
128
+ $default_theme = Mage::getStoreConfig('design/theme/default', $StoreId);
129
+ }
130
+
131
+ if ( $package == "" ) $package = "default";
132
+ if ( $default_theme == "" ) $default_theme = "default";
133
+
134
+ return $package.'/'.$default_theme;
135
+
136
+
137
+
138
+ }
139
+ function array2json($arr) {
140
+
141
+ if(function_exists('json_encode')) return json_encode($arr); //Lastest versions of PHP already has this functionality.
142
+ $parts = array();
143
+ $is_list = false;
144
+
145
+ //Find out if the given array is a numerical array
146
+ $keys = array_keys($arr);
147
+ $max_length = count($arr)-1;
148
+ if(($keys[0] == 0) and ($keys[$max_length] == $max_length)) {//See if the first key is 0 and last key is length - 1
149
+ $is_list = true;
150
+ for($i=0; $i<count($keys); $i++) { //See if each key correspondes to its position
151
+ if($i != $keys[$i]) { //A key fails at position check.
152
+ $is_list = false; //It is an associative array.
153
+ break;
154
+ }
155
+ }
156
+ }
157
+
158
+ foreach($arr as $key=>$value) {
159
+ if(is_array($value)) { //Custom handling for arrays
160
+ if($is_list) $parts[] = array2json($value); /* :RECURSION: */
161
+ else $parts[] = '"' . $key . '":' . array2json($value); /* :RECURSION: */
162
+ } else {
163
+ $str = '';
164
+ if(!$is_list) $str = '"' . $key . '":';
165
+
166
+ //Custom handling for multiple data types
167
+ if(is_numeric($value)) $str .= $value; //Numbers
168
+ elseif($value === false) $str .= 'false'; //The booleans
169
+ elseif($value === true) $str .= 'true';
170
+ else $str .= '"' . addslashes($value) . '"'; //All other things
171
+ // :TODO: Is there any more datatype we should be in the lookout for? (Object?)
172
+
173
+ $parts[] = $str;
174
+ }
175
+ }
176
+ $json = implode(',',$parts);
177
+
178
+ if($is_list) return '[' . $json . ']';//Return numerical JSON
179
+ return '{' . $json . '}';//Return associative JSON
180
+ }
181
+
182
+
183
+ function geTierprice($product)
184
+ {
185
+
186
+ if (is_null($product)) {
187
+ return array();
188
+ }
189
+ $res='';
190
+ $codquantity=Mage::getStoreConfig('codi/codi/codquantity');
191
+ $codprice=Mage::getStoreConfig('codi/codi/codprice');
192
+ $codsavings=Mage::getStoreConfig('codi/codi/codsavings');
193
+
194
+ //[tier qty 1]#$#[tier price 1]#$#[(product price-tier price 1)/product price%]#$$#
195
+
196
+ $prices = $product->getFormatedTierPrice();
197
+
198
+ $rightstr = '';
199
+ if (is_array($prices)) {
200
+
201
+ $i='1';
202
+ $count=count($prices);
203
+ if($count>0)
204
+ $res='[TierPriceTable]#$$#'.$codquantity.'#$#'.$codprice.'#$#'.$codsavings."=";
205
+
206
+ foreach ($prices as $price) {
207
+ $price['price_qty'] = $price['price_qty']*1;
208
+ $rightstr.=$price['price_qty'].'#$#';
209
+ if ($product->getPrice() != $product->getFinalPrice()) {
210
+ if ($price['price']<$product->getFinalPrice()) {
211
+
212
+ $rightstr.=Mage::helper('tax')->getPrice($product, $price['website_price'], true).'#$#';
213
+
214
+ if($i==$count)
215
+ {
216
+ $rightstr.=ceil(100 - (( 100/$product->getFinalPrice() ) * $price['price'] )).'%';
217
+ }
218
+ else
219
+ {
220
+ $rightstr.=ceil(100 - (( 100/$product->getFinalPrice() ) * $price['price'] )).'%#$$#';
221
+ }
222
+
223
+ }
224
+ } else {
225
+ if ($price['price']<$product->getPrice()) {
226
+ $rightstr.=Mage::helper('tax')->getPrice($product, $price['website_price'], true).'#$#';
227
+
228
+ if($i==$count)
229
+ $rightstr.= ceil(100 - (( 100/$product->getPrice() ) * $price['price'] )).'%';
230
+ else
231
+ $rightstr.= ceil(100 - (( 100/$product->getPrice() ) * $price['price'] )).'%#$$#';
232
+ }
233
+ }
234
+ $i++;
235
+ }
236
+ }
237
+
238
+ return $res.$rightstr;
239
+
240
+ }
241
+
242
+
243
+
244
+
245
+ }
246
+ ?>
app/code/community/Mage/Codi/Model/Codi.php CHANGED
@@ -1,794 +1,851 @@
1
- <?php
2
-
3
- class Mage_Codi_Model_Codi extends Mage_Core_Model_Abstract
4
- {
5
- public $target ;
6
- public $codigrid ; //this flag is to know whether we are displaying our grid or a general grid
7
- public $userid ;
8
- public $password ;
9
- public $disableextension ;
10
- public $version = "3.0.1";
11
-
12
- public $customerid ;
13
- public $customerdatasourceid ;
14
- public $validateuser ;
15
- public $extensionName='Mage_PDF_per_Product';
16
- public $StoreId ;
17
- public $reviewsModel ;
18
- public $ratingModel ;
19
- public $enablereviews ;
20
- public $mediaurl ;
21
-
22
- public function _construct()
23
- {
24
- parent::_construct();
25
- $this->_init('codi/codi');
26
- $this->_logFile = "Catalog-on-demand-items.log";
27
-
28
- $this->enablereviews = Mage::getStoreConfig('codi/codi/codenablereviews');
29
-
30
- // Get StoreID -Start
31
- foreach (Mage::app()->getWebsites() as $website)
32
- {
33
- $defaultGroup = $website->getDefaultGroup();
34
- $StoreId = $defaultGroup->getDefaultStoreId();
35
- }
36
-
37
- $this->StoreId = $StoreId ;
38
- // Get StoreID -End
39
-
40
- $this->reviewsModel = Mage::getModel('review/review') ;
41
- $this->ratingModel = Mage::getModel('rating/rating_option_vote') ;
42
- $this->mediaurl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
43
- }
44
-
45
- public function setStoreConfig( $myarray )
46
- {
47
- $section = 'codi' ;
48
- $website = '' ;
49
- $store = '';
50
-
51
- $groups =
52
- array(
53
- 'codi' =>
54
- array(
55
- 'fields' => $myarray
56
- ));
57
- Mage::getModel('adminhtml/config_data')
58
- ->setSection($section)
59
- ->setWebsite($website)
60
- ->setStore($store)
61
- ->setGroups($groups)
62
- ->save();
63
- }
64
-
65
- public function adminstart()
66
- {
67
- Mage::log("Notice : Admin Start", null, $this->_logFile);
68
-
69
- $AdminNotified = Mage::getSingleton('core/session')->getAdminNotified();
70
- if (!$AdminNotified)
71
- {
72
- Mage::getSingleton('core/session')->setAdminNotified(true);
73
- try
74
- {
75
- $codimodel = Mage::getSingleton('codi/codi');
76
- //Get Application Parameters Response (Notification)
77
- $url = "https://webservices.catalog-on-demand.com/smanager/api.do?Operation=GetApplicationParameters&Application=CoDExtensionForMagento" ;
78
- $paramsarray = array('UserID' => Mage::getStoreConfig('codi/codi/codusername'),
79
- 'Password' => Mage::getStoreConfig('codi/codi/codpassword') );
80
- $Responsemsg = $this->Call( $url, $paramsarray );
81
- if ( $Responsemsg )
82
- {
83
- if (!$Responsemsg->Errors)
84
- {
85
- foreach ($Responsemsg->GetApplicationParametersResponse->ApplicationParameter as $ApplicationParameter)
86
- {
87
- //Get Version
88
- if ((string)$ApplicationParameter->Name == "Version")
89
- $Version = (string)$ApplicationParameter->Value;
90
- //Get Release Notes Link
91
- if ((string)$ApplicationParameter->Name == "ReleaseNotesLink")
92
- $ReleaseNotesLink = (string)$ApplicationParameter->Value;
93
- //Get the Notification Message
94
- if ((string)$ApplicationParameter->Name == "NotificationMessage")
95
- $NotificationMessage = (string)$ApplicationParameter->Value;
96
- }
97
-
98
- $title = "Catalog-On-Demand version " . $Version . " now available";
99
-
100
- $feedData[] = array(
101
- 'severity' => 2,
102
- 'date_added' => NOW(),
103
- 'title' => (string)$title,
104
- 'description' => (string)$NotificationMessage,
105
- 'url' => (string)$ReleaseNotesLink,
106
- );
107
-
108
- if ( version_compare($Version, $codimodel->version) == 1) {
109
- Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData)); }
110
- }
111
- }
112
- }
113
- catch(Exception $e){}
114
- }
115
- }
116
-
117
- public function InitImportStatuses(){
118
-
119
- $write = Mage::getSingleton('core/resource')->getConnection('core_write');
120
-
121
- $write->query("DROP TABLE IF EXISTS codi_import_status");
122
- $write->query("CREATE TABLE codi_import_status(
123
- id int(11) NOT NULL auto_increment PRIMARY KEY,
124
- message varchar(50),
125
- finished int(1) default 0)"
126
- );
127
- }
128
-
129
- public function existTable(){
130
-
131
- $write = Mage::getSingleton('core/resource')->getConnection('core_write');
132
-
133
- $write->query("CREATE TABLE IF NOT EXISTS codi_import_status(
134
- id int(11) NOT NULL auto_increment PRIMARY KEY,
135
- message varchar(50),
136
- finished int(1) default 0)"
137
- );
138
-
139
- }
140
-
141
- public function addImportStatus( $message, $finished = 0 ){
142
-
143
- $this->existTable();
144
-
145
- $write = Mage::getSingleton('core/resource')->getConnection('core_write');
146
- $query = "insert into codi_import_status (message, finished) values('".$message."', $finished)";
147
- $write->query($query);
148
- }
149
-
150
- public function getImportStatuses(){
151
-
152
- $this->existTable();
153
-
154
- $read= Mage::getSingleton('core/resource')->getConnection('core_read');
155
-
156
- $query = "select id, message, finished from codi_import_status order by id desc limit 1";
157
-
158
- $messages = null;
159
-
160
- $result = $read->query($query);
161
-
162
- if($row = $result->fetch() ){
163
- $messages = array('message'=>$row['message'], 'id'=>$row['id'], 'finished'=>$row['finished']);
164
- }
165
-
166
- return $messages;
167
- }
168
-
169
- public function deleteTable(){
170
-
171
- $this->existTable();
172
-
173
- $write = Mage::getSingleton('core/resource')->getConnection('core_write');
174
- $query = "delete from codi_import_status";
175
- $write->query($query);
176
- }
177
-
178
- public function isStart(){
179
-
180
- $this->existTable();
181
-
182
- $read= Mage::getSingleton('core/resource')->getConnection('core_read');
183
-
184
- $query = "select id, message, finished from codi_import_status where message = 'start' order by id desc limit 1";
185
-
186
- $result = $read->query($query);
187
-
188
- if($row = $result->fetch() ){
189
- return true;
190
- }
191
-
192
- return false;
193
- }
194
-
195
- public function createFile($basePath){
196
-
197
- $fh = fopen($basePath.'CODdataFiles/temp.txt', 'w');
198
-
199
- if ( !$fh )
200
- {
201
- return false;
202
- }
203
-
204
- fclose($fh);
205
-
206
- unlink($basePath.'CODdataFiles/temp.txt');
207
- return true;
208
- }
209
-
210
- public function run_codi_import_manually($basepath){
211
-
212
- $this->run_codi_import($basepath);
213
- }
214
-
215
- public function run_codi_import($basePath)
216
- {
217
- Mage::log("Notice : Codi Import Start", null, $this->_logFile);
218
-
219
- ini_set('memory_limit','512M');
220
-
221
- $this->InitImportStatuses();
222
-
223
- $fh = fopen($basePath.'CODdataFiles/temp.txt', 'w');
224
-
225
- if ( !$fh )
226
- {
227
- Mage::log("ERROR : Cann't open file for building data file:".$basePath, null, $this->_logFile);
228
- $this->addImportStatus("fileerror", 1);
229
- return;
230
- }
231
-
232
- fwrite($fh, "itemNumber\titemQty\titemUom\titemPrice\titemDescription\titemLink\titemAttributes\titemGraphic\tproductName\tproductMfg\tproductDescription\tproductGraphic\tproductLink\tproductAttributes\tCategory\tReviews\tSupplementalInfo");
233
-
234
- $products = Mage::getModel('catalog/product')->getCollection();
235
- $products->addAttributeToFilter('status', 1);//enabled
236
- $products->addAttributeToFilter('visibility', 4);//catalog, search
237
- $products->addAttributeToSelect('*');
238
- $prodIds = $products->getAllIds();
239
-
240
- $this->addImportStatus("start");
241
-
242
- $status = "end";
243
- foreach($prodIds as $productId) {
244
-
245
- set_time_limit(0);
246
-
247
- $message = $this->getImportStatuses();
248
- if ( isset($message) && $message['message'] == "cancel") {
249
- $status = "cancel";
250
- break;
251
- }
252
-
253
- $product = Mage::getModel('catalog/product');
254
- $product->load($productId);
255
-
256
- fwrite($fh, $this->ProducttoString($product, "product"));
257
- }
258
-
259
- fclose($fh);
260
- Mage::log("Notice : Codi Import End : ".$status, null, $this->_logFile);
261
-
262
- if ( $status == "end" )
263
- $this->addImportStatus($status, 1);
264
- }
265
-
266
- public function ProducttoString( $product , $from )
267
- {
268
-
269
- if( $product->isConfigurable() )
270
- {
271
- return $this->ProducttoStringConfigurable( $product , $from ) ;
272
- }
273
- else
274
- {
275
- return $this->ProducttoStringSimple( $product , $from ) ;
276
- }
277
- }
278
-
279
- public function ProducttoStringConfigurable( $product , $from )
280
- {
281
- $ProducttoString = '' ;
282
- $UsedProductIds = Mage::getModel('catalog/product_type_configurable')->getUsedProductIds($product);
283
-
284
- $ProductDescription = '';
285
- if(Mage::getStoreConfig('codi/codi/codincludeshortdescription')=="checked")
286
- {
287
- $ProductDescription .= $product->getShortDescription();
288
- }
289
- $ProductDescription .= $product->getDescription() ;
290
- //Get Product Attributes Start
291
- //$excludeAttr = array() ;
292
- $attributes = $product->getAttributes();
293
-
294
- $ProductAttributes = "" ;
295
- foreach ($attributes as $attribute) {
296
- if ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), array() )) {
297
- $value = $attribute->getFrontend()->getValue($product);
298
- if (is_string($value))
299
- {
300
- if (strlen($value) && $product->hasData($attribute->getAttributeCode()))
301
- {
302
- $ProductAttributes .= $attribute->getFrontend()->getLabel() . "=" . $value . "|" ;
303
- }
304
- }
305
- }
306
- }
307
- $ProductAttributes = substr($ProductAttributes, 0, strlen($ProductAttributes)-1 ) ;
308
- //Get Product Attributes End
309
-
310
- //************************* Get Categories names Start ***************************
311
-
312
- $categories = $product->getCategoryIds();
313
- $CategoriesString = "" ;
314
-
315
- foreach($categories as $k => $_category_id){
316
-
317
- $_category = Mage::getModel('catalog/category')->load($_category_id) ;
318
- $path = $_category->getPathInStore();
319
- $pathIds = array_reverse(explode(',', $path));
320
-
321
- foreach($pathIds as $m => $_cat_id){
322
-
323
- $_cat = Mage::getModel('catalog/category')->load($_cat_id);
324
- if( ($_cat->getName() != '') && ($_cat->getName() != 'Root Catalog') && ((string)$_cat->getLevel() != '1') && ($_cat->getParentId() > 1 ) )
325
- $CategoriesString .= $_cat->getName() . "#$#" ;
326
- }
327
-
328
- if( substr($CategoriesString, strlen($CategoriesString)-3, 3) == "#$#" )
329
- {
330
- $CategoriesString = substr($CategoriesString, 0, strlen($CategoriesString)-3 ) ;
331
- $CategoriesString .= "|";
332
- }
333
- }
334
-
335
- $CategoriesString = substr($CategoriesString, 0, strlen($CategoriesString)-1 ) ;
336
- if ($CategoriesString=='') $CategoriesString = 'Uncategorized' ;
337
-
338
- //************************* Get Categories names End ***************************
339
-
340
- foreach($UsedProductIds as $UsedProductid)
341
- {
342
- $UsedProduct = Mage::getModel('catalog/product')->load($UsedProductid);
343
- if( Mage::getStoreConfig('codi/codi/fromchild') )
344
- $UsedProductPrice = $UsedProduct->getFinalPrice() ;
345
- else
346
- $UsedProductPrice = $product->getFinalPrice() ; //default behavior
347
- //************************ Get Attributes Start *******************************
348
- //Extract Attributes
349
- //$ImageURL = (string)$this->helper('catalog/image')->init($UsedProduct, 'image');
350
- //$mediaurl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
351
- $ImageURL = $this->mediaurl . "catalog/product" . $product->getImage();
352
-
353
- //Get Item Attributes Start
354
- //$excludeAttr = array() ;
355
- $attributes = $UsedProduct->getAttributes();
356
-
357
- $ItemitemAttributes = "" ;
358
- $AllowAttributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
359
- foreach ($AllowAttributes as $attribute)
360
- {
361
- $AttributeCode = $attribute->getProductAttribute()->getAttributeCode() ;
362
- $AttributeLabel = $attribute->getProductAttribute()->getFrontend()->getLabel() ;
363
- $AttribId = $UsedProduct->getData($AttributeCode) ;
364
-
365
- $AttributeValue = "" ;
366
- foreach ( $attribute->getProductAttribute()->getSource()->getAllOptions() as $option )
367
- {
368
- if( $option['value'] == $AttribId )
369
- {
370
- $AttributeValue = $option['label'];
371
- }
372
- }
373
-
374
- $ItemitemAttributes .= $AttributeLabel . "=" . $AttributeValue . "|" ;
375
-
376
- //Get Delta Price Start
377
- foreach( $attribute->getPrices() as $addedPrice )
378
- {
379
- if ( $AttributeValue == $addedPrice['label'])
380
- {
381
- if( $addedPrice['is_percent'] )
382
- $UsedProductPrice += $UsedProductPrice * $addedPrice['pricing_value'] / 100;
383
- else
384
- $UsedProductPrice += $addedPrice['pricing_value'] ;
385
- }
386
- }
387
- //Get Delta Price End
388
- }
389
-
390
- $ItemitemAttributes = substr($ItemitemAttributes, 0, strlen($ItemitemAttributes)-1 );
391
-
392
- //Get Item Attributes End
393
- //************************ Get Attributes End ************************************
394
- //************************* Get Reviews Start ***********************
395
- //$enablereviews = Mage::getStoreConfig('codi/codi/codenablereviews') ;
396
- $Reviews = $this->enablereviews ? $this->getReviews($product->getId()) : '' ;
397
- //************************* Get Reviews End *************************
398
-
399
- //************************* Concatenate Product Info Start ***********************
400
- $ProducttoString .= "\r\n" . $this->cleanStr( $UsedProduct->getSku() ) ; //ItemID
401
- $ProducttoString .= "\t" . "" ; //ItemQty
402
- $ProducttoString .= "\t" . "" ; //ItemUom
403
- // $ProducttoString .= "\t" . $this->cleanStr( $product->getPrice() ) ; //ItemPrice
404
- $ProducttoString .= "\t" . $this->cleanStr( $UsedProductPrice ) ; //ItemPrice
405
- $ProducttoString .= "\t" . ""; //ItemDescription
406
- $ProducttoString .= "\t" . $this->cleanStr( $product->getProductUrl() ); //ItemLink
407
- $ProducttoString .= "\t" . $this->cleanStr( $ItemitemAttributes ) ; //ItemitemAttributes
408
- $ProducttoString .= "\t" . ""; //ItemitemGraphic
409
- $ProducttoString .= "\t" . $product->getId().'#$#'.$this->cleanStr( $product->getName() ); //ProductName
410
- $ProducttoString .= "\t" . "" ; //ProductMfg
411
- $ProducttoString .= "\t" . $this->cleanStr( $ProductDescription ) ; //ProductDescription
412
- $ProducttoString .= "\t" . $this->cleanStr( $ImageURL ); //ProductGraphic
413
- $ProducttoString .= "\t" . $this->cleanStr( $product->getProductUrl() ) ; //ProductLink
414
- $ProducttoString .= "\t" . $this->cleanStr( $ProductAttributes ) ; //ProductAttributes
415
- $ProducttoString .= "\t" . $this->cleanStr( $CategoriesString ); //Category
416
- $ProducttoString .= "\t" . $this->cleanStr( $Reviews ); //Reviews
417
- $ProducttoString .= "\t" . $this->cleanStr( $product->getShortDescription() ); //ShortDescription (Quick Overview)
418
- //************************* Concatenate Product Info End ************************* cleanStr
419
- }
420
-
421
- return $ProducttoString ;
422
- }
423
- /////////////////////////////////////////// Simple Products ///////////////////////////////////////////////////////////////////
424
- public function ProducttoStringSimple( $product , $from )
425
- {
426
- $ProducttoString = '' ;
427
- //Change for short description
428
- //$ProductDescription = $product->getDescription() ;
429
- $ProductDescription = '';
430
- if(Mage::getStoreConfig('codi/codi/codincludeshortdescription')=="checked")
431
- {
432
- $ProductDescription .= $product->getShortDescription();
433
- }
434
- $ProductDescription .= $product->getDescription() ;
435
- //************************ Get Attributes Start *******************************
436
- //Extract Attributes
437
- //$ImageURL = (string)$this->helper('catalog/image')->init($product, 'image');
438
- //$mediaurl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
439
- $ImageURL = $this->mediaurl . "catalog/product" . $product->getImage();
440
-
441
- //$excludeAttr = array() ;
442
- $attributes = $product->getAttributes();
443
- $ItemitemAttributes = "" ;
444
- foreach ($attributes as $attribute) {
445
- if ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), array() )) {
446
- $value = $attribute->getFrontend()->getValue($product);
447
- if (is_string($value))
448
- {
449
- if (strlen($value) && $product->hasData($attribute->getAttributeCode()))
450
- {
451
- $ItemitemAttributes .= $attribute->getFrontend()->getLabel() . "=" . $value . "|" ;
452
- }
453
- }
454
- }
455
- }
456
- $ItemitemAttributes = substr($ItemitemAttributes, 0, strlen($ItemitemAttributes)-1 ) ;
457
- //************************ Get Attributes End ************************************
458
-
459
- //************************* Get Categories names Start ***************************
460
-
461
- $categories = $product->getCategoryIds();
462
- $CategoriesString = "" ;
463
- foreach($categories as $k => $_category_id){
464
-
465
- $_category = Mage::getModel('catalog/category')->load($_category_id) ;
466
- $path = $_category->getPathInStore();
467
- $pathIds = array_reverse(explode(',', $path));
468
-
469
- foreach($pathIds as $m => $_cat_id){
470
- $_cat = Mage::getModel('catalog/category')->load($_cat_id) ;
471
-
472
- if( ($_cat->getName() != '') && ($_cat->getName() != 'Root Catalog') && ((string)$_cat->getLevel() != '1') && ($_cat->getParentId() > 1 ) )
473
- $CategoriesString .= $_cat->getName() . "#$#" ;
474
- }
475
-
476
- if( substr($CategoriesString, strlen($CategoriesString)-3, 3) == "#$#" )
477
- {
478
- $CategoriesString = substr($CategoriesString, 0, strlen($CategoriesString)-3 );
479
- $CategoriesString .= "|";
480
- }
481
- }
482
-
483
- $CategoriesString = substr($CategoriesString, 0, strlen($CategoriesString)-1 ) ;
484
- if ($CategoriesString == '' ) $CategoriesString = 'Uncategorized' ;
485
- //************************* Get Categories names End ***************************
486
-
487
- //************************* Get Reviews Start ***********************
488
- //$enablereviews = Mage::getStoreConfig('codi/codi/codenablereviews') ;
489
- //if($enablereviews) { $Reviews = $this->getReviews($product->getId()) ; }
490
- $Reviews = $this->enablereviews ? $this->getReviews($product->getId()) : '' ;
491
- //************************* Get Reviews End *************************
492
-
493
- //************************* Concatenate Product Info Start ***********************
494
-
495
- $ProducttoString .= "\r\n" . $this->cleanStr( $product->getSku() ) ; //ItemID
496
- $ProducttoString .= "\t" . "" ; //ItemQty
497
- $ProducttoString .= "\t" . "" ; //ItemUom
498
- $ProducttoString .= "\t" . $this->cleanStr( $product->getFinalPrice() ) ; //ItemPrice
499
- $ProducttoString .= "\t" . ""; //ItemDescription
500
- $ProducttoString .= "\t" . $this->cleanStr( $product->getProductUrl() ); //ItemLink
501
- $ProducttoString .= "\t" . ""; //ItemitemAttributes
502
- $ProducttoString .= "\t" . ""; //ItemitemGraphic
503
- $ProducttoString .= "\t" . $product->getId().'#$#'.$this->cleanStr( $product->getName() ); //ProductName
504
- $ProducttoString .= "\t" . "" ; //ProductMfg
505
- $ProducttoString .= "\t" . $this->cleanStr( $ProductDescription ) ; //ProductDescription
506
- $ProducttoString .= "\t" . $this->cleanStr( $ImageURL ); //ProductGraphic
507
- $ProducttoString .= "\t" . $this->cleanStr( $product->getProductUrl() ) ; //ProductLink
508
- $ProducttoString .= "\t" . $this->cleanStr( $ItemitemAttributes ) ; //ProductAttributes
509
- $ProducttoString .= "\t" . $this->cleanStr( $CategoriesString ); //Category
510
- $ProducttoString .= "\t" . $this->cleanStr( $Reviews ); //Reviews
511
- $ProducttoString .= "\t" . $this->cleanStr( $product->getShortDescription() ); //ShortDescription (Quick Overview)
512
- //************************* Concatenate Product Info End ************************* cleanStr
513
-
514
- return $ProducttoString ;
515
- }
516
-
517
- public function cleanStr($localstr)
518
- {
519
- $localstr = str_replace("\t","", $localstr ) ;
520
- $localstr = str_replace("\r\n","<br>", $localstr ) ;
521
- $localstr = str_replace("\r","<br>", $localstr ) ;
522
- $localstr = str_replace("\n","<br>", $localstr ) ;
523
- return $localstr ;
524
- }
525
-
526
- public function getReviews( $productid )
527
- {
528
- $reviewsCollection = $this->reviewsModel->getCollection()
529
- ->addStoreFilter($this->StoreId)
530
- ->addStatusFilter('approved')
531
- ->addEntityFilter('product', $productid)
532
- ->setDateOrder();
533
-
534
- $Reviews = "" ;
535
- foreach($reviewsCollection as $review)
536
- {
537
- $ratingCollection = $this->ratingModel
538
- ->getResourceCollection()
539
- ->setReviewFilter($review->getReviewId())
540
- ->setStoreFilter($this->StoreId)
541
- ->addRatingInfo($this->StoreId)
542
- ->load();
543
- $Reviews .= "<p><b>".$review->getTitle()."(". $review->getNickname() .")</b><br>".$review->getDetail()."</p>" ;
544
- }
545
- return $Reviews ;
546
- }
547
-
548
- public function checkvalidity()
549
- {
550
- $userid = Mage::getStoreConfig('codi/codi/codusername') ;
551
- $password = Mage::getStoreConfig('codi/codi/codpassword') ;
552
- $url = "https://webservices.catalog-on-demand.com/smanager/api.do?Operation=ValidateUser&ResponseGroups=All&FunctionGroups=All" ;
553
- $paramsarray = array('UserID' => $userid ,
554
- 'Password' => $password );
555
- $Responsemsg = $this->Call( $url, $paramsarray );
556
- if( $Responsemsg )
557
- return $Responsemsg->Message=="OK" ? true : false ;
558
- else
559
- return false ;
560
- }
561
-
562
- //////////////////////////////////// Calling Start /////////////////////////////////////////////////////
563
- public function CallusingZend( $url, $paramsarray )
564
- {
565
- $client = new Zend_Http_Client();
566
- $client->setUri($url);
567
- $client->setParameterPost('UserID', $this->userid);
568
- $client->setParameterPost('Password', $this->password);
569
-
570
- $mystr = '';
571
- foreach($paramsarray as $key=>$value)
572
- {
573
- $client->setParameterPost($key, $value);
574
- $mystr .= $key . $value ;
575
- }
576
-
577
- $response = $client->request('POST');
578
- $result = $response->getBody() ;
579
- return $result;
580
- }
581
-
582
- public function CallusingCurl( $url, $paramsarray )
583
- {
584
- $poststr = '';
585
- foreach($paramsarray as $key=>$value)
586
- {
587
- $poststr .= $key ."=". urlencode($value) ."&";
588
- }
589
-
590
- $ch = curl_init();
591
- curl_setopt($ch, CURLOPT_URL,$url);
592
- curl_setopt($ch, CURLOPT_FAILONERROR, 1);
593
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
594
- curl_setopt($ch, CURLOPT_POST,1);
595
- curl_setopt($ch, CURLOPT_POSTFIELDS, $poststr);
596
- $result = curl_exec($ch);
597
- curl_close($ch);
598
-
599
- return $result;
600
- }
601
-
602
- public function Call( $url, $paramsarray )
603
- {
604
- $result = "" ;
605
- try
606
- {
607
- $result = $this->CallusingZend( $url, $paramsarray );
608
- }
609
- catch(Exception $e)
610
- {
611
- try
612
- {
613
- $result = $this->CallusingCurl( $url, $paramsarray );
614
- }
615
- catch(Exception $e){}
616
- }
617
-
618
- $Responsemsg = false ;
619
-
620
- return $result ;
621
- }
622
- //////////////////////////////////// Calling End /////////////////////////////////////////////////////
623
- public function getComment($datetime='')
624
- {
625
- $Comment = "";
626
- ////////////////////////////////////////////////////////////
627
- $extension_version = $this->version;//(string) Mage::getConfig()->getNode()->modules->Mage_Codi->version;
628
- $app_version = Mage::getVersion();
629
- $php_version = phpversion();
630
-
631
- foreach (Mage::app()->getWebsites() as $website)
632
- {
633
- $defaultGroup = $website->getDefaultGroup();
634
- $StoreId = $defaultGroup->getDefaultStoreId();
635
- }
636
-
637
- $design = Mage::getSingleton('core/design')->loadChange($StoreId);
638
- $package = $design->getPackage();
639
- $default_theme = $design->getTheme();
640
-
641
- if ( $package == "" && $default_theme == "" ){
642
-
643
- $package = Mage::getStoreConfig('design/package/name', $StoreId);
644
- $default_theme = Mage::getStoreConfig('design/theme/default', $StoreId);
645
- }
646
-
647
- if ( $package == "" ) $package = "default";
648
- if ( $default_theme == "" ) $default_theme = "default";
649
-
650
- $theme = "default";
651
- if ( $package != "default" || $default_theme != "default" )
652
- $theme = $package."/".$default_theme;
653
-
654
- $codbgcheck = ( Mage::getStoreConfig('codi/codi/codbgcheck') == '1' )?'Yes':'No' ;
655
-
656
- $enablefreshflyers = ( Mage::getStoreConfig('codi/codi/enablefreshflyers') == 'checked' )?'Yes':'No' ;
657
- $enablereviews = ( Mage::getStoreConfig('codi/codi/codenablereviews') == 'checked' )?'Yes':'No' ;
658
- $fromchild = ( Mage::getStoreConfig('codi/codi/fromchild') == 'checked' )?'Yes':'No' ;
659
-
660
- $codflyerlinkimgurl = Mage::getStoreConfig('codi/codi/codflyerlinkimgurl') ;
661
- $codflyerlinkimg = ( Mage::getStoreConfig('codi/codi/codflyerlinkimg') == 'Custom' )? $codflyerlinkimgurl:'Default';
662
- $codflyerlinkimgalt = Mage::getStoreConfig('codi/codi/codflyerlinkimgalt') ;
663
-
664
- $codbeforename = ( Mage::getStoreConfig('codi/codi/codbeforename') == 'checked' )?'Yes':'No' ;
665
- $codaftername = ( Mage::getStoreConfig('codi/codi/codaftername') == 'checked' )?'Yes':'No' ;
666
- $codbeforeemailto = ( Mage::getStoreConfig('codi/codi/codbeforeemailto') == 'checked' )?'Yes':'No' ;
667
- $codafteremailto = ( Mage::getStoreConfig('codi/codi/codafteremailto') == 'checked' )?'Yes':'No' ;
668
- $codbeforeOR = ( Mage::getStoreConfig('codi/codi/codbeforeOR') == 'checked' )?'Yes':'No' ;
669
- $codafterOR = ( Mage::getStoreConfig('codi/codi/codafterOR') == 'checked' )?'Yes':'No' ;
670
- $codbeforeoverview = ( Mage::getStoreConfig('codi/codi/codbeforeoverview') == 'checked' ) ?'Yes':'No';
671
- $codafteroverview = ( Mage::getStoreConfig('codi/codi/codafteroverview') == 'checked' )?'Yes':'No';
672
- //Changed for include short description
673
- $includeshortdescription = (Mage::getStoreConfig('codi/codi/codincludeshortdescription')== 'checked' )?'Yes':'No';
674
-
675
- $Comment = "App extension version: ".$extension_version." \r\n";
676
- $Comment .= "Magento version: ".$app_version." \r\n";
677
- $Comment .= "PHP: ".$php_version." \r\n";
678
- $Comment .= "Theme: ".$theme." \r\n";
679
- $Comment .= "Create data file using background process: ".$codbgcheck." \r\n";
680
- $Comment .= "Enable Always Fresh Flyers: ".$enablefreshflyers." \r\n";
681
- $Comment .= "Include Short Description: ".$includeshortdescription." \r\n";
682
- $Comment .= "Enable Reviews: ".$enablereviews." \r\n";
683
- $Comment .= "Get price from associated products: ".$fromchild." \r\n";
684
- $Comment .= "Image to be used for flyer link: ".$codflyerlinkimg." \r\n";
685
- $Comment .= "Alt text for flyer link image: ".$codflyerlinkimgalt." \r\n";
686
- $Comment .= "Display options: \r\n";
687
- $Comment .= " Display before product name: ".$codbeforename." \r\n";
688
- $Comment .= " Display after product name: ".$codaftername." \r\n";
689
- $Comment .= " Display before Email to a friend: ".$codbeforeemailto." \r\n";
690
- $Comment .= " Display after Email to a friend: ".$codafteremailto." \r\n";
691
- $Comment .= " Display before OR: ".$codbeforeOR." \r\n";
692
- $Comment .= " Display after OR: ".$codafterOR." \r\n";
693
- $Comment .= " Display before Quick Overview: ".$codbeforeoverview." \r\n";
694
- $Comment .= " Display after Quick Overview: ".$codafteroverview." \r\n";
695
- //code for version 2.2.16
696
- $datafilelaunch = Mage::getStoreConfig('codi/codi/coddatafilelaunch');
697
- $Comment .="Data File Launch Mode: ".$datafilelaunch."\r\n";
698
- //Change for site url
699
- $siteurl = Mage::getUrl('/');
700
- $Comment .="Site Url: ".$siteurl."\r\n";
701
-
702
- if($datafilelaunch=='magento')
703
- {
704
- $datafilelaunch='cronjob';
705
-
706
- }
707
-
708
-
709
- $url = Mage::getUrl('codi/nsync') ;
710
- $pos = strrpos ($url , 'key') ;
711
- if ( $pos != 0 )
712
- $cronjoburl = substr( $url , 0 , $pos ) ;
713
- else
714
- $cronjoburl = $url;
715
-
716
- if(($datafilelaunch=='magento') || ($datafilelaunch=='manual'))
717
- {
718
- $Comment .="Cron job command: wget ".$cronjoburl."\r\n";
719
- }
720
- else{
721
- $waitforminute=Mage::getStoreConfig('codi/codi/codwaitforminute')/60;
722
- $Comment .="WaitFor: ".number_format($waitforminute,2,'.','')."\r\n";
723
-
724
- }
725
-
726
- $Comment .="Extension Name: ".$this->extensionName."\r\n";
727
- $Comment .="Date and time of most recent data file: ".$datetime."\r\n";
728
-
729
-
730
-
731
- return $Comment;
732
- ////////////////////////////////////////////////////////////
733
- }
734
- //code for version 2.2.16
735
- public function new_run_codi_import($basePath)
736
- {
737
-
738
- Mage::log("Notice : Codi Import Start", null, $this->_logFile);
739
-
740
- ini_set('memory_limit','512M');
741
-
742
- $this->InitImportStatuses();
743
-
744
- $fh = fopen($basePath.'CODdataFiles/temp.txt', 'w');
745
-
746
- if ( !$fh )
747
- {
748
- Mage::log("ERROR : Cann't open file for building data file:".$basePath, null, $this->_logFile);
749
- $this->addImportStatus("fileerror", 1);
750
- return;
751
- }
752
-
753
- fwrite($fh, "itemNumber\titemQty\titemUom\titemPrice\titemDescription\titemLink\titemAttributes\titemGraphic\tproductName\tproductMfg\tproductDescription\tproductGraphic\tproductLink\tproductAttributes\tCategory\tReviews\tSupplementalInfo");
754
-
755
- $products = Mage::getModel('catalog/product')->getCollection();
756
- $products->addAttributeToFilter('status', 1);//enabled
757
- $products->addAttributeToFilter('visibility', 4);//catalog, search
758
- $products->addAttributeToSelect('*');
759
-
760
- $prodIds = $products->getAllIds();
761
-
762
- $this->addImportStatus("start");
763
-
764
- $status = "end";
765
- $i='0';
766
- try{
767
- foreach($prodIds as $productId)
768
- {
769
- set_time_limit(20);
770
- $message = $this->getImportStatuses();
771
- if ( isset($message) && $message['message'] == "cancel") {
772
- $status = "cancel";
773
- break;
774
- }
775
- $product = Mage::getModel('catalog/product');
776
- $product->load($productId);
777
- Mage::log("Notice : Codi Import Products :".$i, null, $this->_logFile);
778
- fwrite($fh, $this->ProducttoString($product, "product"));
779
- $i++;
780
- }
781
- }
782
- catch (Exception $e)
783
- {
784
- Mage::log("Notice : Codi Import Products Exception :".$e->getMessage(), null, $this->_logFile);
785
- }
786
- fclose($fh);
787
- Mage::log("Notice : Codi Import End : ".$status, null, $this->_logFile);
788
-
789
- if ( $status == "end" )
790
- $this->addImportStatus($status, 1);
791
-
792
- }
793
-
794
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Mage_Codi_Model_Codi extends Mage_Core_Model_Abstract
4
+ {
5
+ public $target ;
6
+ public $codigrid ; //this flag is to know whether we are displaying our grid or a general grid
7
+ public $userid ;
8
+ public $password ;
9
+ public $disableextension ;
10
+ public $version = "3.0.2";
11
+
12
+ public $customerid ;
13
+ public $customerdatasourceid ;
14
+ public $validateuser ;
15
+ public $extensionName='Mage_PDF_per_Product';
16
+ public $StoreId ;
17
+ public $reviewsModel ;
18
+ public $ratingModel ;
19
+ public $enablereviews ;
20
+ public $mediaurl ;
21
+
22
+ public function _construct()
23
+ {
24
+ parent::_construct();
25
+ $this->_init('codi/codi');
26
+ $this->_logFile = "Catalog-on-demand-items.log";
27
+
28
+ $this->enablereviews = Mage::getStoreConfig('codi/codi/codenablereviews');
29
+
30
+ // Get StoreID -Start
31
+ foreach (Mage::app()->getWebsites() as $website)
32
+ {
33
+ $defaultGroup = $website->getDefaultGroup();
34
+ $StoreId = $defaultGroup->getDefaultStoreId();
35
+ }
36
+
37
+ $this->StoreId = $StoreId ;
38
+ // Get StoreID -End
39
+
40
+ $this->reviewsModel = Mage::getModel('review/review') ;
41
+ $this->ratingModel = Mage::getModel('rating/rating_option_vote') ;
42
+ $this->mediaurl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
43
+ }
44
+
45
+ public function setStoreConfig( $myarray )
46
+ {
47
+ $section = 'codi' ;
48
+ $website = '' ;
49
+ $store = '';
50
+
51
+ $groups =
52
+ array(
53
+ 'codi' =>
54
+ array(
55
+ 'fields' => $myarray
56
+ ));
57
+ Mage::getModel('adminhtml/config_data')
58
+ ->setSection($section)
59
+ ->setWebsite($website)
60
+ ->setStore($store)
61
+ ->setGroups($groups)
62
+ ->save();
63
+ }
64
+
65
+ public function adminstart()
66
+ {
67
+ Mage::log("Notice : Admin Start", null, $this->_logFile);
68
+
69
+ $AdminNotified = Mage::getSingleton('core/session')->getAdminNotified();
70
+ if (!$AdminNotified)
71
+ {
72
+ Mage::getSingleton('core/session')->setAdminNotified(true);
73
+ try
74
+ {
75
+ $codimodel = Mage::getSingleton('codi/codi');
76
+ //Get Application Parameters Response (Notification)
77
+ $url = "https://webservices.catalog-on-demand.com/smanager/api.do?Operation=GetApplicationParameters&Application=CoDExtensionForMagento" ;
78
+ $paramsarray = array('UserID' => Mage::getStoreConfig('codi/codi/codusername'),
79
+ 'Password' => Mage::getStoreConfig('codi/codi/codpassword') );
80
+ $Responsemsg = $this->Call( $url, $paramsarray );
81
+ if ( $Responsemsg )
82
+ {
83
+ if (!$Responsemsg->Errors)
84
+ {
85
+ foreach ($Responsemsg->GetApplicationParametersResponse->ApplicationParameter as $ApplicationParameter)
86
+ {
87
+ //Get Version
88
+ if ((string)$ApplicationParameter->Name == "Version")
89
+ $Version = (string)$ApplicationParameter->Value;
90
+ //Get Release Notes Link
91
+ if ((string)$ApplicationParameter->Name == "ReleaseNotesLink")
92
+ $ReleaseNotesLink = (string)$ApplicationParameter->Value;
93
+ //Get the Notification Message
94
+ if ((string)$ApplicationParameter->Name == "NotificationMessage")
95
+ $NotificationMessage = (string)$ApplicationParameter->Value;
96
+ }
97
+
98
+ $title = "Catalog-On-Demand version " . $Version . " now available";
99
+
100
+ $feedData[] = array(
101
+ 'severity' => 2,
102
+ 'date_added' => NOW(),
103
+ 'title' => (string)$title,
104
+ 'description' => (string)$NotificationMessage,
105
+ 'url' => (string)$ReleaseNotesLink,
106
+ );
107
+
108
+ if ( version_compare($Version, $codimodel->version) == 1) {
109
+ Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData)); }
110
+ }
111
+ }
112
+ }
113
+ catch(Exception $e){}
114
+ }
115
+ }
116
+
117
+ public function InitImportStatuses(){
118
+
119
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
120
+
121
+ $write->query("DROP TABLE IF EXISTS codi_import_status");
122
+ $write->query("CREATE TABLE codi_import_status(
123
+ id int(11) NOT NULL auto_increment PRIMARY KEY,
124
+ message varchar(50),
125
+ finished int(1) default 0)"
126
+ );
127
+ }
128
+
129
+ public function existTable(){
130
+
131
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
132
+
133
+ $write->query("CREATE TABLE IF NOT EXISTS codi_import_status(
134
+ id int(11) NOT NULL auto_increment PRIMARY KEY,
135
+ message varchar(50),
136
+ finished int(1) default 0)"
137
+ );
138
+
139
+ }
140
+
141
+ public function addImportStatus( $message, $finished = 0 ){
142
+
143
+ $this->existTable();
144
+
145
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
146
+ $query = "insert into codi_import_status (message, finished) values('".$message."', $finished)";
147
+ $write->query($query);
148
+ }
149
+
150
+ public function getImportStatuses(){
151
+
152
+ $this->existTable();
153
+
154
+ $read= Mage::getSingleton('core/resource')->getConnection('core_read');
155
+
156
+ $query = "select id, message, finished from codi_import_status order by id desc limit 1";
157
+
158
+ $messages = null;
159
+
160
+ $result = $read->query($query);
161
+
162
+ if($row = $result->fetch() ){
163
+ $messages = array('message'=>$row['message'], 'id'=>$row['id'], 'finished'=>$row['finished']);
164
+ }
165
+
166
+ return $messages;
167
+ }
168
+
169
+ public function deleteTable(){
170
+
171
+ $this->existTable();
172
+
173
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
174
+ $query = "delete from codi_import_status";
175
+ $write->query($query);
176
+ }
177
+
178
+ public function isStart(){
179
+
180
+ $this->existTable();
181
+
182
+ $read= Mage::getSingleton('core/resource')->getConnection('core_read');
183
+
184
+ $query = "select id, message, finished from codi_import_status where message = 'start' order by id desc limit 1";
185
+
186
+ $result = $read->query($query);
187
+
188
+ if($row = $result->fetch() ){
189
+ return true;
190
+ }
191
+
192
+ return false;
193
+ }
194
+
195
+ public function createFile($basePath){
196
+
197
+ $fh = fopen($basePath.'CODdataFiles/temp.txt', 'w');
198
+
199
+ if ( !$fh )
200
+ {
201
+ return false;
202
+ }
203
+
204
+ fclose($fh);
205
+
206
+ unlink($basePath.'CODdataFiles/temp.txt');
207
+ return true;
208
+ }
209
+
210
+ public function run_codi_import_manually($basepath){
211
+
212
+ $this->run_codi_import($basepath);
213
+ }
214
+
215
+ public function run_codi_import($basePath)
216
+ {
217
+ Mage::log("Notice : Codi Import Start", null, $this->_logFile);
218
+
219
+ ini_set('memory_limit','512M');
220
+
221
+ $this->InitImportStatuses();
222
+
223
+ $fh = fopen($basePath.'CODdataFiles/temp.txt', 'w');
224
+
225
+ if ( !$fh )
226
+ {
227
+ Mage::log("ERROR : Cann't open file for building data file:".$basePath, null, $this->_logFile);
228
+ $this->addImportStatus("fileerror", 1);
229
+ return;
230
+ }
231
+
232
+ fwrite($fh, "itemNumber\titemQty\titemUom\titemPrice\titemDescription\titemLink\titemAttributes\titemGraphic\tproductName\tproductMfg\tproductDescription\tproductGraphic\tproductLink\tproductAttributes\tCategory\tReviews\tSupplementalInfo");
233
+
234
+ $products = Mage::getModel('catalog/product')->getCollection();
235
+ $products->addAttributeToFilter('status', 1);//enabled
236
+ $products->addAttributeToFilter('visibility', 4);//catalog, search
237
+ $products->addAttributeToSelect('*');
238
+ $prodIds = $products->getAllIds();
239
+
240
+ $this->addImportStatus("start");
241
+
242
+ $status = "end";
243
+ foreach($prodIds as $productId) {
244
+
245
+ set_time_limit(0);
246
+
247
+ $message = $this->getImportStatuses();
248
+ if ( isset($message) && $message['message'] == "cancel") {
249
+ $status = "cancel";
250
+ break;
251
+ }
252
+
253
+ $product = Mage::getModel('catalog/product');
254
+ $product->load($productId);
255
+
256
+ fwrite($fh, $this->ProducttoString($product, "product"));
257
+ }
258
+
259
+ fclose($fh);
260
+ Mage::log("Notice : Codi Import End : ".$status, null, $this->_logFile);
261
+
262
+ if ( $status == "end" )
263
+ $this->addImportStatus($status, 1);
264
+ }
265
+
266
+ public function ProducttoString( $product , $from )
267
+ {
268
+
269
+ if( $product->isConfigurable() )
270
+ {
271
+ return $this->ProducttoStringConfigurable( $product , $from ) ;
272
+ }
273
+ else
274
+ {
275
+ return $this->ProducttoStringSimple( $product , $from ) ;
276
+ }
277
+ }
278
+
279
+ public function ProducttoStringConfigurable( $product , $from )
280
+ {
281
+ $ProducttoString = '' ;
282
+ $UsedProductIds = Mage::getModel('catalog/product_type_configurable')->getUsedProductIds($product);
283
+
284
+ $ProductDescription = '';
285
+ if(Mage::getStoreConfig('codi/codi/codincludeshortdescription')=="checked")
286
+ {
287
+ $ProductDescription .= $product->getShortDescription();
288
+ }
289
+ $ProductDescription .= $product->getDescription() ;
290
+ //Get Product Attributes Start
291
+ //$excludeAttr = array() ;
292
+ $attributes = $product->getAttributes();
293
+
294
+ $ProductAttributes = "" ;
295
+ foreach ($attributes as $attribute) {
296
+ if ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), array() )) {
297
+ $value = $attribute->getFrontend()->getValue($product);
298
+ if (is_string($value))
299
+ {
300
+ if (strlen($value) && $product->hasData($attribute->getAttributeCode()))
301
+ {
302
+ $ProductAttributes .= $attribute->getFrontend()->getLabel() . "=" . $value . "|" ;
303
+ }
304
+ }
305
+ }
306
+ }
307
+ $ProductAttributes = substr($ProductAttributes, 0, strlen($ProductAttributes)-1 ) ;
308
+ //Get Product Attributes End
309
+
310
+ //******************** Get Tier Price option *********************//
311
+
312
+ if(Mage::getStoreConfig('codi/codi/codpublishtieredpricing')=='checked')
313
+ {
314
+ $TierPriceAttributes =Mage::helper('codi')->geTierprice($product);
315
+ $sp="|";
316
+ if(($ProductAttributes=='') || ($TierPriceAttributes==''))
317
+ $sp='';
318
+
319
+ if($ProductAttributes=='')
320
+
321
+
322
+ $ProductAttributes.= $sp.$TierPriceAttributes;
323
+ }
324
+ //************End Tier Price option *************//
325
+
326
+
327
+
328
+
329
+ //************************* Get Categories names Start ***************************
330
+
331
+ $categories = $product->getCategoryIds();
332
+ $CategoriesString = "" ;
333
+
334
+ foreach($categories as $k => $_category_id){
335
+
336
+ $_category = Mage::getModel('catalog/category')->load($_category_id) ;
337
+ $path = $_category->getPathInStore();
338
+ $pathIds = array_reverse(explode(',', $path));
339
+
340
+ foreach($pathIds as $m => $_cat_id){
341
+
342
+ $_cat = Mage::getModel('catalog/category')->load($_cat_id);
343
+ if( ($_cat->getName() != '') && ($_cat->getName() != 'Root Catalog') && ((string)$_cat->getLevel() != '1') && ($_cat->getParentId() > 1 ) )
344
+ $CategoriesString .= $_cat->getName() . "#$#" ;
345
+ }
346
+
347
+ if( substr($CategoriesString, strlen($CategoriesString)-3, 3) == "#$#" )
348
+ {
349
+ $CategoriesString = substr($CategoriesString, 0, strlen($CategoriesString)-3 ) ;
350
+ $CategoriesString .= "|";
351
+ }
352
+ }
353
+
354
+ $CategoriesString = substr($CategoriesString, 0, strlen($CategoriesString)-1 ) ;
355
+ if ($CategoriesString=='') $CategoriesString = 'Uncategorized' ;
356
+
357
+ //************************* Get Categories names End ***************************
358
+
359
+ foreach($UsedProductIds as $UsedProductid)
360
+ {
361
+ $UsedProduct = Mage::getModel('catalog/product')->load($UsedProductid);
362
+ if( Mage::getStoreConfig('codi/codi/fromchild') )
363
+ $UsedProductPrice = $UsedProduct->getFinalPrice() ;
364
+ else
365
+ $UsedProductPrice = $product->getFinalPrice() ; //default behavior
366
+ //************************ Get Attributes Start *******************************
367
+ //Extract Attributes
368
+ //$ImageURL = (string)$this->helper('catalog/image')->init($UsedProduct, 'image');
369
+ //$mediaurl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
370
+ $ImageURL = $this->mediaurl . "catalog/product" . $product->getImage();
371
+
372
+ //Get Item Attributes Start
373
+ //$excludeAttr = array() ;
374
+ $attributes = $UsedProduct->getAttributes();
375
+
376
+ $ItemitemAttributes = "" ;
377
+ $AllowAttributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
378
+ foreach ($AllowAttributes as $attribute)
379
+ {
380
+ $AttributeCode = $attribute->getProductAttribute()->getAttributeCode() ;
381
+ $AttributeLabel = $attribute->getProductAttribute()->getFrontend()->getLabel() ;
382
+ $AttribId = $UsedProduct->getData($AttributeCode) ;
383
+
384
+ $AttributeValue = "" ;
385
+ foreach ( $attribute->getProductAttribute()->getSource()->getAllOptions() as $option )
386
+ {
387
+ if( $option['value'] == $AttribId )
388
+ {
389
+ $AttributeValue = $option['label'];
390
+ }
391
+ }
392
+
393
+ $ItemitemAttributes .= $AttributeLabel . "=" . $AttributeValue . "|" ;
394
+
395
+ //Get Delta Price Start
396
+ foreach( $attribute->getPrices() as $addedPrice )
397
+ {
398
+ if ( $AttributeValue == $addedPrice['label'])
399
+ {
400
+ if( $addedPrice['is_percent'] )
401
+ $UsedProductPrice += $UsedProductPrice * $addedPrice['pricing_value'] / 100;
402
+ else
403
+ $UsedProductPrice += $addedPrice['pricing_value'] ;
404
+ }
405
+ }
406
+ //Get Delta Price End
407
+ }
408
+
409
+ $ItemitemAttributes = substr($ItemitemAttributes, 0, strlen($ItemitemAttributes)-1 );
410
+
411
+
412
+
413
+ //Get Item Attributes End
414
+ //************************ Get Attributes End ************************************
415
+ //************************* Get Reviews Start ***********************
416
+ //$enablereviews = Mage::getStoreConfig('codi/codi/codenablereviews') ;
417
+ $Reviews = $this->enablereviews ? $this->getReviews($product->getId()) : '' ;
418
+ //************************* Get Reviews End *************************
419
+
420
+ //************************* Concatenate Product Info Start ***********************
421
+ $ProducttoString .= "\r\n" . $this->cleanStr( $UsedProduct->getSku() ) ; //ItemID
422
+ $ProducttoString .= "\t" . "" ; //ItemQty
423
+ $ProducttoString .= "\t" . "" ; //ItemUom
424
+ // $ProducttoString .= "\t" . $this->cleanStr( $product->getPrice() ) ; //ItemPrice
425
+ $ProducttoString .= "\t" . $this->cleanStr( $UsedProductPrice ) ; //ItemPrice
426
+ $ProducttoString .= "\t" . ""; //ItemDescription
427
+ $ProducttoString .= "\t" . $this->cleanStr( $product->getProductUrl() ); //ItemLink
428
+ $ProducttoString .= "\t" . $this->cleanStr( $ItemitemAttributes ) ; //ItemitemAttributes
429
+ $ProducttoString .= "\t" . ""; //ItemitemGraphic
430
+ $ProducttoString .= "\t" . $product->getId().'#$#'.$this->cleanStr( $product->getName() ); //ProductName
431
+ $ProducttoString .= "\t" . "" ; //ProductMfg
432
+ $ProducttoString .= "\t" . $this->cleanStr( $ProductDescription ) ; //ProductDescription
433
+ $ProducttoString .= "\t" . $this->cleanStr( $ImageURL ); //ProductGraphic
434
+ $ProducttoString .= "\t" . $this->cleanStr( $product->getProductUrl() ) ; //ProductLink
435
+ $ProducttoString .= "\t" . $this->cleanStr( $ProductAttributes ) ; //ProductAttributes
436
+ $ProducttoString .= "\t" . $this->cleanStr( $CategoriesString ); //Category
437
+ $ProducttoString .= "\t" . $this->cleanStr( $Reviews ); //Reviews
438
+ $ProducttoString .= "\t" . $this->cleanStr( $product->getShortDescription() ); //ShortDescription (Quick Overview)
439
+ //************************* Concatenate Product Info End ************************* cleanStr
440
+ }
441
+
442
+ return $ProducttoString ;
443
+ }
444
+ /////////////////////////////////////////// Simple Products ///////////////////////////////////////////////////////////////////
445
+ public function ProducttoStringSimple( $product , $from )
446
+ {
447
+ $ProducttoString = '' ;
448
+ //Change for short description
449
+ //$ProductDescription = $product->getDescription() ;
450
+ $ProductDescription = '';
451
+ if(Mage::getStoreConfig('codi/codi/codincludeshortdescription')=="checked")
452
+ {
453
+ $ProductDescription .= $product->getShortDescription();
454
+ }
455
+ $ProductDescription .= $product->getDescription() ;
456
+ //************************ Get Attributes Start *******************************
457
+ //Extract Attributes
458
+ //$ImageURL = (string)$this->helper('catalog/image')->init($product, 'image');
459
+ //$mediaurl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
460
+ $ImageURL = $this->mediaurl . "catalog/product" . $product->getImage();
461
+
462
+ //$excludeAttr = array() ;
463
+ $attributes = $product->getAttributes();
464
+ $ItemitemAttributes = "" ;
465
+ foreach ($attributes as $attribute) {
466
+ if ($attribute->getIsVisibleOnFront() && !in_array($attribute->getAttributeCode(), array() )) {
467
+ $value = $attribute->getFrontend()->getValue($product);
468
+ if (is_string($value))
469
+ {
470
+ if (strlen($value) && $product->hasData($attribute->getAttributeCode()))
471
+ {
472
+ $ItemitemAttributes .= $attribute->getFrontend()->getLabel() . "=" . $value . "|" ;
473
+ }
474
+ }
475
+ }
476
+ }
477
+ $ItemitemAttributes = substr($ItemitemAttributes, 0, strlen($ItemitemAttributes)-1 ) ;
478
+ //************************ Get Attributes End ************************************
479
+ //******************** Get Tier Price option *********************//
480
+
481
+ if(Mage::getStoreConfig('codi/codi/codpublishtieredpricing')=='checked')
482
+ {
483
+ $TierPriceAttributes =Mage::helper('codi')->geTierprice($product);
484
+ $sp="|";
485
+ if(($ItemitemAttributes=='') || ($TierPriceAttributes==''))
486
+ $sp='';
487
+
488
+ $ItemitemAttributes.= $sp.$TierPriceAttributes;
489
+ }
490
+ //************End Tier Price option *************//
491
+
492
+
493
+
494
+ //************************* Get Categories names Start ***************************
495
+
496
+ $categories = $product->getCategoryIds();
497
+ $CategoriesString = "" ;
498
+ foreach($categories as $k => $_category_id){
499
+
500
+ $_category = Mage::getModel('catalog/category')->load($_category_id) ;
501
+ $path = $_category->getPathInStore();
502
+ $pathIds = array_reverse(explode(',', $path));
503
+
504
+ foreach($pathIds as $m => $_cat_id){
505
+ $_cat = Mage::getModel('catalog/category')->load($_cat_id) ;
506
+
507
+ if( ($_cat->getName() != '') && ($_cat->getName() != 'Root Catalog') && ((string)$_cat->getLevel() != '1') && ($_cat->getParentId() > 1 ) )
508
+ $CategoriesString .= $_cat->getName() . "#$#" ;
509
+ }
510
+
511
+ if( substr($CategoriesString, strlen($CategoriesString)-3, 3) == "#$#" )
512
+ {
513
+ $CategoriesString = substr($CategoriesString, 0, strlen($CategoriesString)-3 );
514
+ $CategoriesString .= "|";
515
+ }
516
+ }
517
+
518
+ $CategoriesString = substr($CategoriesString, 0, strlen($CategoriesString)-1 ) ;
519
+ if ($CategoriesString == '' ) $CategoriesString = 'Uncategorized' ;
520
+ //************************* Get Categories names End ***************************
521
+
522
+ //************************* Get Reviews Start ***********************
523
+ //$enablereviews = Mage::getStoreConfig('codi/codi/codenablereviews') ;
524
+ //if($enablereviews) { $Reviews = $this->getReviews($product->getId()) ; }
525
+ $Reviews = $this->enablereviews ? $this->getReviews($product->getId()) : '' ;
526
+ //************************* Get Reviews End *************************
527
+
528
+ //************************* Concatenate Product Info Start ***********************
529
+
530
+ $ProducttoString .= "\r\n" . $this->cleanStr( $product->getSku() ) ; //ItemID
531
+ $ProducttoString .= "\t" . "" ; //ItemQty
532
+ $ProducttoString .= "\t" . "" ; //ItemUom
533
+ $ProducttoString .= "\t" . $this->cleanStr( $product->getFinalPrice() ) ; //ItemPrice
534
+ $ProducttoString .= "\t" . ""; //ItemDescription
535
+ $ProducttoString .= "\t" . $this->cleanStr( $product->getProductUrl() ); //ItemLink
536
+ $ProducttoString .= "\t" . ""; //ItemitemAttributes
537
+ $ProducttoString .= "\t" . ""; //ItemitemGraphic
538
+ $ProducttoString .= "\t" . $product->getId().'#$#'.$this->cleanStr( $product->getName() ); //ProductName
539
+ $ProducttoString .= "\t" . "" ; //ProductMfg
540
+ $ProducttoString .= "\t" . $this->cleanStr( $ProductDescription ) ; //ProductDescription
541
+ $ProducttoString .= "\t" . $this->cleanStr( $ImageURL ); //ProductGraphic
542
+ $ProducttoString .= "\t" . $this->cleanStr( $product->getProductUrl() ) ; //ProductLink
543
+ $ProducttoString .= "\t" . $this->cleanStr( $ItemitemAttributes ) ; //ProductAttributes
544
+ $ProducttoString .= "\t" . $this->cleanStr( $CategoriesString ); //Category
545
+ $ProducttoString .= "\t" . $this->cleanStr( $Reviews ); //Reviews
546
+ $ProducttoString .= "\t" . $this->cleanStr( $product->getShortDescription() ); //ShortDescription (Quick Overview)
547
+ //************************* Concatenate Product Info End ************************* cleanStr
548
+
549
+ return $ProducttoString ;
550
+ }
551
+
552
+ public function cleanStr($localstr)
553
+ {
554
+ //$specialChar=array('&#11;'=>'','&#27;'=>'');
555
+
556
+ $localstr = str_replace("\t","", $localstr ) ;
557
+ $localstr = str_replace("\r\n","<br>", $localstr ) ;
558
+ $localstr = str_replace("\r","<br>", $localstr ) ;
559
+ $localstr = str_replace("\n","<br>", $localstr ) ;
560
+ $localstr = str_replace("","",$localstr) ;
561
+ //Changed for special character
562
+
563
+
564
+
565
+ return $localstr ;
566
+ }
567
+
568
+ public function getReviews( $productid )
569
+ {
570
+ $reviewsCollection = $this->reviewsModel->getCollection()
571
+ ->addStoreFilter($this->StoreId)
572
+ ->addStatusFilter('approved')
573
+ ->addEntityFilter('product', $productid)
574
+ ->setDateOrder();
575
+
576
+ $Reviews = "" ;
577
+ foreach($reviewsCollection as $review)
578
+ {
579
+ $ratingCollection = $this->ratingModel
580
+ ->getResourceCollection()
581
+ ->setReviewFilter($review->getReviewId())
582
+ ->setStoreFilter($this->StoreId)
583
+ ->addRatingInfo($this->StoreId)
584
+ ->load();
585
+ $Reviews .= "<p><b>".$review->getTitle()."(". $review->getNickname() .")</b><br>".$review->getDetail()."</p>" ;
586
+ }
587
+ return $Reviews ;
588
+ }
589
+
590
+ public function checkvalidity()
591
+ {
592
+ $userid = Mage::getStoreConfig('codi/codi/codusername') ;
593
+ $password = Mage::getStoreConfig('codi/codi/codpassword') ;
594
+ $url = "https://webservices.catalog-on-demand.com/smanager/api.do?Operation=ValidateUser&ResponseGroups=All&FunctionGroups=All" ;
595
+ $paramsarray = array('UserID' => $userid ,
596
+ 'Password' => $password );
597
+ $Responsemsg = $this->Call( $url, $paramsarray );
598
+ if( $Responsemsg )
599
+ return $Responsemsg->Message=="OK" ? true : false ;
600
+ else
601
+ return false ;
602
+ }
603
+
604
+ //////////////////////////////////// Calling Start /////////////////////////////////////////////////////
605
+ public function CallusingZend( $url, $paramsarray )
606
+ {
607
+ $client = new Zend_Http_Client();
608
+ $client->setUri($url);
609
+ $client->setParameterPost('UserID', $this->userid);
610
+ $client->setParameterPost('Password', $this->password);
611
+
612
+ $mystr = '';
613
+ foreach($paramsarray as $key=>$value)
614
+ {
615
+ $client->setParameterPost($key, $value);
616
+ $mystr .= $key . $value ;
617
+ }
618
+
619
+ $response = $client->request('POST');
620
+ $result = $response->getBody() ;
621
+ return $result;
622
+ }
623
+
624
+ public function CallusingCurl( $url, $paramsarray )
625
+ {
626
+ $poststr = '';
627
+ foreach($paramsarray as $key=>$value)
628
+ {
629
+ $poststr .= $key ."=". urlencode($value) ."&";
630
+ }
631
+
632
+ $ch = curl_init();
633
+ curl_setopt($ch, CURLOPT_URL,$url);
634
+ curl_setopt($ch, CURLOPT_FAILONERROR, 1);
635
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
636
+ curl_setopt($ch, CURLOPT_POST,1);
637
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $poststr);
638
+ $result = curl_exec($ch);
639
+ curl_close($ch);
640
+
641
+ return $result;
642
+ }
643
+
644
+ public function Call( $url, $paramsarray )
645
+ {
646
+ $result = "" ;
647
+ try
648
+ {
649
+ $result = $this->CallusingZend( $url, $paramsarray );
650
+ }
651
+ catch(Exception $e)
652
+ {
653
+ try
654
+ {
655
+ $result = $this->CallusingCurl( $url, $paramsarray );
656
+ }
657
+ catch(Exception $e){}
658
+ }
659
+
660
+ $Responsemsg = false ;
661
+
662
+ return $result ;
663
+ }
664
+ //////////////////////////////////// Calling End /////////////////////////////////////////////////////
665
+ public function getComment($datetime='')
666
+ {
667
+ $Comment = "";
668
+ ////////////////////////////////////////////////////////////
669
+ $extension_version = $this->version;//(string) Mage::getConfig()->getNode()->modules->Mage_Codi->version;
670
+ $app_version = Mage::getVersion();
671
+ $php_version = phpversion();
672
+
673
+ foreach (Mage::app()->getWebsites() as $website)
674
+ {
675
+ $defaultGroup = $website->getDefaultGroup();
676
+ $StoreId = $defaultGroup->getDefaultStoreId();
677
+ }
678
+
679
+ $design = Mage::getSingleton('core/design')->loadChange($StoreId);
680
+ $package = $design->getPackage();
681
+ $default_theme = $design->getTheme();
682
+
683
+ if ( $package == "" && $default_theme == "" ){
684
+
685
+ $package = Mage::getStoreConfig('design/package/name', $StoreId);
686
+ $default_theme = Mage::getStoreConfig('design/theme/default', $StoreId);
687
+ }
688
+
689
+ if ( $package == "" ) $package = "default";
690
+ if ( $default_theme == "" ) $default_theme = "default";
691
+
692
+ $theme = "default";
693
+ if ( $package != "default" || $default_theme != "default" )
694
+ $theme = $package."/".$default_theme;
695
+
696
+ $codbgcheck = ( Mage::getStoreConfig('codi/codi/codbgcheck') == '1' )?'Yes':'No' ;
697
+
698
+ $enablefreshflyers = ( Mage::getStoreConfig('codi/codi/enablefreshflyers') == 'checked' )?'Yes':'No' ;
699
+ $enablereviews = ( Mage::getStoreConfig('codi/codi/codenablereviews') == 'checked' )?'Yes':'No' ;
700
+ $fromchild = ( Mage::getStoreConfig('codi/codi/fromchild') == 'checked' )?'Yes':'No' ;
701
+
702
+ $codflyerlinkimgurl = Mage::getStoreConfig('codi/codi/codflyerlinkimgurl') ;
703
+ $codflyerlinkimg = ( Mage::getStoreConfig('codi/codi/codflyerlinkimg') == 'Custom' )? $codflyerlinkimgurl:'Default';
704
+ $codflyerlinkimgalt = Mage::getStoreConfig('codi/codi/codflyerlinkimgalt') ;
705
+
706
+ $codbeforename = ( Mage::getStoreConfig('codi/codi/codbeforename') == 'checked' )?'Yes':'No' ;
707
+ $codaftername = ( Mage::getStoreConfig('codi/codi/codaftername') == 'checked' )?'Yes':'No' ;
708
+ $codbeforeemailto = ( Mage::getStoreConfig('codi/codi/codbeforeemailto') == 'checked' )?'Yes':'No' ;
709
+ $codafteremailto = ( Mage::getStoreConfig('codi/codi/codafteremailto') == 'checked' )?'Yes':'No' ;
710
+ $codbeforeOR = ( Mage::getStoreConfig('codi/codi/codbeforeOR') == 'checked' )?'Yes':'No' ;
711
+ $codafterOR = ( Mage::getStoreConfig('codi/codi/codafterOR') == 'checked' )?'Yes':'No' ;
712
+ $codbeforeoverview = ( Mage::getStoreConfig('codi/codi/codbeforeoverview') == 'checked' ) ?'Yes':'No';
713
+ $codafteroverview = ( Mage::getStoreConfig('codi/codi/codafteroverview') == 'checked' )?'Yes':'No';
714
+ //Changed for include short description
715
+ $includeshortdescription = (Mage::getStoreConfig('codi/codi/codincludeshortdescription')== 'checked' )?'Yes':'No';
716
+
717
+ $Comment = "App extension version: ".$extension_version." \r\n";
718
+ $Comment .= "Magento version: ".$app_version." \r\n";
719
+ $Comment .= "PHP: ".$php_version." \r\n";
720
+ $Comment .= "Theme: ".$theme." \r\n";
721
+ $Comment .= "Create data file using background process: ".$codbgcheck." \r\n";
722
+ $Comment .= "Enable Always Fresh Flyers: ".$enablefreshflyers." \r\n";
723
+ $Comment .= "Include Short Description: ".$includeshortdescription." \r\n";
724
+ $Comment .= "Enable Reviews: ".$enablereviews." \r\n";
725
+ $Comment .= "Get price from associated products: ".$fromchild." \r\n";
726
+ $Comment .= "Image to be used for flyer link: ".$codflyerlinkimg." \r\n";
727
+ $Comment .= "Alt text for flyer link image: ".$codflyerlinkimgalt." \r\n";
728
+ $Comment .= "Display options: \r\n";
729
+ $Comment .= " Display before product name: ".$codbeforename." \r\n";
730
+ $Comment .= " Display after product name: ".$codaftername." \r\n";
731
+ $Comment .= " Display before Email to a friend: ".$codbeforeemailto." \r\n";
732
+ $Comment .= " Display after Email to a friend: ".$codafteremailto." \r\n";
733
+ $Comment .= " Display before OR: ".$codbeforeOR." \r\n";
734
+ $Comment .= " Display after OR: ".$codafterOR." \r\n";
735
+ $Comment .= " Display before Quick Overview: ".$codbeforeoverview." \r\n";
736
+ $Comment .= " Display after Quick Overview: ".$codafteroverview." \r\n";
737
+ //code for version 2.2.16
738
+ $datafilelaunch = Mage::getStoreConfig('codi/codi/coddatafilelaunch');
739
+ $Comment .="Data File Launch Mode: ".$datafilelaunch."\r\n";
740
+ //Change for site url
741
+ $siteurl = Mage::getUrl('/');
742
+ $Comment .="Site Url: ".$siteurl."\r\n";
743
+
744
+ if($datafilelaunch=='magento')
745
+ {
746
+ $datafilelaunch='cronjob';
747
+
748
+ }
749
+
750
+
751
+ $url = Mage::getUrl('codi/nsync') ;
752
+ $pos = strrpos ($url , 'key') ;
753
+ if ( $pos != 0 )
754
+ $cronjoburl = substr( $url , 0 , $pos ) ;
755
+ else
756
+ $cronjoburl = $url;
757
+
758
+ if(($datafilelaunch=='magento') || ($datafilelaunch=='manual'))
759
+ {
760
+ $Comment .="Cron job command: wget ".$cronjoburl."\r\n";
761
+ }
762
+ else{
763
+ $waitforminute=Mage::getStoreConfig('codi/codi/codwaitforminute')/60;
764
+ $Comment .="WaitFor: ".number_format($waitforminute,2,'.','')."\r\n";
765
+
766
+ }
767
+
768
+ $Comment .="Extension Name: ".$this->extensionName."\r\n";
769
+ $Comment .="Date and time of most recent data file: ".$datetime."\r\n";
770
+ //Changed for Tier Price options
771
+
772
+ $publishtieredpricing=Mage::getStoreConfig('codi/codi/codpublishtieredpricing');
773
+ if($publishtieredpricing=='checked')
774
+ {
775
+ $codquantity=Mage::getStoreConfig('codi/codi/codquantity');
776
+ $codprice=Mage::getStoreConfig('codi/codi/codprice');
777
+ $codsavings=Mage::getStoreConfig('codi/codi/codsavings');
778
+ $publish=($publishtieredpricing == 'checked' )?'Yes':'No';
779
+ $Comment .= "Tiered Pricing Options: \r\n";
780
+ $Comment .= " Publish tiered pricing: ".$publish." \r\n";
781
+ $Comment .= " Label for quantity column: ".$codquantity." \r\n";
782
+ $Comment .= " Label for price column: ".$codprice." \r\n";
783
+ $Comment .= " Label for savings: ".$codsavings." \r\n";
784
+
785
+ }
786
+
787
+
788
+ return $Comment;
789
+ ////////////////////////////////////////////////////////////
790
+ }
791
+ //code for version 2.2.16
792
+ public function new_run_codi_import($basePath)
793
+ {
794
+
795
+ Mage::log("Notice : Codi Import Start", null, $this->_logFile);
796
+
797
+ ini_set('memory_limit','512M');
798
+
799
+ $this->InitImportStatuses();
800
+
801
+ $fh = fopen($basePath.'CODdataFiles/temp.txt', 'w');
802
+
803
+ if ( !$fh )
804
+ {
805
+ Mage::log("ERROR : Cann't open file for building data file:".$basePath, null, $this->_logFile);
806
+ $this->addImportStatus("fileerror", 1);
807
+ return;
808
+ }
809
+
810
+ fwrite($fh, "itemNumber\titemQty\titemUom\titemPrice\titemDescription\titemLink\titemAttributes\titemGraphic\tproductName\tproductMfg\tproductDescription\tproductGraphic\tproductLink\tproductAttributes\tCategory\tReviews\tSupplementalInfo");
811
+
812
+ $products = Mage::getModel('catalog/product')->getCollection();
813
+ $products->addAttributeToFilter('status', 1);//enabled
814
+ $products->addAttributeToFilter('visibility', 4);//catalog, search
815
+ $products->addAttributeToSelect('*');
816
+
817
+ $prodIds = $products->getAllIds();
818
+
819
+ $this->addImportStatus("start");
820
+
821
+ $status = "end";
822
+ $i='0';
823
+ try{
824
+ foreach($prodIds as $productId)
825
+ {
826
+ set_time_limit(20);
827
+ $message = $this->getImportStatuses();
828
+ if ( isset($message) && $message['message'] == "cancel") {
829
+ $status = "cancel";
830
+ break;
831
+ }
832
+ $product = Mage::getModel('catalog/product');
833
+ $product->load($productId);
834
+ Mage::log("Notice : Codi Import Products :".$i, null, $this->_logFile);
835
+ fwrite($fh, $this->ProducttoString($product, "product"));
836
+ $i++;
837
+ }
838
+ }
839
+ catch (Exception $e)
840
+ {
841
+ Mage::log("Notice : Codi Import Products Exception :".$e->getMessage(), null, $this->_logFile);
842
+ }
843
+ fclose($fh);
844
+ Mage::log("Notice : Codi Import End : ".$status, null, $this->_logFile);
845
+
846
+ if ( $status == "end" )
847
+ $this->addImportStatus($status, 1);
848
+
849
+ }
850
+
851
+ }
app/code/community/Mage/Codi/controllers/Adminhtml/MenuController.php CHANGED
@@ -224,6 +224,13 @@ class Mage_Codi_Adminhtml_MenuController extends Mage_Adminhtml_Controller_Actio
224
  $waitforminute = (string)$this->getRequest()->getParam('waitforminute');
225
  $includeshortdescription = (string)$this->getRequest()->getParam('includeshortdescription');
226
 
 
 
 
 
 
 
 
227
  $codimodel = Mage::getSingleton('codi/codi');
228
 
229
  $codimodel->setStoreConfig(
@@ -247,8 +254,11 @@ class Mage_Codi_Adminhtml_MenuController extends Mage_Adminhtml_Controller_Actio
247
  "codafteroverview" => array ('value' => $codafteroverview) ,
248
  "coddatafilelaunch" => array ('value' => $coddatafilelaunch) ,
249
  "codwaitforminute" => array ('value' => $waitforminute),
250
- "codincludeshortdescription" => array ('value' => $includeshortdescription),
251
-
 
 
 
252
  )
253
  );
254
 
224
  $waitforminute = (string)$this->getRequest()->getParam('waitforminute');
225
  $includeshortdescription = (string)$this->getRequest()->getParam('includeshortdescription');
226
 
227
+ //Code for Tier pricing
228
+ $codpublishtieredpricing=(string)$this->getRequest()->getParam('publishtieredpricing');
229
+ $codquantity=(string)$this->getRequest()->getParam('codquantity');
230
+ $codprice=(string)$this->getRequest()->getParam('codprice');
231
+ $codsavings=(string)$this->getRequest()->getParam('codsavings');
232
+
233
+
234
  $codimodel = Mage::getSingleton('codi/codi');
235
 
236
  $codimodel->setStoreConfig(
254
  "codafteroverview" => array ('value' => $codafteroverview) ,
255
  "coddatafilelaunch" => array ('value' => $coddatafilelaunch) ,
256
  "codwaitforminute" => array ('value' => $waitforminute),
257
+ "codincludeshortdescription" => array ('value' => $includeshortdescription),
258
+ "codpublishtieredpricing" => array ('value' => $codpublishtieredpricing),
259
+ "codquantity" => array ('value' => $codquantity),
260
+ "codprice" => array ('value' => $codprice),
261
+ "codsavings" => array ('value' => $codsavings),
262
  )
263
  );
264
 
app/code/community/Mage/Codi/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Mage_Codi>
5
- <version>3.0.1</version>
6
  </Mage_Codi>
7
  </modules>
8
  <adminhtml>
2
  <config>
3
  <modules>
4
  <Mage_Codi>
5
+ <version>3.0.2</version>
6
  </Mage_Codi>
7
  </modules>
8
  <adminhtml>
app/design/adminhtml/default/default/layout/codi.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+
4
+ <mage_codi_index>
5
+ <block type="core/template" name="codi" template="codi/index.phtml" >
6
+ <!--<block type="adminhtml/system_config_switcher" name="store_switcher" template="codi/switcher.phtml">
7
+ <action method="setUseConfirm"><params>0</params></action>
8
+ </block>-->
9
+ </block>
10
+ </mage_codi_index>
11
+
12
+ </layout>
app/design/adminhtml/default/default/template/codi/index.phtml CHANGED
@@ -1,873 +1,926 @@
1
- <?php
2
- $codimodel = Mage::getSingleton('codi/codi');
3
- $userid = Mage::getStoreConfig('codi/codi/codusername') ;
4
- $password = Mage::getStoreConfig('codi/codi/codpassword') ;
5
- $secretkey = Mage::getStoreConfig('codi/codi/secretkey') ;
6
-
7
- $enablefreshflyers = Mage::getStoreConfig('codi/codi/enablefreshflyers') ;
8
- $enablereviews = Mage::getStoreConfig('codi/codi/codenablereviews') ;
9
- $fromchild = Mage::getStoreConfig('codi/codi/fromchild') ;
10
-
11
- $codflyerlinkimg = Mage::getStoreConfig('codi/codi/codflyerlinkimg') ;
12
- $codflyerlinkimgurl = Mage::getStoreConfig('codi/codi/codflyerlinkimgurl') ;
13
- $codflyerlinkimgalt = Mage::getStoreConfig('codi/codi/codflyerlinkimgalt') ;
14
-
15
- $codbeforename = Mage::getStoreConfig('codi/codi/codbeforename') ;
16
- $codaftername = Mage::getStoreConfig('codi/codi/codaftername') ;
17
-
18
- $codbeforeemailto = Mage::getStoreConfig('codi/codi/codbeforeemailto') ;
19
- $codafteremailto = Mage::getStoreConfig('codi/codi/codafteremailto') ;
20
-
21
- $codbeforeOR = Mage::getStoreConfig('codi/codi/codbeforeOR') ;
22
- $codafterOR = Mage::getStoreConfig('codi/codi/codafterOR') ;
23
-
24
- $codbeforeoverview = Mage::getStoreConfig('codi/codi/codbeforeoverview') ;
25
- $codafteroverview = Mage::getStoreConfig('codi/codi/codafteroverview') ;
26
-
27
- $codbgcheck = Mage::getStoreConfig('codi/codi/codbgcheck') ;
28
-
29
- $post_url = $this->getUrl('codi/nsync/manual');
30
- $post_url_upd = $this->getUrl('codi/adminhtml_menu/updatestatus');
31
- $post_url_cancel = $this->getUrl('codi/adminhtml_menu/cancel');
32
- $post_bgprocess_check = $this->getUrl('codi/adminhtml_menu/bgcheck');
33
- //chagned ver 3.0.1
34
- $newpostupdate = $this->getUrl('codi/nsync/updatestatus');
35
-
36
- //Changed ver 2.2.15
37
- $download_url = $this->getUrl('codi/adminhtml_menu/downloadtest');
38
- $delete_codi_url = $this->getUrl('codi/adminhtml_menu/deletetest');
39
-
40
- //Chagned ver 2.2.16
41
- $datafilelaunch = Mage::getStoreConfig('codi/codi/coddatafilelaunch');
42
-
43
- $codbg_checked = "";
44
- if ( $codbgcheck == 1 ) $codbg_checked = "checked";
45
-
46
- $extensionName="Mage_PDF_per_Product";
47
- $currentVer = Mage::getConfig()->getModuleConfig('Mage_Codi')->version;
48
-
49
- $waitforminute=Mage::getStoreConfig('codi/codi/codwaitforminute');
50
- $includeshortdescription = Mage::getStoreConfig('codi/codi/codincludeshortdescription');
51
- ?>
52
- <style>
53
- #codi_status_template_button{
54
- margin-bottom:0.5em;
55
- width:329px;
56
- }
57
- #codi_status_template{
58
- margin-bottom:0.5em;
59
- width:330px;
60
- }
61
- #tooltip {
62
- position: absolute;
63
- z-index: 3000;
64
- border: 1px solid #111;
65
- background-color: #eee;
66
- padding: 5px;
67
- max-width:500px;
68
- }
69
- #tooltip h3, #tooltip div { margin: 0; }
70
- #tooltip ul{list-style:disc outside none;margin-left:12px;margin-bottom:12px;padding-left:40px;}
71
- .hidden{display:none;}
72
- .waitforminute{width:59px;}
73
- </style>
74
-
75
- <div id="page:main-container">
76
- <div class="columns ">
77
- <div class="side-col" id="page:left">
78
- <h3>Catalog-On-Demand®</h3>
79
-
80
- <ul id="product_info_tabs" class="tabs">
81
- <li >
82
- <a href="<?php echo $this->getUrl('codi/adminhtml_menu/register');?>" class="tab-item-link "
83
- <?php if ( $codimodel->target == "register") echo "style='background-color:#ffffff;'" ; ?>
84
- onclick="window.open ('https://www.catalog-on-demand.com/signup/');">
85
- <span>Sign Up</span>
86
- </a>
87
- </li>
88
- <li >
89
- <a href="<?php echo $this->getUrl('codi/adminhtml_menu/auth');?>" class="tab-item-link "
90
- <?php if ( $codimodel->target == "auth") echo "style='background-color:#ffffff;'" ; ?> >
91
- <span>Configuration Settings</span>
92
- </a>
93
- </li>
94
- <li >
95
- <a href="<?php echo $this->getUrl('codi/adminhtml_menu/systemtest');?>" class="tab-item-link "
96
- <?php if ( $codimodel->target == "systemtest") echo "style='background-color:#ffffff;'" ; ?> >
97
- <span>System Test</span>
98
- </a>
99
- </li>
100
- <li >
101
- <a href="<?php echo $this->getUrl('codi/adminhtml_menu/documentation');?>" class="tab-item-link "
102
- <?php if ( $codimodel->target == "documentation") echo "style='background-color:#ffffff;'" ; ?>
103
- onclick="window.open ('http://www.catalog-on-demand.com/plans/catalog-on-demand_for_magento.php');">
104
- <span>Documentation</span>
105
- </a>
106
- </li>
107
- </ul>
108
- </div>
109
- <div class="main-col" id="content">
110
- <div class="main-col-inner">
111
- <div class="content-header"></div>
112
-
113
- <?php
114
- $extensions = array('curl','dom', 'hash','iconv','mcrypt' );
115
-
116
- $fail = '';
117
- $pass = '';
118
-
119
- if(version_compare(phpversion(), '5.2.0', '<')) {
120
- $fail .= '<li>You need<strong> PHP 5.2.0</strong> (or greater). Your current version is '.phpversion().'</li>';
121
- }
122
- else {
123
- $pass .='<li>You have<strong> PHP '.phpversion().'</strong></li>';
124
- }
125
- //Removed in Version 2.2.15
126
- /*$allow_url_fopen = ini_get('allow_url_fopen');
127
- if ( $allow_url_fopen != '1' )
128
- $fail .= '<li> You are missing the <strong>allow_url_fopen</strong> configuration option</li>';
129
- */
130
- if( !ini_get('safe_mode') ) {
131
- $pass .='<li>Safe Mode is <strong>off</strong></li>';
132
- }
133
- else { $fail .= '<li>Safe Mode is <strong>on</strong></li>'; }
134
-
135
- foreach($extensions as $extension) {
136
- if( !extension_loaded($extension) ) {
137
- $fail .= '<li> You are missing the <strong>'.$extension.'</strong> extension</li>';
138
- }
139
- else{
140
- $pass .= '<li>You have the <strong>'.$extension.'</strong> extension</li>';
141
- }
142
- }
143
-
144
-
145
- $baseDir = dirname(__FILE__);
146
-
147
- $_baseDirArray = explode("app", $baseDir);
148
- $basePath = $_baseDirArray[0];
149
-
150
- if ( !is_dir($basePath.'CODdataFiles/') ){
151
- if ( !mkdir($basePath.'CODdataFiles/') ){
152
-
153
- $fail .= "<li>Could not create <strong>CoDDataFiles</strong> folder.</li>";
154
- $fail .= "<li>You should be created <strong>CoDdataFiles manually </strong> in ".$basePath."</li>";
155
- }
156
- }
157
-
158
- $is_file = true;
159
-
160
- if ( !$codimodel->createFile($basePath) ){
161
- $fail .= "<li>The Magento extension was prevented from creating a file in the folder CoDDataFile. Please notify your Magento administrator.</li>";
162
- $is_file = false;
163
- }
164
-
165
- $target = $codimodel->target;
166
-
167
- if ( $target == "auth" && $fail != "" ){
168
- $target = "systemtest";
169
- }
170
-
171
- switch ($target)
172
- {
173
- case "register":
174
- break;
175
- case "documentation":
176
- break;
177
- case "systemtest":
178
-
179
- echo "<div class='entry-edit'>
180
- <div class='entry-edit-head'>
181
- <h4 class='icon-head head-edit-form fieldset-legend'>System Test</h4>
182
- <div>&nbsp;</div>
183
- </div>
184
- <div class='fieldset'>
185
- ";
186
-
187
- if( $fail ) {
188
- echo '<p><strong>Your server is not properly configured to run the Catalog-on-Demand® for Magento® extension.</strong>';
189
- echo '<br>Please contact your hosting provider to report the failure of the following tests:';
190
- echo '<br><ul>'.$fail.'</ul></p>';
191
- echo '<br>The following tests were successfully met:';
192
- echo '<ul>'.$pass.'</ul>';
193
- } else {
194
- echo '<p><strong>Congratulations!</strong>&nbsp; Your server has passed all the tests to properly run the Catalog-on-Demand® for Magento® extension.</p>';
195
- echo '<ul>'.$pass.'</ul>';
196
- }
197
-
198
- echo "<br/>";
199
-
200
-
201
- echo '<p> Current Extension Name : <b>'.$extensionName.'</b></p>';
202
-
203
- echo '<p>Current Extension Version: <b>'.$currentVer.'</b></p>';
204
-
205
-
206
-
207
-
208
- $exec_command = "";
209
-
210
- if( (false !== strpos(ini_get("disable_functions"), "exec")) || (false !== strpos(ini_get("disable_functions"), "shell_exec")) ) {
211
- $exec_command = "<p>The <strong>exec</strong> and/or <strong>shell_exec</strong> functions are disabled in your php.ini. See the line starting with <strong>'disable_functions ='</strong>. Unless you remove both <strong>'exec'</strong> and <strong>'shell_exec'</strong> from this line, you may not use the background process to create data files. This may be a problem if you have a large product database.</p>";
212
- }else{
213
- $exec_command = "The <strong>exec</strong> and <strong>shell_exec</strong> functions are enabled. You may use the background process to create data files.";
214
- }
215
-
216
- echo $exec_command;
217
-
218
- echo "<br/><br/>";
219
-
220
- foreach (Mage::app()->getWebsites() as $website)
221
- {
222
- $defaultGroup = $website->getDefaultGroup();
223
- $StoreId = $defaultGroup->getDefaultStoreId();
224
- }
225
-
226
- $design = Mage::getSingleton('core/design')->loadChange($StoreId);
227
-
228
- $package = $design->getPackage();
229
- $default_theme = $design->getTheme();
230
-
231
- if ( $package == "" && $default_theme == "" ){
232
-
233
- $package = Mage::getStoreConfig('design/package/name', $StoreId);
234
- $default_theme = Mage::getStoreConfig('design/theme/default', $StoreId);
235
- }
236
-
237
- if ( $package == "" ) $package = "default";
238
- if ( $default_theme == "" ) $default_theme = "default";
239
-
240
- $update_guide = "<ul style='list-style:decimal outside none;padding-left:30px;'>";
241
- $update_guide .= "<li><p>Open this file : /app/design/frontend/default/default/template/catalog/product/view.phtml. This will be your 'source' file.</p></li>";
242
- $update_guide .= "<li><p>Your view.phtml ( /app/design/frontend/".$package."/".$default_theme."/template/catalog/product/view.phtml ) will be your 'target' file. </p><p>Please copy the code as follows: </p>";
243
- $update_guide .= "<ul style='list-style:square outside none;padding-left:30px;'>";
244
- $update_guide .= "<li><p>Copy lines 37-50, and paste after the line containing getProduct().</p></li>";
245
- $update_guide .= "<li><p>Copy line 69 and paste before the line containing 'name'.</p></li>";
246
- $update_guide .= "<li><p>Copy line 71 and paste after the line containing 'name'.</p></li>";
247
- $update_guide .= "<li><p>Copy line 79 and paste before the line containing 'Email to a Friend'.</p></li>";
248
- $update_guide .= "<li><p>Copy line 81 and paste after the line containing 'Email to a Friend'.</p></li>";
249
- $update_guide .= "<li><p>Copy line 99 and paste before the line containing 'OR'.</p></li>";
250
- $update_guide .= "<li><p>Copy line 101 and paste after the line containing 'OR'.</p></li>";
251
- $update_guide .= "<li><p>Copy line 115 and paste before the line containing 'Quick Overview'.</p></li>";
252
- $update_guide .= "<li><p>Copy line 117 and paste after the line containing 'Quick Overview'.</p></li>";
253
- $update_guide .= "</ul>";
254
- $update_guide .= "</li>";
255
- $update_guide .= "<ul>";
256
-
257
- if ( $package != "default" || $default_theme != "default" ){
258
-
259
- echo "<p>This is important if you intend to use the Always Fresh™ 'flyer-per-product-page' feature of Catalog-on-Demand®.</p>";
260
- echo "<p>You are using the following theme : <strong>".$package." / ".$default_theme."</strong></p>";
261
- echo "<p>Your site admin will need to edit the view.html for this theme, as follows:</p>";
262
- echo $update_guide;
263
-
264
- }else{
265
- echo "<p>You have the default theme.</p>";
266
- }
267
-
268
- echo "</div></div>";
269
- echo "<br />";
270
-
271
- $text = "";
272
-
273
- if ( $is_file ){
274
-
275
- $message = $codimodel->getImportStatuses();
276
-
277
- if ( isset($message) ){
278
-
279
- $status = $message['message'];
280
-
281
- if ( $status== "end" && $message['finished'] == 1 ){
282
- $text = "<p id='codi_status_template_button'>Your test data file was created successfully. &nbsp;<img src='".$this->getSkinUrl($this->__('images/codimport_yes.gif'))."' /> <button type='button' onclick='download_codi_file();' class='scalable add' style='margin-left:25px;' ><span>Download Data File</span></button> <button type='button' onclick='delete_codi_file();' class='scalable add' style='margin-left:25px;' ><span>Delete Data File</span></button></p>";
283
- $codimodel->deleteTable();
284
- }else if ( $status== "start" && $message['finished'] == 0 ) {
285
- $text = "<p>A test data file is now being created. <span style='margin-left:15px;'><img src='".$this->getSkinUrl($this->__('images/codimport_run.gif'))."' /></span>&nbsp;&nbsp;&nbsp;<button type='button' class='scalable cancel' onclick='cancel_codi_import()' style='margin-left:25px' ><span>Cancel</span></button></p>" ;
286
- }else if ( $status== "fileerror" && $message['finished'] == 0 ) {
287
- $text = "<p>Your test data file was not created. Please contact your administrator.</p>";
288
- $codimodel->deleteTable();
289
- }else{
290
- $text = "<p>Your test data file was not created. Please contact your administrator.</p>";
291
- $codimodel->deleteTable();
292
- }
293
- }
294
- else{
295
- //Changed on version 2.2.15
296
- //$text .= "<a href='#datafilebackground_tooltip'><img src='".$this->getSkinUrl($this->__('images/preview_field_help.png'))."' /></a><input type='checkbox' id='background_process' name='background_process' ".$codbg_checked." style='margin:0px 5px 0px 15px;cursor:pointer' onclick='onBackgroundProcess(this)' />Create data file using background process<br /><br />";
297
- $text .= "<button type='button' class='scalable add' onclick='start_codi_import()' style='margin-left:25px;' ><span>Test</span></button>";
298
- //echo $basePath.'CODdataFiles/temp.txt';
299
- // @unlink($basePath.'CODdataFiles/temp.txt');
300
- }
301
- //version 2.2.16
302
- /*echo "<div class='entry-edit'>
303
- <div class='entry-edit-head'>
304
- <h4 class='icon-head head-edit-form fieldset-legend'>Data File Creation</h4>
305
- <div>&nbsp;</div>
306
- </div>
307
- <div class='fieldset' id='codi_status_template' name='codi_status_template'>".$text."</div>
308
- ";*/
309
- }
310
- break;
311
- case "auth":
312
- ?>
313
- <form name="codiform" action="<?php echo $this->getUrl('codi/adminhtml_menu/authsave') ?>" method="post" id="codiform">
314
- <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
315
- <input name="store" type="hidden" value="<?php echo $this->getRequest()->getParam('store'); ?>" />
316
- <div class="entry-edit">
317
- <div class="entry-edit-head">
318
- <h4 class="icon-head head-edit-form fieldset-legend">Configuration Settings</h4>
319
- <div class="form-buttons" align="right">
320
- <button type="submit" class="scalable add" ><span>Save</span></button>
321
- </div>
322
- <div>&nbsp;</div>
323
- </div>
324
- <div class="fieldset " id="group_fields12">
325
- <div class="hor-scroll">
326
- <table cellspacing="0" class="form-list">
327
- <tbody>
328
- <tr>
329
- <td class="scope-label"><a href="#accountid_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
330
- <td class="label"><label for="userid">Account ID</label></td>
331
- <td class="value"><input name="userid" onchange="makeLowercase();" id="userid" value="<?php echo $userid ?>" class=" input-text" type="text"/></td>
332
- <td><small>&nbsp;</small></td>
333
- </tr>
334
- <tr>
335
- <td class="scope-label"><a href="#secretkey_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
336
- <td class="label"><label for="secretkey">Secret Key</label></td>
337
- <td class="value"><input name="secretkey" id="secretkey" value="<?php echo $secretkey ?>" class=" input-text" type="text"/></td>
338
- <td><small>&nbsp;</small></td>
339
- </tr>
340
- <tr>
341
- <td class="scope-label"><a href="#kickoffurl_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
342
- <td class="label"><label for="secretkey">Kick-off URL</label></td>
343
- <td class="value"><label>
344
- <?php
345
- $url = $this->getUrl('codi/sync') ;
346
- $pos = strrpos ($url , 'key') ;
347
- if ( $pos != 0 )
348
- $kickoffurl = substr( $url , 0 , $pos ) ;
349
- else
350
- $kickoffurl = $url;
351
-
352
- echo "<input class='input-text' type='text' name='kickoffurl' value='".$kickoffurl."'>" ;
353
- ?></label>
354
- </td>
355
- <td><small>&nbsp;</small></td>
356
- </tr>
357
- <tr><td class="scope-label"></td><td class="label"></td><td class="value"></td><td><small>&nbsp;</small></td></tr>
358
- <!-- Changed for version 2.2.16 to add data file launch mode -->
359
- <tr>
360
- <td class="scope-label"><a href="#data_file_launch_mode_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
361
- <td class="label"><label for="DataFileLaunchMode">Data File Launch Mode</label></td>
362
- <td class="value">
363
- <input type="radio" value="manual" id="manual" name="datafilelaunch" <?php if ($datafilelaunch =="manual") echo "checked" ?> onclick="displayBlock('codi_status_template','cronjob','0');"/>&nbsp;<label for="manual">Manual&nbsp;<a href="#manual_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></label><br>
364
- <p id="codi_status_template" name="codi_status_template" style="display:<?php if ($datafilelaunch =="manual") echo 'block'; else echo 'none';?>;">
365
- <?php
366
- $filename = $basePath.'CODdataFiles/text.tmp.txt';
367
- if (file_exists($filename)) {
368
- $modifie="Last Created Date: " . date("M d, Y H:i:s.", filemtime($filename));
369
- echo $modifie." <button type='button' onclick='download_codi_file();' class='scalable add' style='margin-left:25px;' ><span>Download Data File</span></button> <button type='button' onclick='delete_codi_file();' class='scalable add' style='margin-left:25px;' ><span>Delete Data File</span></button>";
370
- }
371
- else{
372
- ?>
373
- <button type='button' class='scalable add' onclick='start_codi_import()' style='margin-left:25px;' ><span>Create Data File</span></button>
374
- <?php }?>
375
- </p>
376
-
377
-
378
- <input type="radio" value="cod" id="cod" name="datafilelaunch" <?php if ($datafilelaunch =="cod") echo "checked" ?> onclick="displayBlock('codi_status_template','cronjob','1');" />&nbsp;<label for="cod">Catalog-on-Demand&nbsp;<a href="#codoption_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></label>
379
- <span style="display:<?php if ($datafilelaunch =="cod") echo ''; else echo 'none';?>;" id="waitforminute"><br>Minutes to wait for data file creation : <input type="text" name="waitforminute" onchange="valuevalidation(this.value,5,999,'Please enter only integer value between 5 and 999.','I');" class="waitforminute" width="60px" value="<?php echo $waitforminute;?>">&nbsp;<a href="#waitforminute_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></span><br>
380
- <input type="radio" value="magento" id="magento" name="datafilelaunch" <?php if ($datafilelaunch =="magento") echo "checked" ?> onclick="displayBlock('cronjob','codi_status_template','0');" />&nbsp;<label for="magento">Cron-job &nbsp;<a href="#cronjoburl_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></label>
381
- </td>
382
- <td><small>&nbsp;</small></td>
383
- </tr>
384
- <tr>
385
-
386
- <td class="scope-label"></td>
387
- <td class="label"></td>
388
- <td class="value">
389
- <p id="cronjob" name="cronjob" style="display:<?php if ($datafilelaunch =="magento") echo 'block'; else echo 'none';?>;">
390
- <?php
391
- $url = $this->getUrl('codi/nsync') ;
392
- $pos = strrpos ($url , 'key') ;
393
- if ( $pos != 0 )
394
- $cronjoburl = substr( $url , 0 , $pos ) ;
395
- else
396
- $cronjoburl = $url;
397
-
398
- echo '<input type="text" class="input-text" name="cronjoburl" width="60px" value="wget '.$cronjoburl.'">' ;
399
- ?></p>
400
- </td>
401
- <td><small>&nbsp;</small></td>
402
- </tr>
403
-
404
- <tr>
405
- <td class="scope-label"><a href="#enablefreshflyers_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
406
- <td class="label"><label for="enablefreshflyers">Enable Always Fresh™ Flyers</label></td>
407
- <td class="value"><input name="enablefreshflyers" id="enablefreshflyers" value="checked" <?php if ($enablefreshflyers =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
408
- <td><small>&nbsp;</small></td>
409
- </tr>
410
- <!-- Code for Include Short Description -->
411
- <tr>
412
- <td class="scope-label"><a href="#includeshortdescription_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
413
- <td class="label"><label for="includeshortdescription">Include Short Description</label></td>
414
- <td class="value"><input name="includeshortdescription" id="includeshortdescription" value="checked" <?php if ($includeshortdescription =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
415
- <td><small>&nbsp;</small></td>
416
- </tr>
417
- <tr>
418
- <td class="scope-label"><a href="#enablereviews_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
419
- <td class="label"><label for="enablereviews">Enable Reviews</label></td>
420
- <td class="value"><input name="enablereviews" id="enablereviews" value="checked" <?php if ($enablereviews =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
421
- <td><small>&nbsp;</small></td>
422
- </tr>
423
- <tr>
424
- <td class="scope-label"><a href="#getpricefromchild_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
425
- <td class="label"><label for="fromchild">Get price from associated products</label></td>
426
- <td class="value"><input name="fromchild" id="fromchild" value="checked" <?php if ($fromchild =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
427
- <td><small>&nbsp;</small></td>
428
- </tr>
429
- <tr><td class="scope-label"></td><td class="label"></td><td class="value"></td><td><small>&nbsp;</small></td></tr>
430
- <tr>
431
- <td class="scope-label"><a href="#codflyerlinkimg_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
432
- <td class="label"><label for="usedimage">Image to be used for flyer link</label></td>
433
- <td class="value">
434
- <input type="radio" value="Default" id="Default" name="codflyerlinkimg" <?php if ($codflyerlinkimg !="Custom") echo "checked" ?> onclick="document.getElementById('codflyerlinkimgurl').style.display='none';"/>&nbsp;<label for="Default">Default</label><br>
435
- <input type="radio" value="Custom" id="Custom" name="codflyerlinkimg" <?php if ($codflyerlinkimg =="Custom") echo "checked" ?> onclick="document.getElementById('codflyerlinkimgurl').style.display='block';"/>
436
- &nbsp;<label for="Custom">Custom</label>
437
- </td>
438
- <td>
439
- <img src="<?php if ($codflyerlinkimg =='Custom') echo $codflyerlinkimgurl ; else echo 'http://www.catalog-on-demand.com/print-catalog.png'?>"></td>
440
- </tr>
441
- <tr>
442
- <td class="scope-label"></td>
443
- <td class="label"></td>
444
- <td class="value">
445
- <input type="text" id="codflyerlinkimgurl" name="codflyerlinkimgurl" class=" input-text"
446
- value="<?php if ($codflyerlinkimg =='Custom') echo $codflyerlinkimgurl; else echo '';?>"
447
- style="display:<?php if ($codflyerlinkimg =='Custom') echo 'block'; else echo 'none';?>" />
448
- </td>
449
- <td><small>&nbsp;</small></td>
450
- </tr>
451
- <tr>
452
- <td class="scope-label"><a href="#codflyerlinkimgalt_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
453
- <td class="label"><label for="usedimage">Alt text for flyer link image</label></td>
454
- <td class="value">
455
- <input type="text" id="codflyerlinkimgalt" name="codflyerlinkimgalt" class=" input-text"
456
- value="<?php if ($codflyerlinkimgalt == '') echo 'Click for PDF of this product'; else echo $codflyerlinkimgalt ;?>" />
457
- </td>
458
- <td><small>&nbsp;</small></td>
459
- </tr>
460
- <tr><td class="scope-label"></td><td class="label"></td><td class="value"></td><td><small>&nbsp;</small></td></tr>
461
- </table>
462
- <fieldset style="width:460px;">
463
- <legend style="width:120px;visibility:visible;height:12px;display:block;"><a href="#displayoptions_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a>&nbsp; Display Options</legend>
464
- <table class="form-list" cellpadding='0'>
465
- <tr>
466
- <td class="label"><label for="codbeforename">Display before product name</label></td>
467
- <td class="value"><input name="codbeforename" id="codbeforename" value="checked" <?php if ($codbeforename =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
468
- <td class="scope-label"></td>
469
- <td><small>&nbsp;</small></td>
470
- </tr>
471
- <tr>
472
- <td class="label"><label for="codaftername">Display after product name</label></td>
473
- <td class="value"><input name="codaftername" id="codaftername" value="checked" <?php if ($codaftername =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
474
- <td class="scope-label"></td>
475
- <td><small>&nbsp;</small></td>
476
- </tr>
477
-
478
- <tr>
479
- <td class="label"><label for="codbeforeemailto">Display before 'Email to a friend'</label></td>
480
- <td class="value"><input name="codbeforeemailto" id="codbeforeemailto" value="checked" <?php if ($codbeforeemailto =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
481
- <td class="scope-label"></td>
482
- <td><small>&nbsp;</small></td>
483
- </tr>
484
- <tr>
485
- <td class="label"><label for="codafteremailto">Display after 'Email to a friend'</label></td>
486
- <td class="value"><input name="codafteremailto" id="codafteremailto" value="checked" <?php if ($codafteremailto =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
487
- <td class="scope-label"></td>
488
- <td><small>&nbsp;</small></td>
489
- </tr>
490
-
491
- <tr>
492
- <td class="label"><label for="codbeforeOR">Display before 'OR'</label></td>
493
- <td class="value"><input name="codbeforeOR" id="codbeforeOR" value="checked" <?php if ($codbeforeOR =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
494
- <td class="scope-label"></td>
495
- <td><small>&nbsp;</small></td>
496
- </tr>
497
- <tr>
498
- <td class="label"><label for="codafterOR">Display after 'OR'</label></td>
499
- <td class="value"><input name="codafterOR" id="codafterOR" value="checked" <?php if ($codafterOR =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
500
- <td class="scope-label"></td>
501
- <td><small>&nbsp;</small></td>
502
- </tr>
503
-
504
- <tr>
505
- <td class="label"><label for="codbeforeoverview">Display before 'Quick Overview'</label></td>
506
- <td class="value"><input name="codbeforeoverview" id="codbeforeoverview" value="checked" <?php if ($codbeforeoverview =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
507
- <td class="scope-label"></td>
508
- <td><small>&nbsp;</small></td>
509
- </tr>
510
- <tr>
511
- <td class="label"><label for="codafteroverview">Display after 'Quick Overview'</label></td>
512
- <td class="value"><input name="codafteroverview" id="codafteroverview" value="checked" <?php if ($codafteroverview =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
513
- <td class="scope-label"></td>
514
- <td><small>&nbsp;</small></td>
515
- </tr>
516
- </fieldset>
517
-
518
- </tbody>
519
- </table>
520
- </div>
521
- </div>
522
- </div>
523
- </form>
524
- <?php
525
- break;
526
- }
527
- ?>
528
-
529
- </div>
530
- </div>
531
- </div>
532
- </div>
533
- <div id="accountid_tooltip" class="hidden">
534
- <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/accountid.html'); ?>
535
- </div>
536
- <div id="secretkey_tooltip" class="hidden">
537
- <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/secretkey.html'); ?>
538
- </div>
539
- <div id="kickoffurl_tooltip" class="hidden">
540
- <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/kickoffurl.html'); ?>
541
- </div>
542
- <div id="enablefreshflyers_tooltip" class="hidden">
543
- <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/enablefreshflyers.html'); ?>
544
- </div>
545
- <div id="enablereviews_tooltip" class="hidden">
546
- <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/enablereviews.html'); ?>
547
- </div>
548
- <div id="getpricefromchild_tooltip" class="hidden">
549
- <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/getpricefromchild.html'); ?>
550
- </div>
551
- <div id="codflyerlinkimg_tooltip" class="hidden">
552
- <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/codflyerlinkimg.html'); ?>
553
- </div>
554
- <div id="codflyerlinkimgalt_tooltip" class="hidden">
555
- <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/codflyerlinkimgalt.html'); ?>
556
- </div>
557
- <div id="displayoptions_tooltip" class="hidden">
558
- <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/displayoptions.html'); ?>
559
- </div>
560
- <div id="datafilebackground_tooltip" class="hidden">
561
- <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/datafilebackground.html'); ?>
562
- </div>
563
- <div id="data_file_launch_mode_tooltip" class="hidden">
564
- <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/datafilelaunchmode.html'); ?>
565
- </div>
566
- <div id="cronjoburl_tooltip" class="hidden">
567
- <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/cronjoburl.html'); ?>
568
- </div>
569
- <div id="codoption_tooltip" class="hidden">
570
- <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/CoDDataFileLaunch.html'); ?>
571
- </div>
572
- <div id="manual_tooltip" class="hidden">
573
- <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/ManualDataFileLaunch.html'); ?>
574
- </div>
575
-
576
- <div id="waitforminute_tooltip" class="hidden">
577
- <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/waitforminute.html'); ?>
578
- </div>
579
- <div id="includeshortdescription_tooltip" class="hidden">
580
- <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/shortdesc.html'); ?>
581
- </div>
582
-
583
- <script type="text/javascript" src="<?php echo $this->getJsUrl('jquery/jquery-1.2.6.noConflict.min.js') ?>"></script>
584
- <script type="text/javascript" src="<?php echo $this->getJsUrl('jquery/jquery.tooltip.js') ?>"></script>
585
- <script type="text/javascript">
586
- jQuery("#content a").tooltip({
587
- bodyHandler: function() {
588
- return jQuery(jQuery(this).attr("href")).html();
589
- },
590
- delay: 0,
591
- showURL: false
592
- });
593
-
594
- function start_codi_import(){
595
- codi = new Codi('<?=$post_url?>','<?=$post_url_upd?>');
596
- codi.startCodiImport();
597
- }
598
-
599
- function onBackgroundProcess(obj){
600
- var value = 0;
601
- if ( obj.checked == true )
602
- value = 1;
603
-
604
- var url = "<?php echo $post_bgprocess_check; ?>";
605
- var param = "check=" + value;
606
- new Ajax.Request(url,
607
- {
608
- method:'post',
609
- parameters: param,
610
- onSuccess: function(transport) {
611
- }
612
- });
613
-
614
- }
615
-
616
- var Codi = Class.create();
617
-
618
- Codi.prototype = {
619
- initialize: function(postUrl, postUrlUpd) {
620
-
621
- this.postUrl = postUrl; //'https://techatcost.com/purchases/ajax/';
622
- this.postUrlUpd = postUrlUpd;
623
- this.failureUrl = document.URL;
624
- // object with event message data
625
- this.objectMsg = null;
626
- // interval object
627
- this.updateTimer = null;
628
- // default shipping code. Display on errors
629
-
630
- elem = 'checkoutSteps';
631
- clickableEntity = '.head';
632
-
633
- // overwrite Accordion class method
634
- var headers = $$('#' + elem + ' .section ' + clickableEntity);
635
- headers.each(function(header) {
636
- Event.observe(header,'click',this.sectionClicked.bindAsEventListener(this));
637
- }.bind(this));
638
- },
639
- startCodiImport: function () {
640
- _this = this;
641
- var param = "is_process=";
642
- if ( jQuery('#background_process').is(':checked') == true )
643
- param += "1";
644
- else
645
- param += "0";
646
- new Ajax.Request(this.postUrl,
647
- {
648
- method:'post',
649
- parameters: param,
650
- requestTimeout: 100,
651
-
652
- onSuccess: function(transport) {
653
- //var ret_msg = transport.responseText.evalJSON();
654
- //var status_div = document.getElementById('codi_status_template');
655
- var ret_msg = transport.responseText.evalJSON();
656
- var status_div = document.getElementById('codi_status_template');
657
- var v;
658
- var totalproduct=ret_msg.length;
659
- for (var i=0;i<ret_msg.length;i++) {
660
- //alert(ret_msg[i]);
661
- productid=ret_msg[i];
662
- var j=i+1;
663
- v=createfilenew(productid,j,totalproduct);
664
-
665
- }
666
- var status_div = document.getElementById('codi_status_template');
667
-
668
-
669
- if ( ret_msg.success == 1 ){
670
- status_div.innerHTML = "<p>A test data file is now being created. <span style='margin-left:15px;'><img src=\"<?=$this->getSkinUrl($this->__('images/codimport_run.gif'))?>\" ></span>&nbsp;&nbsp;&nbsp;<button type='button' class='scalable cancel' onclick='cancel_codi_import()' style='margin-left:25px' ><span>Cancel</span></button></p>";
671
- _this.updateTimer = setInterval(function(){_this.updateEvent();}, 10000);
672
- }else if ( ret_msg.error == 1 ){
673
- status_div.innerHTML = "<p>The Magento extension was prevented from creating a file in the folder CoDDataFile. Please notify your Magento administrator.</p>";
674
- }else if ( ret_msg.exec == 1 || ret_msg.shellexec == 1 ) {
675
- status_div.innerHTML = "<p>The <strong>exec</strong> and/or <strong>shell_exec</strong> functions are disabled in your php.ini. See the line starting with <strong>'disable_functions ='</strong>. Unless you remove both <strong>'exec'</strong> and <strong>'shell_exec'</strong> from this line, you may not use the background process to create data files. This may be a problem if you have a large product database.</p>";
676
- }
677
- },
678
- onTimeout: function() {
679
- var status_div = document.getElementById('codi_status_template');
680
- status_div.innerHTML = "<p>Your test data file was not created. Please contact your administrator.</p>";
681
- },
682
- onFailure: function() {
683
- var status_div = document.getElementById('codi_status_template');
684
- status_div.innerHTML = "<p>Your test data file was not created. Please contact your administrator.</p>";
685
- }
686
- });
687
- },
688
-
689
- updateEvent: function () {
690
- _this = this;
691
- new Ajax.Request(this.postUrlUpd,
692
- {
693
- method: 'post',
694
- onSuccess: function(transport) {
695
- _this.objectMsg = transport.responseText.evalJSON();
696
-
697
- if (_this.objectMsg.canceled == 1) {
698
- _this.clearUpdateInterval();
699
- _this.objectMsg.message = 'canceled';
700
- _this.updateStatusHtml();
701
- }
702
-
703
- if (_this.objectMsg.processed == 1) {
704
- }
705
-
706
- if (_this.objectMsg.fileerror == 1) {
707
- _this.clearUpdateInterval();
708
- _this.objectMsg.message = 'fileerror';
709
- _this.updateStatusHtml();
710
- }
711
-
712
- if (_this.objectMsg.error == 1) {
713
- _this.clearUpdateInterval();
714
- _this.objectMsg.message = 'error';
715
- _this.updateStatusHtml();
716
- }
717
-
718
- if (_this.objectMsg.finished == 1) {
719
- _this.objectMsg.message = 'finished';
720
- _this.updateStatusHtml();
721
- _this.clearUpdateInterval();
722
- }
723
- },
724
- onFailure: this.ajaxFailure.bind(),
725
- });
726
- },
727
-
728
- updateStatusHtml: function(){
729
- message = this.objectMsg.message.toLowerCase();
730
- var status_div = document.getElementById('codi_status_template');
731
- var img_url = "<?php echo $this->getSkinUrl($this->__('images/codimport_yes.gif')) ?>";
732
-
733
- if ( message == 'finished' ){
734
- status_div.innerHTML="<p id='codi_status_template_button'>Your test data file was created successfully. &nbsp;<img src='" + img_url + "' /><button type='button' class='scalable add' style='margin-left:25px;' onclick='download_codi_file();' ><span>Download Data File</span></button><button type='button' class='scalable add' style='margin-left:25px;' onclick='delete_codi_file();' ><span>Delete Data File</span></button></p>";
735
- this.clearUpdateInterval();
736
- }
737
-
738
- if ( message == 'canceled' ){
739
- this.clearUpdateInterval();
740
- }
741
-
742
- if ( message == 'processed' ){
743
- }
744
-
745
- if ( message == 'fileerror' ){
746
- status_div.innerHTML="<p>Your test data file was not created. Please contact your administrator( File Error ).</p>";
747
- this.clearUpdateInterval();
748
- }
749
-
750
- if ( message == 'error' ){
751
- status_div.innerHTML="<p>Your test data file was not created. Please contact your administrator.</p>";
752
- this.clearUpdateInterval();
753
- }
754
-
755
- },
756
-
757
- ajaxFailure: function(){
758
- this.clearUpdateInterval();
759
- var status_div = document.getElementById('codi_status_template');
760
- status_div.innerHTML = "<p>Your test data file was not created. Please contact your administrator(Ajax failure).</p>";
761
- },
762
-
763
- clearUpdateInterval: function () {
764
- clearInterval(this.updateTimer);
765
- },
766
- }
767
- function download_codi_file()
768
- {
769
- window.location.href="<?php echo $download_url?>";
770
-
771
- }
772
- function delete_codi_file()
773
- {
774
- window.location.href="<?php echo $delete_codi_url?>";
775
-
776
- }
777
-
778
-
779
- function displayBlock(show,hide,hideboth)
780
- {
781
-
782
- if(hideboth=='1')
783
- {
784
- document.getElementById(show).style.display='none';
785
- document.getElementById(hide).style.display='none';
786
- document.getElementById('waitforminute').style.display='';
787
-
788
- }
789
- else
790
- {
791
- document.getElementById('waitforminute').style.display='none';
792
- document.getElementById(show).style.display='';
793
- document.getElementById(hide).style.display='none';
794
- }
795
-
796
- }
797
- function cancel_codi_import(){
798
-
799
- var url = "<?php echo $post_url_cancel; ?>";
800
- new Ajax.Request(url,
801
- {
802
- method:'post',
803
- onSuccess: function(transport) {
804
- var ret_msg = transport.responseText;
805
-
806
- if ( ret_msg ){
807
-
808
- //var text = "<a href='#datafilebackground_tooltip'><img src=\"<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>\" /></a><br />";
809
- text = "<button type='button' class='scalable add' onclick='start_codi_import()' style='margin-left:25px;' ><span>Create Data File</span></button>";
810
-
811
- var status_div = document.getElementById('codi_status_template');
812
- status_div.innerHTML = text;
813
- }
814
- }
815
- });
816
- }
817
-
818
- function makeLowercase() {
819
- document.getElementById('userid').value = document.getElementById('userid').value.toLowerCase();
820
- }
821
-
822
- function valuevalidation(value, min, max, alertbox, datatype)
823
- {
824
-
825
- with (value)
826
- {
827
- checkvalue=parseFloat(value);
828
- if (datatype)
829
- { smalldatatype=datatype.toLowerCase();
830
- if (smalldatatype.charAt(0)=="i") {checkvalue=parseInt(value)};
831
- }
832
- if ((parseFloat(min)==min && checkvalue<min) || (parseFloat(max)==max && checkvalue>max) || value!=checkvalue)
833
- {if (alertbox!="") {alert(alertbox);} return false;}
834
- else {return true;}
835
- }
836
- }
837
-
838
- function createfilenew(productid,i,totalproduct)
839
- { var img_url = "<?php echo $this->getSkinUrl($this->__('images/codimport_yes.gif')) ?>";
840
- var r;
841
- var base = "<?php echo $basePath ?>";
842
- var status_div = document.getElementById('codi_status_template');
843
- var a = new Ajax.Request("<?php echo $newpostupdate; ?>",
844
- { asynchronous:false,
845
- method: 'post',
846
- parameters: "product="+productid+"&counter="+i+"&total="+totalproduct+"&basepath="+base,
847
- onSuccess: function(transport) {
848
- r= transport.responseText;
849
- if(r=='100'){
850
- status_div.innerHTML="<p id='codi_status_template_button'>"+transport.responseText+"% </p> Your test data file was created successfully.<img src='" + img_url + "' /><button type='button' class='scalable add' style='margin-left:25px;' onclick='download_codi_file();' ><span>Download Data File</span></button><button type='button' class='scalable add' style='margin-left:25px;' onclick='delete_codi_file();' ><span>Delete Data File</span></button> ";
851
- }
852
- else{
853
- if(r!="error"){
854
- status_div.innerHTML="<p id='codi_status_template_button'>"+transport.responseText+"% </p><p>A test data file is now being created. <span style='margin-left:15px;'><img src=\"<?=$this->getSkinUrl($this->__('images/codimport_run.gif'))?>\" ></span>&nbsp;&nbsp;&nbsp;<button type='button' class='scalable cancel' onclick='cancel_codi_import()' style='margin-left:25px' ><span>Cancel</span></button></p>";
855
- }
856
- }
857
- if(r=="error")
858
- {
859
- status_div.innerHTML="<p>Your test data file was not created. Please contact your administrator( File Error ).</p>";
860
- }
861
-
862
- }
863
-
864
- //onFailure: this.ajaxFailure.bind(),
865
- });
866
- return r;
867
-
868
- //alert("end");
869
-
870
-
871
-
872
- }
873
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $codimodel = Mage::getSingleton('codi/codi');
3
+ $userid = Mage::getStoreConfig('codi/codi/codusername') ;
4
+ $password = Mage::getStoreConfig('codi/codi/codpassword') ;
5
+ $secretkey = Mage::getStoreConfig('codi/codi/secretkey') ;
6
+
7
+ $enablefreshflyers = Mage::getStoreConfig('codi/codi/enablefreshflyers') ;
8
+ $enablereviews = Mage::getStoreConfig('codi/codi/codenablereviews') ;
9
+ $fromchild = Mage::getStoreConfig('codi/codi/fromchild') ;
10
+
11
+ $codflyerlinkimg = Mage::getStoreConfig('codi/codi/codflyerlinkimg') ;
12
+ $codflyerlinkimgurl = Mage::getStoreConfig('codi/codi/codflyerlinkimgurl') ;
13
+ $codflyerlinkimgalt = Mage::getStoreConfig('codi/codi/codflyerlinkimgalt') ;
14
+
15
+ $codbeforename = Mage::getStoreConfig('codi/codi/codbeforename') ;
16
+ $codaftername = Mage::getStoreConfig('codi/codi/codaftername') ;
17
+
18
+ $codbeforeemailto = Mage::getStoreConfig('codi/codi/codbeforeemailto') ;
19
+ $codafteremailto = Mage::getStoreConfig('codi/codi/codafteremailto') ;
20
+
21
+ $codbeforeOR = Mage::getStoreConfig('codi/codi/codbeforeOR') ;
22
+ $codafterOR = Mage::getStoreConfig('codi/codi/codafterOR') ;
23
+
24
+ $codbeforeoverview = Mage::getStoreConfig('codi/codi/codbeforeoverview') ;
25
+ $codafteroverview = Mage::getStoreConfig('codi/codi/codafteroverview') ;
26
+
27
+ $codbgcheck = Mage::getStoreConfig('codi/codi/codbgcheck') ;
28
+
29
+ $post_url = $this->getUrl('codi/nsync/manual');
30
+ $post_url_upd = $this->getUrl('codi/adminhtml_menu/updatestatus');
31
+ $post_url_cancel = $this->getUrl('codi/adminhtml_menu/cancel');
32
+ $post_bgprocess_check = $this->getUrl('codi/adminhtml_menu/bgcheck');
33
+ //chagned ver 3.0.1
34
+ $newpostupdate = $this->getUrl('codi/nsync/updatestatus');
35
+
36
+ //Changed ver 2.2.15
37
+ $download_url = $this->getUrl('codi/adminhtml_menu/downloadtest');
38
+ $delete_codi_url = $this->getUrl('codi/adminhtml_menu/deletetest');
39
+
40
+ //Chagned ver 2.2.16
41
+ $datafilelaunch = Mage::getStoreConfig('codi/codi/coddatafilelaunch');
42
+
43
+ $codbg_checked = "";
44
+ if ( $codbgcheck == 1 ) $codbg_checked = "checked";
45
+
46
+ $extensionName="Mage_PDF_per_Product";
47
+ $currentVer = Mage::getConfig()->getModuleConfig('Mage_Codi')->version;
48
+ //Changed ver 3.0.1 Added wait for minute parameter
49
+ $waitforminute=Mage::getStoreConfig('codi/codi/codwaitforminute');
50
+ $includeshortdescription = Mage::getStoreConfig('codi/codi/codincludeshortdescription');
51
+
52
+ //Chagned ver 3.0.2 Added Tier price display settings
53
+ $publishtieredpricing=Mage::getStoreConfig('codi/codi/codpublishtieredpricing');
54
+ $codquantity=Mage::getStoreConfig('codi/codi/codquantity');
55
+ $codprice=Mage::getStoreConfig('codi/codi/codprice');
56
+ $codsavings=Mage::getStoreConfig('codi/codi/codsavings');
57
+
58
+
59
+ ?>
60
+ <style>
61
+ #codi_status_template_button{
62
+ margin-bottom:0.5em;
63
+ width:329px;
64
+ }
65
+ #codi_status_template{
66
+ margin-bottom:0.5em;
67
+ width:330px;
68
+ }
69
+ #tooltip {
70
+ position: absolute;
71
+ z-index: 3000;
72
+ border: 1px solid #111;
73
+ background-color: #eee;
74
+ padding: 5px;
75
+ max-width:500px;
76
+ }
77
+ #tooltip h3, #tooltip div { margin: 0; }
78
+ #tooltip ul{list-style:disc outside none;margin-left:12px;margin-bottom:12px;padding-left:40px;}
79
+ .hidden{display:none;}
80
+ .waitforminute{width:59px;}
81
+ .tiredprice{width:155px;visibility:visible;height:12px;display:block;}
82
+ .displayOption{width:120px;visibility:visible;height:12px;display:block;}
83
+ </style>
84
+
85
+ <div id="page:main-container">
86
+ <div class="columns ">
87
+ <div class="side-col" id="page:left">
88
+ <h3>Catalog-On-Demand®</h3>
89
+
90
+ <ul id="product_info_tabs" class="tabs">
91
+ <li >
92
+ <a href="<?php echo $this->getUrl('codi/adminhtml_menu/register');?>" class="tab-item-link "
93
+ <?php if ( $codimodel->target == "register") echo "style='background-color:#ffffff;'" ; ?>
94
+ onclick="window.open ('https://www.catalog-on-demand.com/signup/');">
95
+ <span>Sign Up</span>
96
+ </a>
97
+ </li>
98
+ <li >
99
+ <a href="<?php echo $this->getUrl('codi/adminhtml_menu/auth');?>" class="tab-item-link "
100
+ <?php if ( $codimodel->target == "auth") echo "style='background-color:#ffffff;'" ; ?> >
101
+ <span>Configuration Settings</span>
102
+ </a>
103
+ </li>
104
+ <li >
105
+ <a href="<?php echo $this->getUrl('codi/adminhtml_menu/systemtest');?>" class="tab-item-link "
106
+ <?php if ( $codimodel->target == "systemtest") echo "style='background-color:#ffffff;'" ; ?> >
107
+ <span>System Test</span>
108
+ </a>
109
+ </li>
110
+ <li >
111
+ <a href="<?php echo $this->getUrl('codi/adminhtml_menu/documentation');?>" class="tab-item-link "
112
+ <?php if ( $codimodel->target == "documentation") echo "style='background-color:#ffffff;'" ; ?>
113
+ onclick="window.open ('http://www.catalog-on-demand.com/plans/catalog-on-demand_for_magento.php');">
114
+ <span>Documentation</span>
115
+ </a>
116
+ </li>
117
+ </ul>
118
+ </div>
119
+ <div class="main-col" id="content">
120
+ <div class="main-col-inner">
121
+ <div class="content-header"></div>
122
+
123
+ <?php
124
+ $extensions = array('curl','dom', 'hash','iconv','mcrypt' );
125
+
126
+ $fail = '';
127
+ $pass = '';
128
+ //$baseDir = dirname(__FILE__);
129
+
130
+ //$_baseDirArray = explode("app", $baseDir);
131
+ //$basePath = $_baseDirArray[0];
132
+ //echo "<li>Could not create <strong>CODdataFiles</strong> folder.</li>";
133
+ //echo "<li>Please create <strong>CODdataFiles manually</strong> in ".$basePath."</li>";
134
+ if(version_compare(phpversion(), '5.2.0', '<')) {
135
+ $fail .= '<li>You need<strong> PHP 5.2.0</strong> (or greater). Your current version is '.phpversion().'</li>';
136
+ }
137
+ else {
138
+ $pass .='<li>You have<strong> PHP '.phpversion().'</strong></li>';
139
+ }
140
+ //Removed in Version 2.2.15
141
+ /*$allow_url_fopen = ini_get('allow_url_fopen');
142
+ if ( $allow_url_fopen != '1' )
143
+ $fail .= '<li> You are missing the <strong>allow_url_fopen</strong> configuration option</li>';
144
+ */
145
+ if( !ini_get('safe_mode') ) {
146
+ $pass .='<li>Safe Mode is <strong>off</strong></li>';
147
+ }
148
+ else { $fail .= '<li>Safe Mode is <strong>on</strong></li>'; }
149
+
150
+ foreach($extensions as $extension) {
151
+ if( !extension_loaded($extension) ) {
152
+ $fail .= '<li> You are missing the <strong>'.$extension.'</strong> extension</li>';
153
+ }
154
+ else{
155
+ $pass .= '<li>You have the <strong>'.$extension.'</strong> extension</li>';
156
+ }
157
+ }
158
+
159
+
160
+ $baseDir = dirname(__FILE__);
161
+
162
+ $_baseDirArray = explode("app", $baseDir);
163
+ $basePath = $_baseDirArray[0];
164
+
165
+ if ( !is_dir($basePath.'CODdataFiles/') ){
166
+ if ( !mkdir($basePath.'CODdataFiles/') ){
167
+
168
+ $fail .= "<li>Could not create <strong>CODdataFiles</strong> folder.</li>";
169
+ $fail .= "<li>Please create <strong>CODdataFiles manually</strong> in ".$basePath."</li>";
170
+ }
171
+ }
172
+
173
+ $is_file = true;
174
+
175
+ if ( !$codimodel->createFile($basePath) ){
176
+ $fail .= "<li>The Magento extension was prevented from creating a file in the folder CODdataFiles. Please notify your Magento administrator.</li>";
177
+ $is_file = false;
178
+ }
179
+
180
+ $target = $codimodel->target;
181
+
182
+ if ( $target == "auth" && $fail != "" ){
183
+ $target = "systemtest";
184
+ }
185
+
186
+ switch ($target)
187
+ {
188
+ case "register":
189
+ break;
190
+ case "documentation":
191
+ break;
192
+ case "systemtest":
193
+
194
+ echo "<div class='entry-edit'>
195
+ <div class='entry-edit-head'>
196
+ <h4 class='icon-head head-edit-form fieldset-legend'>System Test</h4>
197
+ <div>&nbsp;</div>
198
+ </div>
199
+ <div class='fieldset'>
200
+ ";
201
+
202
+ if( $fail ) {
203
+ echo '<p><strong>Your server is not properly configured to run the Catalog-on-Demand® for Magento® extension.</strong>';
204
+ echo '<br>Please contact your hosting provider to report the failure of the following tests:';
205
+ echo '<br><ul>'.$fail.'</ul></p>';
206
+ echo '<br>The following tests were successfully met:';
207
+ echo '<ul>'.$pass.'</ul>';
208
+ } else {
209
+ echo '<p><strong>Congratulations!</strong>&nbsp; Your server has passed all the tests to properly run the Catalog-on-Demand® for Magento® extension.</p>';
210
+ echo '<ul>'.$pass.'</ul>';
211
+ }
212
+
213
+ echo "<br/>";
214
+
215
+
216
+ echo '<p> Current Extension Name : <b>'.$extensionName.'</b></p>';
217
+
218
+ echo '<p>Current Extension Version: <b>'.$currentVer.'</b></p>';
219
+
220
+
221
+
222
+
223
+ $exec_command = "";
224
+
225
+ if( (false !== strpos(ini_get("disable_functions"), "exec")) || (false !== strpos(ini_get("disable_functions"), "shell_exec")) ) {
226
+ $exec_command = "<p>The <strong>exec</strong> and/or <strong>shell_exec</strong> functions are disabled in your php.ini. See the line starting with <strong>'disable_functions ='</strong>. Unless you remove both <strong>'exec'</strong> and <strong>'shell_exec'</strong> from this line, you may not use the background process to create data files. This may be a problem if you have a large product database.</p>";
227
+ }else{
228
+ $exec_command = "The <strong>exec</strong> and <strong>shell_exec</strong> functions are enabled. You may use the background process to create data files.";
229
+ }
230
+
231
+ echo $exec_command;
232
+
233
+ echo "<br/><br/>";
234
+
235
+ foreach (Mage::app()->getWebsites() as $website)
236
+ {
237
+ $defaultGroup = $website->getDefaultGroup();
238
+ $StoreId = $defaultGroup->getDefaultStoreId();
239
+ }
240
+
241
+ $design = Mage::getSingleton('core/design')->loadChange($StoreId);
242
+
243
+ $package = $design->getPackage();
244
+ $default_theme = $design->getTheme();
245
+
246
+ if ( $package == "" && $default_theme == "" ){
247
+
248
+ $package = Mage::getStoreConfig('design/package/name', $StoreId);
249
+ $default_theme = Mage::getStoreConfig('design/theme/default', $StoreId);
250
+ }
251
+
252
+ if ( $package == "" ) $package = "default";
253
+ if ( $default_theme == "" ) $default_theme = "default";
254
+
255
+ $update_guide = "<ul style='list-style:decimal outside none;padding-left:30px;'>";
256
+ $update_guide .= "<li><p>Open this file : /app/design/frontend/default/default/template/catalog/product/view.phtml. This will be your 'source' file.</p></li>";
257
+ $update_guide .= "<li><p>Your view.phtml ( /app/design/frontend/".$package."/".$default_theme."/template/catalog/product/view.phtml ) will be your 'target' file. </p><p>Please copy the code as follows: </p>";
258
+ $update_guide .= "<ul style='list-style:square outside none;padding-left:30px;'>";
259
+ $update_guide .= "<li><p>Copy lines 37-50, and paste after the line containing getProduct().</p></li>";
260
+ $update_guide .= "<li><p>Copy line 69 and paste before the line containing 'name'.</p></li>";
261
+ $update_guide .= "<li><p>Copy line 71 and paste after the line containing 'name'.</p></li>";
262
+ $update_guide .= "<li><p>Copy line 79 and paste before the line containing 'Email to a Friend'.</p></li>";
263
+ $update_guide .= "<li><p>Copy line 81 and paste after the line containing 'Email to a Friend'.</p></li>";
264
+ $update_guide .= "<li><p>Copy line 99 and paste before the line containing 'OR'.</p></li>";
265
+ $update_guide .= "<li><p>Copy line 101 and paste after the line containing 'OR'.</p></li>";
266
+ $update_guide .= "<li><p>Copy line 115 and paste before the line containing 'Quick Overview'.</p></li>";
267
+ $update_guide .= "<li><p>Copy line 117 and paste after the line containing 'Quick Overview'.</p></li>";
268
+ $update_guide .= "</ul>";
269
+ $update_guide .= "</li>";
270
+ $update_guide .= "<ul>";
271
+
272
+ if ( $package != "default" || $default_theme != "default" ){
273
+
274
+ echo "<p>This is important if you intend to use the Always Fresh™ 'flyer-per-product-page' feature of Catalog-on-Demand®.</p>";
275
+ echo "<p>You are using the following theme : <strong>".$package." / ".$default_theme."</strong></p>";
276
+ echo "<p>Your site admin will need to edit the view.html for this theme, as follows:</p>";
277
+ echo $update_guide;
278
+
279
+ }else{
280
+ echo "<p>You have the default theme.</p>";
281
+ }
282
+
283
+ echo "</div></div>";
284
+ echo "<br />";
285
+
286
+ $text = "";
287
+
288
+ if ( $is_file ){
289
+
290
+ $message = $codimodel->getImportStatuses();
291
+
292
+ if ( isset($message) ){
293
+
294
+ $status = $message['message'];
295
+
296
+ if ( $status== "end" && $message['finished'] == 1 ){
297
+ $text = "<p id='codi_status_template_button'>Your test data file was created successfully. &nbsp;<img src='".$this->getSkinUrl($this->__('images/codimport_yes.gif'))."' /> <button type='button' onclick='download_codi_file();' class='scalable add' style='margin-left:25px;' ><span>Download Data File</span></button> <button type='button' onclick='delete_codi_file();' class='scalable add' style='margin-left:25px;' ><span>Delete Data File</span></button></p>";
298
+ $codimodel->deleteTable();
299
+ }else if ( $status== "start" && $message['finished'] == 0 ) {
300
+ $text = "<p>A test data file is now being created. <span style='margin-left:15px;'><img src='".$this->getSkinUrl($this->__('images/codimport_run.gif'))."' /></span>&nbsp;&nbsp;&nbsp;<button type='button' class='scalable cancel' onclick='cancel_codi_import()' style='margin-left:25px' ><span>Cancel</span></button></p>" ;
301
+ }else if ( $status== "fileerror" && $message['finished'] == 0 ) {
302
+ $text = "<p>Your test data file was not created. Please contact your administrator.</p>";
303
+ $codimodel->deleteTable();
304
+ }else{
305
+ $text = "<p>Your test data file was not created. Please contact your administrator.</p>";
306
+ $codimodel->deleteTable();
307
+ }
308
+ }
309
+ else{
310
+ //Changed on version 2.2.15
311
+ //$text .= "<a href='#datafilebackground_tooltip'><img src='".$this->getSkinUrl($this->__('images/preview_field_help.png'))."' /></a><input type='checkbox' id='background_process' name='background_process' ".$codbg_checked." style='margin:0px 5px 0px 15px;cursor:pointer' onclick='onBackgroundProcess(this)' />Create data file using background process<br /><br />";
312
+ $text .= "<button type='button' class='scalable add' onclick='start_codi_import()' style='margin-left:25px;' ><span>Test</span></button>";
313
+ //echo $basePath.'CODdataFiles/temp.txt';
314
+ // @unlink($basePath.'CODdataFiles/temp.txt');
315
+ }
316
+ //version 2.2.16
317
+ /*echo "<div class='entry-edit'>
318
+ <div class='entry-edit-head'>
319
+ <h4 class='icon-head head-edit-form fieldset-legend'>Data File Creation</h4>
320
+ <div>&nbsp;</div>
321
+ </div>
322
+ <div class='fieldset' id='codi_status_template' name='codi_status_template'>".$text."</div>
323
+ ";*/
324
+ }
325
+ break;
326
+ case "auth":
327
+ ?>
328
+ <form name="codiform" action="<?php echo $this->getUrl('codi/adminhtml_menu/authsave') ?>" method="post" id="codiform">
329
+ <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
330
+ <input name="store" type="hidden" value="<?php echo $this->getRequest()->getParam('store'); ?>" />
331
+ <div class="entry-edit">
332
+ <div class="entry-edit-head">
333
+ <h4 class="icon-head head-edit-form fieldset-legend">Configuration Settings</h4>
334
+ <div class="form-buttons" align="right">
335
+ <button type="submit" class="scalable add" ><span>Save</span></button>
336
+ </div>
337
+ <div>&nbsp;</div>
338
+ </div>
339
+ <div class="fieldset " id="group_fields12">
340
+ <div class="hor-scroll">
341
+ <table cellspacing="0" class="form-list">
342
+ <tbody>
343
+ <tr>
344
+ <td class="scope-label"><a href="#accountid_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
345
+ <td class="label"><label for="userid">Account ID</label></td>
346
+ <td class="value"><input name="userid" onchange="makeLowercase();" id="userid" value="<?php echo $userid ?>" class=" input-text" type="text"/></td>
347
+ <td><small>&nbsp;</small></td>
348
+ </tr>
349
+ <tr>
350
+ <td class="scope-label"><a href="#secretkey_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
351
+ <td class="label"><label for="secretkey">Secret Key</label></td>
352
+ <td class="value"><input name="secretkey" id="secretkey" value="<?php echo $secretkey ?>" class=" input-text" type="text"/></td>
353
+ <td><small>&nbsp;</small></td>
354
+ </tr>
355
+ <tr>
356
+ <td class="scope-label"><a href="#kickoffurl_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
357
+ <td class="label"><label for="secretkey">Kick-off URL</label></td>
358
+ <td class="value"><label>
359
+ <?php
360
+ $url = $this->getUrl('codi/sync') ;
361
+ $pos = strrpos ($url , 'key') ;
362
+ if ( $pos != 0 )
363
+ $kickoffurl = substr( $url , 0 , $pos ) ;
364
+ else
365
+ $kickoffurl = $url;
366
+
367
+ echo "<input class='input-text' type='text' name='kickoffurl' value='".$kickoffurl."'>" ;
368
+ ?></label>
369
+ </td>
370
+ <td><small>&nbsp;</small></td>
371
+ </tr>
372
+ <tr><td class="scope-label"></td><td class="label"></td><td class="value"></td><td><small>&nbsp;</small></td></tr>
373
+ <!-- Changed for version 2.2.16 to add data file launch mode -->
374
+ <tr>
375
+ <td class="scope-label"><a href="#data_file_launch_mode_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
376
+ <td class="label"><label for="DataFileLaunchMode">Data File Launch Mode</label></td>
377
+ <td class="value">
378
+ <input type="radio" value="manual" id="manual" name="datafilelaunch" <?php if ($datafilelaunch =="manual") echo "checked" ?> onclick="displayBlock('codi_status_template','cronjob','0');"/>&nbsp;<label for="manual">Manual&nbsp;<a href="#manual_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></label><br>
379
+ <p id="codi_status_template" name="codi_status_template" style="display:<?php if ($datafilelaunch =="manual") echo 'block'; else echo 'none';?>;">
380
+ <?php
381
+ $filename = $basePath.'CODdataFiles/text.tmp.txt';
382
+ if (file_exists($filename)) {
383
+ $modifie="Last Created Date: " . date("M d, Y H:i:s.", filemtime($filename));
384
+ echo $modifie." <button type='button' onclick='download_codi_file();' class='scalable add' style='margin-left:25px;' ><span>Download Data File</span></button> <button type='button' onclick='delete_codi_file();' class='scalable add' style='margin-left:25px;' ><span>Delete Data File</span></button>";
385
+ }
386
+ else{
387
+ ?>
388
+ <button type='button' class='scalable add' onclick='start_codi_import()' style='margin-left:25px;' ><span>Create Data File</span></button>
389
+ <?php }?>
390
+ </p>
391
+
392
+
393
+ <input type="radio" value="cod" id="cod" name="datafilelaunch" <?php if ($datafilelaunch =="cod") echo "checked" ?> onclick="displayBlock('codi_status_template','cronjob','1');" />&nbsp;<label for="cod">Catalog-on-Demand&nbsp;<a href="#codoption_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></label>
394
+ <span style="display:<?php if ($datafilelaunch =="cod") echo ''; else echo 'none';?>;" id="waitforminute"><br>Minutes to wait for data file creation : <input type="text" name="waitforminute" onchange="valuevalidation(this.value,5,999,'Please enter only integer value between 5 and 999.','I');" class="waitforminute" width="60px" value="<?php echo $waitforminute;?>">&nbsp;<a href="#waitforminute_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></span><br>
395
+ <input type="radio" value="magento" id="magento" name="datafilelaunch" <?php if ($datafilelaunch =="magento") echo "checked" ?> onclick="displayBlock('cronjob','codi_status_template','0');" />&nbsp;<label for="magento">Cron-job &nbsp;<a href="#cronjoburl_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></label>
396
+ </td>
397
+ <td><small>&nbsp;</small></td>
398
+ </tr>
399
+ <tr>
400
+
401
+ <td class="scope-label"></td>
402
+ <td class="label"></td>
403
+ <td class="value">
404
+ <p id="cronjob" name="cronjob" style="display:<?php if ($datafilelaunch =="magento") echo 'block'; else echo 'none';?>;">
405
+ <?php
406
+ $url = $this->getUrl('codi/nsync') ;
407
+ $pos = strrpos ($url , 'key') ;
408
+ if ( $pos != 0 )
409
+ $cronjoburl = substr( $url , 0 , $pos ) ;
410
+ else
411
+ $cronjoburl = $url;
412
+
413
+ echo '<input type="text" class="input-text" name="cronjoburl" width="60px" value="wget '.$cronjoburl.'">' ;
414
+ ?></p>
415
+ </td>
416
+ <td><small>&nbsp;</small></td>
417
+ </tr>
418
+
419
+ <tr>
420
+ <td class="scope-label"><a href="#enablefreshflyers_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
421
+ <td class="label"><label for="enablefreshflyers">Enable Always Fresh™ Flyers</label></td>
422
+ <td class="value"><input name="enablefreshflyers" id="enablefreshflyers" value="checked" <?php if ($enablefreshflyers =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
423
+ <td><small>&nbsp;</small></td>
424
+ </tr>
425
+ <!-- Code for Include Short Description -->
426
+ <tr>
427
+ <td class="scope-label"><a href="#includeshortdescription_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
428
+ <td class="label"><label for="includeshortdescription">Include Short Description</label></td>
429
+ <td class="value"><input name="includeshortdescription" id="includeshortdescription" value="checked" <?php if ($includeshortdescription =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
430
+ <td><small>&nbsp;</small></td>
431
+ </tr>
432
+ <tr>
433
+ <td class="scope-label"><a href="#enablereviews_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
434
+ <td class="label"><label for="enablereviews">Enable Reviews</label></td>
435
+ <td class="value"><input name="enablereviews" id="enablereviews" value="checked" <?php if ($enablereviews =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
436
+ <td><small>&nbsp;</small></td>
437
+ </tr>
438
+ <tr>
439
+ <td class="scope-label"><a href="#getpricefromchild_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
440
+ <td class="label"><label for="fromchild">Get price from associated products</label></td>
441
+ <td class="value"><input name="fromchild" id="fromchild" value="checked" <?php if ($fromchild =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
442
+ <td><small>&nbsp;</small></td>
443
+ </tr>
444
+ <!-- Changes for Tired price option -->
445
+ </table>
446
+
447
+ <fieldset style="width:460px;">
448
+ <legend class="tiredprice"><a href="#tieredpricingoptions_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a>&nbsp; Tiered Pricing Options</legend>
449
+ <table class="form-list" cellpadding='0'>
450
+ <tr>
451
+ <td class="label"><label for="publishtieredpricing">Publish tiered pricing</label></td>
452
+ <td class="value"><input name="publishtieredpricing" id="publishtieredpricing" value="checked" <?php if ($publishtieredpricing =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
453
+ <td class="scope-label"></td>
454
+ <td><small>&nbsp;</small></td>
455
+ </tr>
456
+
457
+ <tr>
458
+ <td class="label"><label for="codquantity">Label for quantity column</label></td>
459
+ <td class="value"><input type="text" id="codquantity" name="codquantity" class="input-text" value="<?php if ($codquantity == '') echo 'Quantity'; else echo $codquantity ;?>"></td>
460
+ <td class="scope-label"></td>
461
+ <td><small>&nbsp;</small></td>
462
+ </tr>
463
+
464
+ <tr>
465
+ <td class="label"><label for="codprice">Label for price column</label></td>
466
+ <td class="value"><input type="text" id="codprice" name="codprice" class=" input-text" value="<?php if ($codprice == '') echo 'Price'; else echo $codprice;?>"> </td>
467
+ <td class="scope-label"></td>
468
+ <td><small>&nbsp;</small></td>
469
+ </tr>
470
+ <tr>
471
+ <td class="label"><label for="codsavings">Label for savings</label></td>
472
+ <td class="value"><input type="text" id="codsavings" name="codsavings" class=" input-text" value="<?php if ($codsavings == '') echo 'Savings'; else echo $codsavings;?>" ></td>
473
+ <td class="scope-label"></td>
474
+ <td><small>&nbsp;</small></td>
475
+ </tr>
476
+ </table>
477
+
478
+ </fieldset>
479
+ <!-- End changes for Tired price option -->
480
+ <table class="form-list">
481
+ <tr><td class="scope-label"></td><td class="label"></td><td class="value"></td><td><small>&nbsp;</small></td></tr>
482
+ <tr>
483
+ <td class="scope-label"><a href="#codflyerlinkimg_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
484
+ <td class="label"><label for="usedimage">Image to be used for flyer link</label></td>
485
+ <td class="value">
486
+ <input type="radio" value="Default" id="Default" name="codflyerlinkimg" <?php if ($codflyerlinkimg !="Custom") echo "checked" ?> onclick="document.getElementById('codflyerlinkimgurl').style.display='none';"/>&nbsp;<label for="Default">Default</label><br>
487
+ <input type="radio" value="Custom" id="Custom" name="codflyerlinkimg" <?php if ($codflyerlinkimg =="Custom") echo "checked" ?> onclick="document.getElementById('codflyerlinkimgurl').style.display='block';"/>
488
+ &nbsp;<label for="Custom">Custom</label>
489
+ </td>
490
+ <td>
491
+ <img src="<?php if ($codflyerlinkimg =='Custom') echo $codflyerlinkimgurl ; else echo 'http://www.catalog-on-demand.com/print-catalog.png'?>"></td>
492
+ </tr>
493
+ <tr>
494
+ <td class="scope-label"></td>
495
+ <td class="label"></td>
496
+ <td class="value">
497
+ <input type="text" id="codflyerlinkimgurl" name="codflyerlinkimgurl" class=" input-text"
498
+ value="<?php if ($codflyerlinkimg =='Custom') echo $codflyerlinkimgurl; else echo '';?>"
499
+ style="display:<?php if ($codflyerlinkimg =='Custom') echo 'block'; else echo 'none';?>" />
500
+ </td>
501
+ <td><small>&nbsp;</small></td>
502
+ </tr>
503
+ <tr>
504
+ <td class="scope-label"><a href="#codflyerlinkimgalt_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a></td>
505
+ <td class="label"><label for="usedimage">Alt text for flyer link image</label></td>
506
+ <td class="value">
507
+ <input type="text" id="codflyerlinkimgalt" name="codflyerlinkimgalt" class=" input-text"
508
+ value="<?php if ($codflyerlinkimgalt == '') echo 'Click for PDF of this product'; else echo $codflyerlinkimgalt ;?>" />
509
+ </td>
510
+ <td><small>&nbsp;</small></td>
511
+ </tr>
512
+ <tr><td class="scope-label"></td><td class="label"></td><td class="value"></td><td><small>&nbsp;</small></td></tr>
513
+ </table>
514
+ <fieldset style="width:460px;">
515
+ <legend class="displayOption"><a href="#displayoptions_tooltip"><img src="<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>" align="absmiddle" /></a>&nbsp; Display Options</legend>
516
+ <table class="form-list" cellpadding='0'>
517
+ <tr>
518
+ <td class="label"><label for="codbeforename">Display before product name</label></td>
519
+ <td class="value"><input name="codbeforename" id="codbeforename" value="checked" <?php if ($codbeforename =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
520
+ <td class="scope-label"></td>
521
+ <td><small>&nbsp;</small></td>
522
+ </tr>
523
+ <tr>
524
+ <td class="label"><label for="codaftername">Display after product name</label></td>
525
+ <td class="value"><input name="codaftername" id="codaftername" value="checked" <?php if ($codaftername =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
526
+ <td class="scope-label"></td>
527
+ <td><small>&nbsp;</small></td>
528
+ </tr>
529
+
530
+ <tr>
531
+ <td class="label"><label for="codbeforeemailto">Display before 'Email to a friend'</label></td>
532
+ <td class="value"><input name="codbeforeemailto" id="codbeforeemailto" value="checked" <?php if ($codbeforeemailto =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
533
+ <td class="scope-label"></td>
534
+ <td><small>&nbsp;</small></td>
535
+ </tr>
536
+ <tr>
537
+ <td class="label"><label for="codafteremailto">Display after 'Email to a friend'</label></td>
538
+ <td class="value"><input name="codafteremailto" id="codafteremailto" value="checked" <?php if ($codafteremailto =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
539
+ <td class="scope-label"></td>
540
+ <td><small>&nbsp;</small></td>
541
+ </tr>
542
+
543
+ <tr>
544
+ <td class="label"><label for="codbeforeOR">Display before 'OR'</label></td>
545
+ <td class="value"><input name="codbeforeOR" id="codbeforeOR" value="checked" <?php if ($codbeforeOR =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
546
+ <td class="scope-label"></td>
547
+ <td><small>&nbsp;</small></td>
548
+ </tr>
549
+ <tr>
550
+ <td class="label"><label for="codafterOR">Display after 'OR'</label></td>
551
+ <td class="value"><input name="codafterOR" id="codafterOR" value="checked" <?php if ($codafterOR =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
552
+ <td class="scope-label"></td>
553
+ <td><small>&nbsp;</small></td>
554
+ </tr>
555
+
556
+ <tr>
557
+ <td class="label"><label for="codbeforeoverview">Display before 'Quick Overview'</label></td>
558
+ <td class="value"><input name="codbeforeoverview" id="codbeforeoverview" value="checked" <?php if ($codbeforeoverview =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
559
+ <td class="scope-label"></td>
560
+ <td><small>&nbsp;</small></td>
561
+ </tr>
562
+ <tr>
563
+ <td class="label"><label for="codafteroverview">Display after 'Quick Overview'</label></td>
564
+ <td class="value"><input name="codafteroverview" id="codafteroverview" value="checked" <?php if ($codafteroverview =="checked") echo "checked" ?> class=" input-checkbox" type="checkbox"/></td>
565
+ <td class="scope-label"></td>
566
+ <td><small>&nbsp;</small></td>
567
+ </tr>
568
+ </table>
569
+ </fieldset>
570
+
571
+ </tbody>
572
+ </table>
573
+ </div>
574
+ </div>
575
+ </div>
576
+ </form>
577
+ <?php
578
+ break;
579
+ }
580
+ ?>
581
+
582
+ </div>
583
+ </div>
584
+ </div>
585
+ </div>
586
+ <div id="accountid_tooltip" class="hidden">
587
+ <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/accountid.html'); ?>
588
+ </div>
589
+ <div id="secretkey_tooltip" class="hidden">
590
+ <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/secretkey.html'); ?>
591
+ </div>
592
+ <div id="kickoffurl_tooltip" class="hidden">
593
+ <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/kickoffurl.html'); ?>
594
+ </div>
595
+ <div id="enablefreshflyers_tooltip" class="hidden">
596
+ <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/enablefreshflyers.html'); ?>
597
+ </div>
598
+ <div id="enablereviews_tooltip" class="hidden">
599
+ <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/enablereviews.html'); ?>
600
+ </div>
601
+ <div id="getpricefromchild_tooltip" class="hidden">
602
+ <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/getpricefromchild.html'); ?>
603
+ </div>
604
+ <div id="codflyerlinkimg_tooltip" class="hidden">
605
+ <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/codflyerlinkimg.html'); ?>
606
+ </div>
607
+ <div id="codflyerlinkimgalt_tooltip" class="hidden">
608
+ <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/codflyerlinkimgalt.html'); ?>
609
+ </div>
610
+ <div id="displayoptions_tooltip" class="hidden">
611
+ <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/displayoptions.html'); ?>
612
+ </div>
613
+ <div id="datafilebackground_tooltip" class="hidden">
614
+ <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/datafilebackground.html'); ?>
615
+ </div>
616
+ <div id="data_file_launch_mode_tooltip" class="hidden">
617
+ <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/datafilelaunchmode.html'); ?>
618
+ </div>
619
+ <div id="cronjoburl_tooltip" class="hidden">
620
+ <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/cronjoburl.html'); ?>
621
+ </div>
622
+ <div id="codoption_tooltip" class="hidden">
623
+ <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/CoDDataFileLaunch.html'); ?>
624
+ </div>
625
+ <div id="manual_tooltip" class="hidden">
626
+ <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/ManualDataFileLaunch.html'); ?>
627
+ </div>
628
+
629
+ <div id="waitforminute_tooltip" class="hidden">
630
+ <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/waitforminute.html'); ?>
631
+ </div>
632
+ <div id="includeshortdescription_tooltip" class="hidden">
633
+ <?php echo file_get_contents('http://www.catalog-on-demand.com/support/magento/shortdesc.html'); ?>
634
+ </div>
635
+
636
+ <script type="text/javascript" src="<?php echo $this->getJsUrl('jquery/jquery-1.2.6.noConflict.min.js') ?>"></script>
637
+ <script type="text/javascript" src="<?php echo $this->getJsUrl('jquery/jquery.tooltip.js') ?>"></script>
638
+ <script type="text/javascript">
639
+ jQuery("#content a").tooltip({
640
+ bodyHandler: function() {
641
+ return jQuery(jQuery(this).attr("href")).html();
642
+ },
643
+ delay: 0,
644
+ showURL: false
645
+ });
646
+
647
+ function start_codi_import(){
648
+ codi = new Codi('<?=$post_url?>','<?=$post_url_upd?>');
649
+ codi.startCodiImport();
650
+ }
651
+
652
+ function onBackgroundProcess(obj){
653
+ var value = 0;
654
+ if ( obj.checked == true )
655
+ value = 1;
656
+
657
+ var url = "<?php echo $post_bgprocess_check; ?>";
658
+ var param = "check=" + value;
659
+ new Ajax.Request(url,
660
+ {
661
+ method:'post',
662
+ parameters: param,
663
+ onSuccess: function(transport) {
664
+ }
665
+ });
666
+
667
+ }
668
+
669
+ var Codi = Class.create();
670
+
671
+ Codi.prototype = {
672
+ initialize: function(postUrl, postUrlUpd) {
673
+
674
+ this.postUrl = postUrl; //'https://techatcost.com/purchases/ajax/';
675
+ this.postUrlUpd = postUrlUpd;
676
+ this.failureUrl = document.URL;
677
+ // object with event message data
678
+ this.objectMsg = null;
679
+ // interval object
680
+ this.updateTimer = null;
681
+ // default shipping code. Display on errors
682
+
683
+ elem = 'checkoutSteps';
684
+ clickableEntity = '.head';
685
+
686
+ // overwrite Accordion class method
687
+ var headers = $$('#' + elem + ' .section ' + clickableEntity);
688
+ headers.each(function(header) {
689
+ Event.observe(header,'click',this.sectionClicked.bindAsEventListener(this));
690
+ }.bind(this));
691
+ },
692
+ startCodiImport: function () {
693
+ _this = this;
694
+ var param = "is_process=";
695
+ if ( jQuery('#background_process').is(':checked') == true )
696
+ param += "1";
697
+ else
698
+ param += "0";
699
+ new Ajax.Request(this.postUrl,
700
+ {
701
+ method:'post',
702
+ parameters: param,
703
+ requestTimeout: 100,
704
+
705
+ onSuccess: function(transport) {
706
+ //var ret_msg = transport.responseText.evalJSON();
707
+ //var status_div = document.getElementById('codi_status_template');
708
+ var ret_msg = transport.responseText.evalJSON();
709
+ var status_div = document.getElementById('codi_status_template');
710
+ var v;
711
+ var totalproduct=ret_msg.length;
712
+ for (var i=0;i<ret_msg.length;i++) {
713
+ //alert(ret_msg[i]);
714
+ productid=ret_msg[i];
715
+ var j=i+1;
716
+ v=createfilenew(productid,j,totalproduct);
717
+
718
+ }
719
+ var status_div = document.getElementById('codi_status_template');
720
+
721
+
722
+ if ( ret_msg.success == 1 ){
723
+ status_div.innerHTML = "<p>A test data file is now being created. <span style='margin-left:15px;'><img src=\"<?=$this->getSkinUrl($this->__('images/codimport_run.gif'))?>\" ></span>&nbsp;&nbsp;&nbsp;<button type='button' class='scalable cancel' onclick='cancel_codi_import()' style='margin-left:25px' ><span>Cancel</span></button></p>";
724
+ _this.updateTimer = setInterval(function(){_this.updateEvent();}, 10000);
725
+ }else if ( ret_msg.error == 1 ){
726
+ status_div.innerHTML = "<p>The Magento extension was prevented from creating a file in the folder CODdataFiles. Please notify your Magento administrator.</p>";
727
+ }else if ( ret_msg.exec == 1 || ret_msg.shellexec == 1 ) {
728
+ status_div.innerHTML = "<p>The <strong>exec</strong> and/or <strong>shell_exec</strong> functions are disabled in your php.ini. See the line starting with <strong>'disable_functions ='</strong>. Unless you remove both <strong>'exec'</strong> and <strong>'shell_exec'</strong> from this line, you may not use the background process to create data files. This may be a problem if you have a large product database.</p>";
729
+ }
730
+ },
731
+ onTimeout: function() {
732
+ var status_div = document.getElementById('codi_status_template');
733
+ status_div.innerHTML = "<p>Your test data file was not created. Please contact your administrator.</p>";
734
+ },
735
+ onFailure: function() {
736
+ var status_div = document.getElementById('codi_status_template');
737
+ status_div.innerHTML = "<p>Your test data file was not created. Please contact your administrator.</p>";
738
+ }
739
+ });
740
+ },
741
+
742
+ updateEvent: function () {
743
+ _this = this;
744
+ new Ajax.Request(this.postUrlUpd,
745
+ {
746
+ method: 'post',
747
+ onSuccess: function(transport) {
748
+ _this.objectMsg = transport.responseText.evalJSON();
749
+
750
+ if (_this.objectMsg.canceled == 1) {
751
+ _this.clearUpdateInterval();
752
+ _this.objectMsg.message = 'canceled';
753
+ _this.updateStatusHtml();
754
+ }
755
+
756
+ if (_this.objectMsg.processed == 1) {
757
+ }
758
+
759
+ if (_this.objectMsg.fileerror == 1) {
760
+ _this.clearUpdateInterval();
761
+ _this.objectMsg.message = 'fileerror';
762
+ _this.updateStatusHtml();
763
+ }
764
+
765
+ if (_this.objectMsg.error == 1) {
766
+ _this.clearUpdateInterval();
767
+ _this.objectMsg.message = 'error';
768
+ _this.updateStatusHtml();
769
+ }
770
+
771
+ if (_this.objectMsg.finished == 1) {
772
+ _this.objectMsg.message = 'finished';
773
+ _this.updateStatusHtml();
774
+ _this.clearUpdateInterval();
775
+ }
776
+ },
777
+ onFailure: this.ajaxFailure.bind(),
778
+ });
779
+ },
780
+
781
+ updateStatusHtml: function(){
782
+ message = this.objectMsg.message.toLowerCase();
783
+ var status_div = document.getElementById('codi_status_template');
784
+ var img_url = "<?php echo $this->getSkinUrl($this->__('images/codimport_yes.gif')) ?>";
785
+
786
+ if ( message == 'finished' ){
787
+ status_div.innerHTML="<p id='codi_status_template_button'>Your test data file was created successfully. &nbsp;<img src='" + img_url + "' /><button type='button' class='scalable add' style='margin-left:25px;' onclick='download_codi_file();' ><span>Download Data File</span></button><button type='button' class='scalable add' style='margin-left:25px;' onclick='delete_codi_file();' ><span>Delete Data File</span></button></p>";
788
+ this.clearUpdateInterval();
789
+ }
790
+
791
+ if ( message == 'canceled' ){
792
+ this.clearUpdateInterval();
793
+ }
794
+
795
+ if ( message == 'processed' ){
796
+ }
797
+
798
+ if ( message == 'fileerror' ){
799
+ status_div.innerHTML="<p>Your test data file was not created. Please contact your administrator( File Error ).</p>";
800
+ this.clearUpdateInterval();
801
+ }
802
+
803
+ if ( message == 'error' ){
804
+ status_div.innerHTML="<p>Your test data file was not created. Please contact your administrator.</p>";
805
+ this.clearUpdateInterval();
806
+ }
807
+
808
+ },
809
+
810
+ ajaxFailure: function(){
811
+ this.clearUpdateInterval();
812
+ var status_div = document.getElementById('codi_status_template');
813
+ status_div.innerHTML = "<p>Your test data file was not created. Please contact your administrator(Ajax failure).</p>";
814
+ },
815
+
816
+ clearUpdateInterval: function () {
817
+ clearInterval(this.updateTimer);
818
+ },
819
+ }
820
+ function download_codi_file()
821
+ {
822
+ window.location.href="<?php echo $download_url?>";
823
+
824
+ }
825
+ function delete_codi_file()
826
+ {
827
+ window.location.href="<?php echo $delete_codi_url?>";
828
+
829
+ }
830
+
831
+
832
+ function displayBlock(show,hide,hideboth)
833
+ {
834
+
835
+ if(hideboth=='1')
836
+ {
837
+ document.getElementById(show).style.display='none';
838
+ document.getElementById(hide).style.display='none';
839
+ document.getElementById('waitforminute').style.display='';
840
+
841
+ }
842
+ else
843
+ {
844
+ document.getElementById('waitforminute').style.display='none';
845
+ document.getElementById(show).style.display='';
846
+ document.getElementById(hide).style.display='none';
847
+ }
848
+
849
+ }
850
+ function cancel_codi_import(){
851
+
852
+ var url = "<?php echo $post_url_cancel; ?>";
853
+ new Ajax.Request(url,
854
+ {
855
+ method:'post',
856
+ onSuccess: function(transport) {
857
+ var ret_msg = transport.responseText;
858
+
859
+ if ( ret_msg ){
860
+
861
+ //var text = "<a href='#datafilebackground_tooltip'><img src=\"<?php echo $this->getSkinUrl($this->__('images/preview_field_help.png')) ?>\" /></a><br />";
862
+ text = "<button type='button' class='scalable add' onclick='start_codi_import()' style='margin-left:25px;' ><span>Create Data File</span></button>";
863
+
864
+ var status_div = document.getElementById('codi_status_template');
865
+ status_div.innerHTML = text;
866
+ }
867
+ }
868
+ });
869
+ }
870
+
871
+ function makeLowercase() {
872
+ document.getElementById('userid').value = document.getElementById('userid').value.toLowerCase();
873
+ }
874
+
875
+ function valuevalidation(value, min, max, alertbox, datatype)
876
+ {
877
+
878
+ with (value)
879
+ {
880
+ checkvalue=parseFloat(value);
881
+ if (datatype)
882
+ { smalldatatype=datatype.toLowerCase();
883
+ if (smalldatatype.charAt(0)=="i") {checkvalue=parseInt(value)};
884
+ }
885
+ if ((parseFloat(min)==min && checkvalue<min) || (parseFloat(max)==max && checkvalue>max) || value!=checkvalue)
886
+ {if (alertbox!="") {alert(alertbox);} return false;}
887
+ else {return true;}
888
+ }
889
+ }
890
+
891
+ function createfilenew(productid,i,totalproduct)
892
+ { var img_url = "<?php echo $this->getSkinUrl($this->__('images/codimport_yes.gif')) ?>";
893
+ var r;
894
+ var base = "<?php echo $basePath ?>";
895
+ var status_div = document.getElementById('codi_status_template');
896
+ var a = new Ajax.Request("<?php echo $newpostupdate; ?>",
897
+ { asynchronous:false,
898
+ method: 'post',
899
+ parameters: "product="+productid+"&counter="+i+"&total="+totalproduct+"&basepath="+base,
900
+ onSuccess: function(transport) {
901
+ r= transport.responseText;
902
+ if(r=='100'){
903
+ status_div.innerHTML="<p id='codi_status_template_button'>"+transport.responseText+"% </p> Your test data file was created successfully.<img src='" + img_url + "' /><button type='button' class='scalable add' style='margin-left:25px;' onclick='download_codi_file();' ><span>Download Data File</span></button><button type='button' class='scalable add' style='margin-left:25px;' onclick='delete_codi_file();' ><span>Delete Data File</span></button> ";
904
+ }
905
+ else{
906
+ if(r!="error"){
907
+ status_div.innerHTML="<p id='codi_status_template_button'>"+transport.responseText+"% </p><p>A test data file is now being created. <span style='margin-left:15px;'><img src=\"<?=$this->getSkinUrl($this->__('images/codimport_run.gif'))?>\" ></span>&nbsp;&nbsp;&nbsp;<button type='button' class='scalable cancel' onclick='cancel_codi_import()' style='margin-left:25px' ><span>Cancel</span></button></p>";
908
+ }
909
+ }
910
+ if(r=="error")
911
+ {
912
+ status_div.innerHTML="<p>Your test data file was not created. Please contact your administrator( File Error ).</p>";
913
+ }
914
+
915
+ }
916
+
917
+ //onFailure: this.ajaxFailure.bind(),
918
+ });
919
+ return r;
920
+
921
+ //alert("end");
922
+
923
+
924
+
925
+ }
926
+ </script>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_PDF_per_Product</name>
4
- <version>3.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Catalog-On-Demand</summary>
10
  <description>Catalog-On-Demand</description>
11
- <notes>3.0.1 - Added Magento 1.6 compatibility.</notes>
12
  <authors><author><name>catalogondemand</name><user>auto-converted</user><email>timh@catalog-on-demand.com</email></author></authors>
13
- <date>2011-11-08</date>
14
- <time>09:39:19</time>
15
- <contents><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><file name="codimport_run.gif" hash="e805ea7eca1f34c75ba0f93780d32d38"/><file name="codimport_yes.gif" hash="0afb20898a704a106cb4c598868abf32"/><file name="preview_field_help.png" hash="1b1601459d25e8b1a6b1d109782078d2"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="jquery"><file name="jquery-1.2.6.noConflict.min.js" hash="090fdb3fbcb4727c0ca20cca87e7e12d"/><file name="jquery.tooltip.js" hash="d17cc8af1b8a595bd597084232be87e0"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="codi"><file name="index.phtml" hash="f921a1948213fb08775adc9b4e57b955"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="catalog"><dir name="product"><file name="view.phtml" hash="de6b3d9d0787a3f96955b8089898b441"/></dir></dir></dir></dir></dir></dir></target><target name="magecommunity"><dir name="Mage"><dir name="Codi"><dir name="Block"><dir name="Adminhtml"><file name="Menu.php" hash="ae8a9d1be49f00102911ef5fbe97c126"/><file name="Switcher.php" hash="0d74bdf48e12047e7317e4a877efb30d"/></dir><dir name="Customer"><file name="Codi.php" hash="17c557dbcfadd336dc7ba773d6304fc0"/></dir></dir><dir name="Helper"><file name="Data.php" hash="9eb7d7267d816ede3f042edae8bae4d6"/></dir><dir name="Model"><file name="Codi.php" hash="a7b2befcffbeaffd4f1c5ed5546e57c4"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="MenuController.php" hash="c4c6c4b7e594047f5977b3443d3dc324"/></dir><file name="DeleteController.php" hash="fed4a29a509a181f0f185de0609872db"/><file name="NsyncController.php" hash="956d90a4f986b5a5a8347d429ff0487d"/><file name="SyncController.php" hash="be23847dd365c3f0ba5efb467a6b1f6b"/></dir><dir name="etc"><file name="config.xml" hash="2d0030b10a462c3e2f2ebff532befabe"/></dir><file name="Codi_Process.php" hash="fbbd13784f36efb5db3cf10f5981bcce"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_Codi.xml" hash="5d635cd2a0d415b67f095bda0298445d"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Mage_PDF_per_Product</name>
4
+ <version>3.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Catalog-On-Demand</summary>
10
  <description>Catalog-On-Demand</description>
11
+ <notes>3.0.2 - Added Magento 1.6 compatibility and Tier Price support in data file</notes>
12
  <authors><author><name>catalogondemand</name><user>auto-converted</user><email>timh@catalog-on-demand.com</email></author></authors>
13
+ <date>2011-11-15</date>
14
+ <time>06:28:16</time>
15
+ <contents><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><file name="codimport_run.gif" hash="e805ea7eca1f34c75ba0f93780d32d38"/><file name="codimport_yes.gif" hash="0afb20898a704a106cb4c598868abf32"/><file name="preview_field_help.png" hash="1b1601459d25e8b1a6b1d109782078d2"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="codi"><file name="index.phtml" hash="7dcd20210854459bcc050e7b5498441d"/></dir></dir><dir name="layout"><file name="codi.xml" hash="9407985f30403744eb4e758312d62aef"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="catalog"><dir name="product"><file name="view.phtml" hash="de6b3d9d0787a3f96955b8089898b441"/></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="jquery"><file name="jquery-1.2.6.noConflict.min.js" hash="090fdb3fbcb4727c0ca20cca87e7e12d"/><file name="jquery.tooltip.js" hash="d17cc8af1b8a595bd597084232be87e0"/></dir></dir></target><target name="magecommunity"><dir name="Mage"><dir name="Codi"><dir name="Block"><dir name="Adminhtml"><file name="Menu.php" hash="ae8a9d1be49f00102911ef5fbe97c126"/><file name="Switcher.php" hash="0d74bdf48e12047e7317e4a877efb30d"/></dir><dir name="Customer"><file name="Codi.php" hash="17c557dbcfadd336dc7ba773d6304fc0"/></dir></dir><dir name="Helper"><file name="Data.php" hash="814dca393cfc94f71bacd7b06c186878"/></dir><dir name="Model"><file name="Codi.php" hash="530cc2b5991874e0c968ae81e89966b2"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="MenuController.php" hash="686ead23e29d5fa27288451274e51b1c"/></dir><file name="DeleteController.php" hash="fed4a29a509a181f0f185de0609872db"/><file name="NsyncController.php" hash="956d90a4f986b5a5a8347d429ff0487d"/><file name="SyncController.php" hash="be23847dd365c3f0ba5efb467a6b1f6b"/></dir><dir name="etc"><file name="config.xml" hash="00096cb492a4c0b0e90b1a9ea53e3396"/></dir><file name="Codi_Process.php" hash="fbbd13784f36efb5db3cf10f5981bcce"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_Codi.xml" hash="5d635cd2a0d415b67f095bda0298445d"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>