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 +246 -185
- app/code/community/Mage/Codi/Model/Codi.php +851 -794
- app/code/community/Mage/Codi/controllers/Adminhtml/MenuController.php +12 -2
- app/code/community/Mage/Codi/etc/config.xml +1 -1
- app/design/adminhtml/default/default/layout/codi.xml +12 -0
- app/design/adminhtml/default/default/template/codi/index.phtml +926 -873
- package.xml +5 -5
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.
|
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 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
$
|
318 |
-
|
319 |
-
$
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
$
|
364 |
-
|
365 |
-
$
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
$
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
$
|
418 |
-
//*************************
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
$
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
$
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
$
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
$
|
497 |
-
$
|
498 |
-
$
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
$
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
}
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
$
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
$
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
$
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
$
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
$
|
638 |
-
$
|
639 |
-
$
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
$
|
661 |
-
|
662 |
-
$
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
$
|
668 |
-
|
669 |
-
$
|
670 |
-
$
|
671 |
-
$
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
$
|
680 |
-
$
|
681 |
-
$
|
682 |
-
|
683 |
-
$
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
$
|
690 |
-
$
|
691 |
-
|
692 |
-
$
|
693 |
-
$
|
694 |
-
|
695 |
-
|
696 |
-
$
|
697 |
-
|
698 |
-
|
699 |
-
$
|
700 |
-
$
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
$
|
710 |
-
$
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
$Comment .="
|
727 |
-
$Comment .="
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
Mage::
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
$
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
$
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
}
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
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(''=>'',''=>'');
|
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 |
-
|
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.
|
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 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
#tooltip
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
</
|
108 |
-
</
|
109 |
-
|
110 |
-
<
|
111 |
-
<
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
$
|
149 |
-
|
150 |
-
|
151 |
-
if
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
echo
|
217 |
-
|
218 |
-
echo
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
$
|
242 |
-
|
243 |
-
$
|
244 |
-
$
|
245 |
-
|
246 |
-
$
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
$
|
253 |
-
$
|
254 |
-
|
255 |
-
$update_guide
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
<
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
<div class=
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
</
|
334 |
-
<
|
335 |
-
<
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
<?php
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
<input type="radio" value="
|
379 |
-
<
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
if (
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
<td
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
<td class="
|
421 |
-
<td><
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
<td><
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
<td class="
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
<img src="<?php
|
440 |
-
|
441 |
-
|
442 |
-
<td
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
style="
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
<td class="
|
453 |
-
<td class="label"
|
454 |
-
<td
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
<td><
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
<
|
465 |
-
|
466 |
-
<td class="
|
467 |
-
<td class="
|
468 |
-
<td
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
<td class="
|
473 |
-
<td class="
|
474 |
-
<td
|
475 |
-
|
476 |
-
</
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
<td class="
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
<td class="scope-label"></td>
|
495 |
-
<td
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
<td><small> </small></td>
|
502 |
-
</tr>
|
503 |
-
|
504 |
-
|
505 |
-
<td class="label"><label for="
|
506 |
-
<td class="value"
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
</
|
516 |
-
|
517 |
-
|
518 |
-
</
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
</
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
</
|
532 |
-
|
533 |
-
<
|
534 |
-
|
535 |
-
</
|
536 |
-
<
|
537 |
-
|
538 |
-
|
539 |
-
<
|
540 |
-
|
541 |
-
</
|
542 |
-
|
543 |
-
|
544 |
-
</
|
545 |
-
<
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
</
|
551 |
-
<
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
<
|
558 |
-
|
559 |
-
|
560 |
-
<
|
561 |
-
|
562 |
-
|
563 |
-
<
|
564 |
-
|
565 |
-
|
566 |
-
<
|
567 |
-
|
568 |
-
</
|
569 |
-
|
570 |
-
|
571 |
-
</
|
572 |
-
|
573 |
-
|
574 |
-
</div>
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
}
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
}
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
status_div
|
813 |
-
|
814 |
-
}
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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> </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> 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. <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> <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> </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> </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> </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> </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> </small></td>
|
371 |
+
</tr>
|
372 |
+
<tr><td class="scope-label"></td><td class="label"></td><td class="value"></td><td><small> </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');"/> <label for="manual">Manual <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');" /> <label for="cod">Catalog-on-Demand <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;?>"> <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');" /> <label for="magento">Cron-job <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> </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> </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> </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> </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> </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> </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> 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> </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> </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> </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> </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> </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';"/> <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 |
+
<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> </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> </small></td>
|
511 |
+
</tr>
|
512 |
+
<tr><td class="scope-label"></td><td class="label"></td><td class="value"></td><td><small> </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> 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> </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> </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> </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> </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> </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> </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> </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> </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> <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. <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> <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.
|
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.
|
12 |
<authors><author><name>catalogondemand</name><user>auto-converted</user><email>timh@catalog-on-demand.com</email></author></authors>
|
13 |
-
<date>2011-11-
|
14 |
-
<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="
|
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>
|