PageRenderTime 38ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/application/views/pages/admin/prods.php

https://bitbucket.org/chadsaun/ifrogz-panel
PHP | 1883 lines | 1805 code | 21 blank | 57 comment | 271 complexity | fedd94ab2a1a74f934902bc6b9ee3fad MD5 | raw file
  1. <script language="JavaScript" type="text/javascript" src="http://assets.ifrogz.com/lib/packages/scriptaculous-js/1.8.1/prototype.js"></script>
  2. <script language="JavaScript" type="text/javascript" src="http://assets.ifrogz.com/lib/packages/scriptaculous-js/1.8.1/effects.js"></script>
  3. <script language="JavaScript" type="text/javascript" src="http://assets.ifrogz.com/lib/packages/scriptaculous-js/1.8.1/controls.js"></script>
  4. <script language="JavaScript" type="text/javascript" src="/lib/js/pages/admin/upc.js"></script>
  5. <script language="JavaScript" type="text/javascript">
  6. function loadOptions(id,i,selected) {
  7. var url = "/admin/prodsoptions.php";
  8. var params = "optGrpID="+id+'&cnt='+i+'&selected='+selected
  9. //alert(params);
  10. var ajax = new Ajax.Updater(
  11. {success: "div_option_set"+i},
  12. url,
  13. {
  14. method: "post",
  15. parameters: params,
  16. onLoading: function() { Element.show("div_option_set_working"+i); },
  17. onComplete: function() { Element.hide("div_option_set_working"+i); }
  18. });
  19. }
  20. function viewImage(images,view){
  21. if($(view).style.display=='none'){
  22. var outHTML='';
  23. imagesArr = Array();
  24. img=$F(images);
  25. imagesArr=img.split(',');
  26. for(i=0;i<imagesArr.length;i++){
  27. count=i+1;
  28. outHTML+='<div style="float:left;padding:4px;">Image '+count+'<br /><img src="http://ifrogz.com'+imagesArr[i]+'" /></div>';
  29. }
  30. Element.show(view);
  31. $(view).innerHTML=outHTML;
  32. } else {
  33. Element.hide(view);
  34. }//alert(outHTML);
  35. }
  36. </script>
  37. <style>
  38. div#links {text-align: center;}
  39. div#links a {display: block; text-align: center;}
  40. div#links a span {display: none; text-decoration:none;color:#003366;}
  41. div#links a:hover span {
  42. display: block;
  43. position: absolute;
  44. width: 200px;
  45. z-index: 100;
  46. text-align: left;
  47. margin: 20px 0 0 -20px;
  48. background:#D9DFEF;
  49. border: 1px solid #003366;
  50. padding:4px;
  51. }
  52. .style1 {font-size: 10px}
  53. .imageView {
  54. position: absolute;
  55. left:0px;
  56. top:0px;
  57. z-index:100;
  58. width:800px;
  59. border:1px solid #003366;
  60. padding:4px;
  61. background-color:#FFFFFF;
  62. font-size:9px;
  63. }
  64. div.autocomplete {
  65. position:absolute;
  66. background-color:white;
  67. border:1px solid #CCC;
  68. margin:0px;
  69. padding:0px;
  70. }
  71. div.autocomplete ul {
  72. list-style-type:none;
  73. margin:0px;
  74. padding:0px;
  75. width:432px;
  76. }
  77. div.autocomplete ul li.selected { background-color: #E7EAEF;}
  78. div.autocomplete ul li {
  79. list-style-type:none;
  80. display:block;
  81. margin:0;
  82. padding:2px;
  83. height:14px;
  84. cursor:pointer;
  85. }
  86. </style>
  87. <?php
  88. //This code is copyright (c) Internet Business Solutions SL, all rights reserved.
  89. //The contents of this file are protect under law as the intellectual property of Internet
  90. //Business Solutions SL. Any use, reproduction, disclosure or copying of any kind
  91. //without the express and written permission of Internet Business Solutions SL is forbidden.
  92. //Author: Vince Reid, vince@virtualred.net
  93. if(@$storesessionvalue=="") $storesessionvalue="virtualstore".time();
  94. if($_SESSION["loggedon"] != $storesessionvalue || @$disallowlogin==TRUE) exit();
  95. $success=TRUE;
  96. $nprodoptions=0;
  97. $nprodsections=0;
  98. $nalloptions=0;
  99. $nallsections=0;
  100. $nalldropship=0;
  101. $alreadygotadmin = getadminsettings();
  102. $simpleOptions = (($adminTweaks & 2)==2);
  103. $simpleSections = (($adminTweaks & 4)==4);
  104. $dorefresh=FALSE;
  105. if(@$maxprodsects=="") $maxprodsects=20;
  106. if(@$_POST["posted"]=="1"){
  107. $pExemptions=0;
  108. if(is_array(@$_POST["pExemptions"])){
  109. foreach(@$_POST["pExemptions"] as $pExemptObj)
  110. $pExemptions += $pExemptObj;
  111. }
  112. if(@$_POST["act"]=="delete"){
  113. $sSQL = "DELETE FROM pricebreaks WHERE pbProdID='" . mysql_real_escape_string(@$_POST["id"]) . "'";
  114. mysql_query($sSQL) or print(mysql_error());
  115. $sSQL = "DELETE FROM cpnassign WHERE cpaType=2 AND cpaAssignment='" . mysql_real_escape_string(@$_POST["id"]) . "'";
  116. mysql_query($sSQL) or print(mysql_error());
  117. $sSQL = "DELETE FROM products WHERE pID='" . mysql_real_escape_string(@$_POST["id"]) . "'";
  118. mysql_query($sSQL) or print(mysql_error());
  119. $sSQL = "DELETE FROM prodoptions WHERE poProdID='" . mysql_real_escape_string(@$_POST["id"]) . "'";
  120. mysql_query($sSQL) or print(mysql_error());
  121. $sSQL = "DELETE FROM multisections WHERE pID='" . mysql_real_escape_string(@$_POST["id"]) . "'";
  122. mysql_query($sSQL) or print(mysql_error());
  123. $dorefresh=TRUE;
  124. }elseif(@$_POST["act"]=="domodify"){
  125. if(trim(@$_POST["newid"]) != trim(@$_POST["id"])){
  126. $sSQL = "SELECT * FROM products WHERE pID='" . trim(@$_POST["newid"]) . "'";
  127. $result = mysql_query($sSQL) or print(mysql_error());
  128. $success = (mysql_num_rows($result)==0);
  129. mysql_free_result($result);
  130. if($success){
  131. mysql_query("UPDATE pricebreaks SET pbProdID='" . trim(@$_POST["newid"]) . "' WHERE pbProdID='" . trim(@$_POST["id"]) . "'") or print(mysql_error());
  132. mysql_query("UPDATE cpnassign SET cpaAssignment='" . trim(@$_POST["newid"]) . "' WHERE cpaType=2 AND cpaAssignment='" . trim(@$_POST["id"]) . "'") or print(mysql_error());
  133. }
  134. }
  135. if($success){
  136. $sSQL = "UPDATE products SET ";
  137. $sSQL .= "pID='" . mysql_real_escape_string(trim(unstripslashes(@$_POST["newid"]))) . "', ";
  138. $sSQL .= "pNUM='" . mysql_real_escape_string(trim(unstripslashes(@$_POST["altprodid"]))) . "', ";
  139. $sSQL .= "pName='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pName"]))) . "', ";
  140. $sSQL .= "pSection=" . trim(@$_POST["pSection"]) . ", ";
  141. $sSQL .= "pDropship=" . trim(@$_POST["pDropship"]) . ", ";
  142. $sSQL .= "pExemptions=" . $pExemptions . ", ";
  143. $sSQL .= "pDescription='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pDescription"]))) . "', ";
  144. $sSQL .= "pDescription2='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pDescription2"]))) . "', ";
  145. $sSQL .= "pDescription3='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pDescription3"]))) . "', ";
  146. $sSQL .= "pImage='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pImage"]))) . "', ";
  147. $sSQL .= "pLongDescription='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pLongDescription"]))) . "', ";
  148. $sSQL .= "pUPC='" . mysql_real_escape_string(unstripslashes(trim($_POST['pUPC']))) . "', ";
  149. $sSQL .= "pBin='" . mysql_real_escape_string(unstripslashes(trim($_POST['pBin']))) . "', ";
  150. for($index=2; $index <= $adminlanguages+1; $index++){
  151. if(($adminlangsettings & 1)==1) $sSQL .= "pName" . $index . "='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pName" . $index]))) . "', ";
  152. if(($adminlangsettings & 2)==2) $sSQL .= "pDescription" . $index . "='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pDescription" . $index]))) . "', ";
  153. if(($adminlangsettings & 4)==4) $sSQL .= "pLongDescription" . $index . "='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pLongDescription" . $index]))) . "', ";
  154. }
  155. if($setoptions=='yes') {
  156. $comma='';
  157. for($rowcounter=0; $rowcounter < maxprodopts; $rowcounter++){
  158. if(@$_POST["set_options_list" . $rowcounter] != "" && @$_POST["set_options_list" . $rowcounter] != 0){
  159. $str_options .= $comma.@$_POST["set_options_list" . $rowcounter];
  160. $comma=',';
  161. }
  162. }
  163. $sSQL .= "pSetOptions='" . $str_options . "',";
  164. } else $sSQL .= "pSetOptions='',";
  165. $sSQL .= "isSet='" . $completeset . "',";
  166. $sSQL .= "pLargeImage='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pLargeImage"]))) . "', ";
  167. if(trim(@$_POST["pDisplay"]) == "ON")
  168. $sSQL .= "pDisplay=1,pOrder=" . trim(@$_POST["pOrder"]) . ",";
  169. else
  170. $sSQL .= "pDisplay=0,";
  171. if(trim(@$_POST["pEDisplay"]) == "ON")
  172. $sSQL .= "pEDisplay=1,";
  173. else
  174. $sSQL .= "pEDisplay=0,";
  175. $sSQL .= "pTabName='".mysql_real_escape_string(unstripslashes(trim($_POST['pTabName']))) . "', ";
  176. if(@$perproducttaxrate==TRUE)
  177. $sSQL .= "pTax=" . trim(@$_POST["pTax"]) . ",";
  178. if($stockManage != 0 && is_numeric(trim(@$_POST["inStock"])))
  179. $sSQL .= "pInStock=" . trim(@$_POST["inStock"]) . ",";
  180. if(trim(@$_POST["pSell"]) == "ON") $pSell=1; else $pSell=0;
  181. if(trim(@$_POST["stockOptions"]) == "1") $pSell += 2;
  182. if(trim(@$_POST["staticpage"]) == "1") $pSell += 4;
  183. $sSQL .= "pSell=" . $pSell . ",";
  184. $sSQL .= "pURL='" . trim($_POST['pURL']) . "',";
  185. if(@$productdimensions==TRUE)
  186. $sSQL .= "pDims='" . trim(@$_POST["plen"]) . "x" . trim(@$_POST["pwid"]) . "x" . trim(@$_POST["phei"]) . "',";
  187. if(@$digidownloads==TRUE)
  188. $sSQL .= "pDownload='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pDownload"]))) . "',";
  189. if($shipType==1){
  190. if(! is_numeric(trim(@$_POST["pShipping"])))
  191. $sSQL .= "pShipping=0,";
  192. else
  193. $sSQL .= "pShipping=" . trim(@$_POST["pShipping"]) . ",";
  194. if(! is_numeric(trim(@$_POST["pShipping2"])))
  195. $sSQL .= "pShipping2=0,";
  196. else
  197. $sSQL .= "pShipping2=" . trim(@$_POST["pShipping2"]) . ",";
  198. }elseif($shipType==2 || $shipType==3 || $shipType==4 || $shipType==6){
  199. if(! is_numeric(trim(@$_POST["pShipping"])))
  200. $sSQL .= "pWeight=0,";
  201. else
  202. $sSQL .= "pWeight=" . trim(@$_POST["pShipping"]) . ",";
  203. }
  204. if(trim(@$_POST["pWholesalePrice"]) != "")
  205. $sSQL .= "pWholesalePrice=" . trim(@$_POST["pWholesalePrice"]) . ",";
  206. else
  207. $sSQL .= "pWholesalePrice=0,";
  208. //wholesale pricing group added 6-6-06 By Blake
  209. $sSQL .= "pPricing_group=" .trim(@$_POST["pPricing_group"]). ",";
  210. //
  211. if(trim(@$_POST["pListPrice"]) != "")
  212. $sSQL .= "pListPrice=" . trim(@$_POST["pListPrice"]) . ",";
  213. else
  214. $sSQL .= "pListPrice=0,";
  215. $sSQL .= "pPrice=" . trim(@$_POST["pPrice"]) . ",";
  216. if(! is_numeric(trim(@$_POST["pCost"])))
  217. $sSQL .= "pCost=0,";
  218. else
  219. $sSQL .= "pCost=" . trim(@$_POST["pCost"]) . ",";
  220. if(! is_numeric(trim(@$_POST["pCustomsvalue"])))
  221. $sSQL .= "pCustomsvalue=0,";
  222. else
  223. $sSQL .= "pCustomsvalue=" . trim(@$_POST["pCustomsvalue"]) . ",";
  224. $sSQL .= "pCatOnDetail='" . trim(@$_POST["pCatOnDetail"]) . "', ";
  225. $sSQL .= "pTitleTag = '" . trim($_POST['title_tag']) . "', ";
  226. $sSQL .= "pMetaDescription = '" . trim($_POST['meta_description']) . "' ";
  227. $sSQL .= "WHERE pID='" . @$_POST["id"] . "'";
  228. //echo $sSQL;
  229. //exit();
  230. mysql_query($sSQL) or print(mysql_error());
  231. $sSQL = "DELETE FROM prodoptions WHERE poProdID='" . @$_POST["id"] . "'";
  232. mysql_query($sSQL) or print(mysql_error());
  233. for($rowcounter=0; $rowcounter < maxprodopts; $rowcounter++){
  234. if(@$_POST["pOption" . $rowcounter] != "" && @$_POST["pOption" . $rowcounter] != 0){
  235. $sSQL = "INSERT INTO prodoptions (poProdID,poOptionGroup) VALUES ('" . @$_POST["newid"] . "'," . @$_POST["pOption" . $rowcounter] . ")";
  236. mysql_query($sSQL) or print(mysql_error());
  237. }
  238. }
  239. $sSQL = "DELETE FROM multisections WHERE pID='" . @$_POST["id"] . "'";
  240. mysql_query($sSQL) or print(mysql_error());
  241. for($rowcounter=0; $rowcounter < $maxprodsects; $rowcounter++){
  242. if(@$_POST["pSection" . $rowcounter] != "" && @$_POST["pSection" . $rowcounter] != 0 && @$_POST["pSection"] != @$_POST["pSection" . $rowcounter]){
  243. $sSQL = "INSERT INTO multisections (pID,pSection) VALUES ('" . @$_POST["newid"] . "'," . @$_POST["pSection" . $rowcounter] . ")";
  244. mysql_query($sSQL) or print(mysql_error());
  245. }
  246. }
  247. $dorefresh=TRUE;
  248. }else
  249. $errmsg = $yyPrDup;
  250. }elseif(@$_POST["act"]=="doaddnew"){
  251. $sSQL = "SELECT * FROM products WHERE pID='" . trim(@$_POST["newid"]) . "'";
  252. $result = mysql_query($sSQL) or print(mysql_error());
  253. $success = (mysql_num_rows($result)==0);
  254. mysql_free_result($result);
  255. if($success){
  256. $sSQL = "INSERT INTO products (pUPC,pBin,pID,pNUM,pName,pSection,pDropship,pExemptions,pDescription,pImage,pLongDescription,pCatOnDetail,";
  257. for($index=2; $index <= $adminlanguages+1; $index++){
  258. if(($adminlangsettings & 1)==1) $sSQL .= "pName" . $index . ",";
  259. if(($adminlangsettings & 2)==2) $sSQL .= "pDescription" . $index . ",";
  260. if(($adminlangsettings & 4)==4) $sSQL .= "pLongDescription" . $index . ",";
  261. }
  262. $sSQL .= "pSetOptions,isSet,pLargeImage,pPrice,pCost,pCustomsvalue,pWholesalePrice,pPricing_group,pListPrice,";
  263. if($shipType==1) $sSQL .= "pShipping,pShipping2,";
  264. $sSQL .= "pDisplay,pOrder,pEDisplay,pTabName,";
  265. if(@$perproducttaxrate==TRUE) $sSQL .= "pTax,";
  266. if($stockManage != 0 && is_numeric(trim(@$_POST["inStock"]))) $sSQL .= "pInStock,";
  267. if(@$productdimensions==TRUE) $sSQL .= 'pDims,';
  268. if(@$digidownloads==TRUE) $sSQL .= 'pDownload,';
  269. $sSQL .= "pSell,pURL,pWeight,pTitleTag,pMetaDescription) VALUES (";
  270. $sSQL .= "'" . trim(unstripslashes(@$_POST["pUPC"])) . "',";
  271. $sSQL .= "'" . trim(unstripslashes(@$_POST["pBin"])) . "',";
  272. $sSQL .= "'" . trim(unstripslashes(@$_POST["newid"])) . "',";
  273. $sSQL .= "'" . trim(unstripslashes(@$_POST["altprodid"])) . "',";
  274. $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pName"])) . "',";
  275. $sSQL .= @$_POST["pSection"] . ",";
  276. $sSQL .= @$_POST["pDropship"] . ",";
  277. $sSQL .= $pExemptions . ",";
  278. $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pDescription"])) . "',";
  279. $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pImage"])) . "',";
  280. $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pLongDescription"])) . "',";
  281. $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pCatOnDetail"])) . "',";
  282. for($index=2; $index <= $adminlanguages+1; $index++){
  283. if(($adminlangsettings & 1)==1) $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pName" . $index])) . "',";
  284. if(($adminlangsettings & 2)==2) $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pDescription" . $index])) . "',";
  285. if(($adminlangsettings & 4)==4) $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pLongDescription" . $index])) . "',";
  286. }
  287. if($setoptions=='yes') {
  288. $comma='';
  289. for($rowcounter=0; $rowcounter < maxprodopts; $rowcounter++){
  290. if(@$_POST["set_options_list" . $rowcounter] != "" && @$_POST["set_options_list" . $rowcounter] != 0){
  291. $str_options .= $comma.@$_POST["set_options_list" . $rowcounter];
  292. $comma=',';
  293. }
  294. }
  295. $sSQL .= "'" . $str_options . "',";
  296. } else $sSQL .= "'',";
  297. $sSQL .= "'" . $completeset . "',";
  298. $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pLargeImage"])) . "',";
  299. $sSQL .= "'".trim(@$_POST["pPrice"]) . "',";
  300. $sSQL .= "'".trim(@$_POST["pCost"]) . "',";
  301. $sSQL .= "'".trim(@$_POST["pCustomsvalue"]) . "',";
  302. if(trim(@$_POST["pWholesalePrice"]) != "")
  303. $sSQL .= trim(@$_POST["pWholesalePrice"]) . ",";
  304. else
  305. $sSQL .= "0,";
  306. //wholesale pricing group added 6-6-06 By Blake
  307. $sSQL .= trim(@$_POST["pPricing_group"]) . ",";
  308. //
  309. if(trim(@$_POST["pListPrice"]) != "")
  310. $sSQL .= trim(@$_POST["pListPrice"]) . ",";
  311. else
  312. $sSQL .= "0,";
  313. if($shipType==1){
  314. if(! is_numeric(trim(@$_POST["pShipping"])))
  315. $sSQL .= "0,";
  316. else
  317. $sSQL .= trim(@$_POST["pShipping"]) . ",";
  318. if(! is_numeric(trim(@$_POST["pShipping2"])))
  319. $sSQL .= "0,";
  320. else
  321. $sSQL .= trim(@$_POST["pShipping2"]) . ",";
  322. }
  323. if(trim(@$_POST["pDisplay"]) == "ON")
  324. $sSQL .= "1," . trim(@$_POST["pOrder"]) . ",";
  325. else
  326. $sSQL .= "0,0,";
  327. if(trim(@$_POST["pEDisplay"]) == "ON")
  328. $sSQL .= "1,";
  329. else
  330. $sSQL .= "0,";
  331. $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pTabName"])) . "',";
  332. if(@$perproducttaxrate==TRUE) $sSQL .= "'" . @$_POST["pTax"] . "',";
  333. if($stockManage != 0 && is_numeric(trim(@$_POST["inStock"])))
  334. $sSQL .= trim(@$_POST["inStock"]) . ",";
  335. if(@$productdimensions==TRUE)
  336. $sSQL .= "'" . trim(@$_POST["plen"]) . "x" . trim(@$_POST["pwid"]) . "x" . trim(@$_POST["phei"]) . "',";
  337. if(@$digidownloads==TRUE)
  338. $sSQL .= "'" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pDownload"]))) . "',";
  339. if(trim(@$_POST["pSell"]) == "ON") $pSell=1; else $pSell=0;
  340. if(trim(@$_POST["stockOptions"]) == "1") $pSell += 2;
  341. if(trim(@$_POST["staticpage"]) == "1") $pSell += 4;
  342. $sSQL .= $pSell . ",";
  343. $sSQL .= "'" . trim($_POST['pURL']) . "',";
  344. if($shipType <= 1 || ! is_numeric(trim(@$_POST["pShipping"])))
  345. $sSQL .= "0";
  346. elseif($shipType==2 || $shipType==3 || $shipType==4 || $shipType==6)
  347. $sSQL .= trim(@$_POST["pShipping"]) . "";
  348. else{
  349. $sSQL .= trim(@$_POST["pShipping"]) . ".";
  350. if((int)trim(@$_POST["pShipping2"]) < 10) $sSQL .= "0";
  351. $sSQL .= trim(@$_POST["pShipping2"]);
  352. }
  353. $sSQL .= ", ";
  354. $sSQL .= "'" . trim($_POST['title_tag']) . "',";
  355. $sSQL .= "'" . trim($_POST['meta_description']) . "'";
  356. $sSQL .= ")";
  357. //echo $sSQL;
  358. mysql_query($sSQL) or print(mysql_error() . '<br/>Query: ' . $sSQL);
  359. //exit();
  360. for($rowcounter=0; $rowcounter < maxprodopts; $rowcounter++){
  361. if(@$_POST["pOption" . $rowcounter] != "" && @$_POST["pOption" . $rowcounter] != 0){
  362. $sSQL = "INSERT INTO prodoptions (poProdID,poOptionGroup) VALUES ('" . @$_POST["newid"] . "'," . @$_POST["pOption" . $rowcounter] . ")";
  363. mysql_query($sSQL) or print(mysql_error());
  364. }
  365. }
  366. $sSQL = "DELETE FROM multisections WHERE pID='" . @$_POST["newid"] . "'";
  367. mysql_query($sSQL) or print(mysql_error());
  368. for($rowcounter=0; $rowcounter < $maxprodsects; $rowcounter++){
  369. if(@$_POST["pSection" . $rowcounter] != "" && @$_POST["pSection" . $rowcounter] != 0 && @$_POST["pSection"] != @$_POST["pSection" . $rowcounter]){
  370. $sSQL = "INSERT INTO multisections (pID,pSection) VALUES ('" . @$_POST["newid"] . "'," . @$_POST["pSection" . $rowcounter] . ")";
  371. mysql_query($sSQL) or print(mysql_error());
  372. }
  373. }
  374. $dorefresh=TRUE;
  375. }else
  376. $errmsg = "Sorry, that product reference is already in use. Please use your browser back button to return and correct the problem.";
  377. }elseif(@$_POST["act"]=="dodiscounts"){
  378. $sSQL = "INSERT INTO cpnassign (cpaCpnID,cpaType,cpaAssignment) VALUES (" . @$_POST["assdisc"] . ",2,'" . @$_POST["id"] . "')";
  379. mysql_query($sSQL) or print(mysql_error());
  380. $dorefresh=TRUE;
  381. }elseif(@$_POST["act"]=="deletedisc"){
  382. $sSQL = "DELETE FROM cpnassign WHERE cpaID=" . @$_POST["id"];
  383. mysql_query($sSQL) or print(mysql_error());
  384. $dorefresh=TRUE;
  385. }
  386. if(@$_POST["act"]=="modify" || @$_POST["act"]=="clone" || @$_POST["act"]=="addnew"){
  387. $sSQL = "SELECT optGrpID, optGrpWorkingName FROM optiongroup ORDER BY optGrpWorkingName";
  388. $nalloptions=0;
  389. $result = mysql_query($sSQL) or print(mysql_error());
  390. while($rs = mysql_fetch_row($result))
  391. $alloptions[$nalloptions++] = $rs;
  392. mysql_free_result($result);
  393. if(@$_POST["act"]=="modify" || @$_POST["act"]=="clone"){
  394. $sSQL = "SELECT poID, poOptionGroup FROM prodoptions WHERE poProdID='" . trim(@$_POST["id"]) . "' ORDER BY poID";
  395. $nprodoptions=0;
  396. $result = mysql_query($sSQL) or print(mysql_error());
  397. while($rs = mysql_fetch_row($result))
  398. $prodoptions[$nprodoptions++] = $rs;
  399. // set Options selected items
  400. $sSQL = "SELECT pSetOptions FROM products WHERE pID='" . trim(@$_POST["id"]) . "'";
  401. $setoptions=0;
  402. $result = mysql_query($sSQL) or print(mysql_error());
  403. $rs = mysql_fetch_row($result);
  404. if(!empty($rs[0])) {
  405. $setoptions = explode(',',$rs[0]);
  406. $nsetoptions = count($setoptions);
  407. } else $nsetoptions = 0;
  408. //echo '$nsetoptions='.$nsetoptions;
  409. $sSQL = "SELECT pSection FROM multisections WHERE pID='" . trim(@$_POST["id"]) . "'";
  410. $result = mysql_query($sSQL) or print(mysql_error());
  411. while($rs = mysql_fetch_row($result))
  412. $prodsections[$nprodsections++] = $rs;
  413. }
  414. $sSQL = "SELECT sectionID, sectionWorkingName, sectionDisabled FROM sections ORDER BY sectionWorkingName";
  415. $result = mysql_query($sSQL) or print(mysql_error());
  416. while($rs = mysql_fetch_assoc($result))
  417. $allsections[$nallsections++] = $rs;
  418. mysql_free_result($result);
  419. $sSQL = "SELECT dsID,dsName FROM dropshipper ORDER BY dsName";
  420. $result = mysql_query($sSQL) or print(mysql_error());
  421. while($rs = mysql_fetch_assoc($result))
  422. $alldropship[$nalldropship++] = $rs;
  423. mysql_free_result($result);
  424. }
  425. }
  426. if($dorefresh){
  427. print '<meta http-equiv="refresh" content="2; url=/admin/prods.php';
  428. if(trim(@$_POST["ts"]) != "")
  429. print "?ts=" . trim(@$_POST["ts"]);
  430. elseif(trim(@$_POST["tt"]) != "")
  431. print "?tt=" . trim(@$_POST["tt"]);
  432. print '">';
  433. }
  434. ?>
  435. <script language="JavaScript" type="text/javascript">
  436. <!--
  437. var ie=(document.all != (void 0));
  438. var ns6=(document.getElementById&&!document.all);
  439. <?php if(@$_POST["act"]=="addnew" || @$_POST["act"]=="modify" || @$_POST["act"]=="clone"){ ?>
  440. function checkastring(thestr,validchars){
  441. for (i=0; i < thestr.length; i++){
  442. ch = thestr.charAt(i);
  443. for (j = 0; j < validchars.length; j++)
  444. if (ch == validchars.charAt(j))
  445. break;
  446. if (j == validchars.length)
  447. return(false);
  448. }
  449. return(true);
  450. }
  451. function formvalidator(theForm)
  452. {
  453. checkUPC('pUPC');
  454. //alert($('upcOK').value);
  455. if($('upcOK').value=='false') {
  456. //alert('in');
  457. return (false);
  458. }
  459. if (theForm.newid.value == ""){
  460. alert("<?php print $yyPlsEntr?> \"<?php print $yyPrRef?>\".");
  461. theForm.newid.focus();
  462. return (false);
  463. }
  464. if (theForm.pSection.options[theForm.pSection.selectedIndex].value == ""){
  465. alert("<?php print $yyPlsSel?> \"<?php print $yySection?>\".");
  466. theForm.pSection.focus();
  467. return (false);
  468. }
  469. if (theForm.pName.value == ""){
  470. alert("<?php print $yyPlsEntr?> \"<?php print $yyPrNam?>\".");
  471. theForm.pName.focus();
  472. return (false);
  473. }
  474. <?php for($index=2; $index <= $adminlanguages+1; $index++){
  475. if(($adminlangsettings & 1)==1){ ?>
  476. if (theForm.pName<?php print $index?>.value == ""){
  477. alert("<?php print $yyPlsEntr?> \"<?php print $yyPrNam . " " . $index?>\".");
  478. theForm.pName<?php print $index?>.focus();
  479. return (false);
  480. }
  481. <?php }
  482. } ?>
  483. if (theForm.pPrice.value == ""){
  484. alert("<?php print $yyPlsEntr?> \"<?php print $yyPrPri?>\".");
  485. theForm.pPrice.focus();
  486. return (false);
  487. }
  488. var checkOK = "'\" ";
  489. var checkStr = theForm.newid.value;
  490. var allValid = true;
  491. for (i = 0; i < checkStr.length; i++){
  492. ch = checkStr.charAt(i);
  493. for (j = 0; j < checkOK.length; j++)
  494. if (ch == checkOK.charAt(j)){
  495. allValid = false;
  496. break;
  497. }
  498. }
  499. if (!allValid){
  500. alert("<?php print $yyQuoSpa?> \"<?php print $yyPrRef?>\".");
  501. theForm.newid.focus();
  502. return (false);
  503. }
  504. if (!checkastring(theForm.pPrice.value,"0123456789.")){
  505. alert("<?php print $yyOnlyDec?> \"<?php print $yyPrPri?>\".");
  506. theForm.pPrice.focus();
  507. return (false);
  508. }
  509. if (!checkastring(theForm.pWholesalePrice.value,"0123456789.")){
  510. alert("<?php print $yyOnlyDec?> \"<?php print $yyWhoPri?>\".");
  511. theForm.pWholesalePrice.focus();
  512. return (false);
  513. }
  514. if (!checkastring(theForm.pListPrice.value,"0123456789.")){
  515. alert("<?php print $yyOnlyDec?> \"<?php print $yyListPr?>\".");
  516. theForm.pListPrice.focus();
  517. return (false);
  518. }
  519. <?php if(@$productdimensions==TRUE){ ?>
  520. if (theForm.elements['pExemptions[]'].options[2].selected!=true){
  521. if (theForm.plen.value == ""){
  522. alert("<?php print $yyPlsEntr?> \"<?php print $yyDims?>\".");
  523. theForm.plen.focus();
  524. return(false);
  525. }
  526. if (theForm.pwid.value == ""){
  527. alert("<?php print $yyPlsEntr?> \"<?php print $yyDims?>\".");
  528. theForm.pwid.focus();
  529. return(false);
  530. }
  531. if (theForm.phei.value == ""){
  532. alert("<?php print $yyPlsEntr?> \"<?php print $yyDims?>\".");
  533. theForm.phei.focus();
  534. return(false);
  535. }
  536. }
  537. var checkOK = "0123456789.";
  538. if (!checkastring(theForm.plen.value,checkOK)){
  539. alert("<?php print $yyOnlyDec?> \"<?php print $yyDims?>\".");
  540. theForm.plen.focus();
  541. return(false);
  542. }
  543. if (!checkastring(theForm.pwid.value,checkOK)){
  544. alert("<?php print $yyOnlyDec?> \"<?php print $yyDims?>\".");
  545. theForm.pwid.focus();
  546. return(false);
  547. }
  548. if (!checkastring(theForm.phei.value,checkOK)){
  549. alert("<?php print $yyOnlyDec?> \"<?php print $yyDims?>\".");
  550. theForm.phei.focus();
  551. return(false);
  552. }
  553. <?php }
  554. if(($shipType > 0 && $shipType < 5) || $shipType==6){ ?>
  555. var checkOK = "0123456789.";
  556. if (!checkastring(theForm.pShipping.value,checkOK)){
  557. <?php if($shipType==1){ ?>
  558. alert("<?php print $yyOnlyDec?> \"<?php print $yyShip . ": " . $yyFirShi?>\".");
  559. <?php }else{ ?>
  560. alert("<?php print $yyOnlyDec?> \"<?php print $yyPrWght?>\".");
  561. <?php } ?>
  562. theForm.pShipping.focus();
  563. return (false);
  564. }
  565. <?php } ?>
  566. <?php if($shipType==1){ ?>
  567. if (!checkastring(theForm.pShipping2.value,"0123456789.")){
  568. alert("<?php print $yyOnlyDec?> \"<?php print $yyShip . ": " . $yySubShi?>\".");
  569. theForm.pShipping2.focus();
  570. return (false);
  571. }
  572. <?php } ?>
  573. <?php if($stockManage != 0){ ?>
  574. if (!(theForm.stockOptions.selectedIndex==1) && theForm.inStock.value == ""){
  575. alert("<?php print $yyPlsEntr?> \"<?php print $yyInStk?>\".");
  576. theForm.inStock.focus();
  577. return (false);
  578. }
  579. if (!(theForm.stockOptions.selectedIndex==1) && !checkastring(theForm.inStock.value,"0123456789")){
  580. alert("<?php print $yyOnlyNum?> \"<?php print $yyInStk?>\".");
  581. theForm.inStock.focus();
  582. return (false);
  583. }
  584. if(theForm.stockOptions.selectedIndex==1 && theForm.pNumOptions.selectedIndex==0){
  585. alert("<?php print $yyStkWrn?>");
  586. theForm.stockOptions.focus();
  587. return (false);
  588. }
  589. <?php } ?>
  590. <?php if(@$perproducttaxrate==TRUE){ ?>
  591. if (theForm.pTax.value == ""){
  592. alert("<?php print $yyPlsEntr?> \"<?php print $yyTax?>\".");
  593. theForm.pTax.focus();
  594. return(false);
  595. }
  596. if (!checkastring(theForm.pTax.value,"0123456789.")){
  597. alert("<?php print $yyOnlyDec?> \"<?php print $yyTax?>\".");
  598. theForm.pTax.focus();
  599. return (false);
  600. }
  601. <?php } ?>
  602. return (true);
  603. }
  604. <?php } ?>
  605. var prodOptGrpArr = new Array();
  606. var prodSectGrpArr = new Array();
  607. var prodOptGrpSet = new Array();
  608. <?php
  609. $rowcounter=0;
  610. for($rowcounter=0;$rowcounter < $nprodoptions;$rowcounter++)
  611. print "prodOptGrpArr[" . $rowcounter . "]=" . $prodoptions[$rowcounter][1] . ";\r\n";
  612. print "for(ii=" . $rowcounter . ";ii<" . maxprodopts . ";ii++) prodOptGrpArr[ii]=0;\r\n";
  613. for($rowcounter=0;$rowcounter < $nsetoptions;$rowcounter++)
  614. print "prodOptGrpSet[" . $rowcounter . "]=" . $setoptions[$rowcounter] . ";\r\n";
  615. print "for(ii=" . $rowcounter . ";ii<" . maxprodopts . ";ii++) prodOptGrpSet[ii]=0;\r\n";
  616. for($rowcounter=0;$rowcounter < $nprodsections;$rowcounter++)
  617. print "prodSectGrpArr[" . $rowcounter . "]=" . $prodsections[$rowcounter][0] . ";\r\n";
  618. print "for(ii=" . $rowcounter . ";ii<" . $maxprodsects . ";ii++) prodSectGrpArr[ii]=0;\r\n";
  619. ?>
  620. function update_opts(index){
  621. var thisOption;
  622. if(ns6)
  623. thisOption = document.getElementById('pOption'+index);
  624. else
  625. thisOption = eval('document.forms.mainform.pOption'+index);
  626. prodOptGrpArr[index] = thisOption.options[thisOption.selectedIndex].value;
  627. }
  628. function update_sects(index){
  629. var thisSection;
  630. if(ns6)
  631. thisSection = document.getElementById('pSection'+index);
  632. else
  633. thisSection = eval('document.forms.mainform.pSection'+index);
  634. prodSectGrpArr[index] = thisSection.options[thisSection.selectedIndex].value;
  635. }
  636. function setprodoptions(){
  637. var setoptions =$('setoptions').checked;
  638. var noOpts = document.forms.mainform.pNumOptions.selectedIndex;
  639. var theElm;
  640. var theHTMLHead,theHTML="";
  641. var index=0;
  642. if(ns6)
  643. theElm = document.getElementById('prodoptions');
  644. else
  645. theElm = document.all.prodoptions;
  646. theHTMLHead = '<table width="100%" border="0" cellspacing="0" cellpadding="3">';
  647. theHTML = theHTML + '<select size="1" id="pOptionGGREPLACEMExx" name="pOptionGGREPLACEMExx" onChange="update_opts(GGREPLACEMExx);if(setoptions) {loadOptions(this.value,GGREPLACEMExx,0)};"><option value="0"><?php print $yyNone?></option>';
  648. <?php
  649. for($rowcounter=0;$rowcounter < $nalloptions;$rowcounter++)
  650. print "theHTML = theHTML +'<option value=\"" . $alloptions[$rowcounter][0] . "\">" . str_replace("'","\'",$alloptions[$rowcounter][1]) . "</option>';\n";
  651. ?>
  652. theHTML = theHTML + '</select>';
  653. if(setoptions) {
  654. theHTML = theHTML + '<span id="div_option_setGGREPLACEMExx"></span><span id="div_option_set_workingGGREPLACEMExx" style="display: none;"><img src="/lib/images/indicator.gif" width="16" /></span>';
  655. }
  656. for (index=0;index<noOpts;index++) {
  657. if(index % 2 == 0) theHTMLHead = theHTMLHead + '<tr>';
  658. theHTMLHead = theHTMLHead + '<td width="15%" align="right"><?php print $yyPrdOpt?> '+(index+1)+':</td><td width="35%">'+theHTML.replace(/GGREPLACEMExx/g,index)+'</td>';
  659. if(index % 2 != 0) theHTMLHead = theHTMLHead + '</tr>';
  660. }
  661. if(index % 2 != 0) theHTMLHead = theHTMLHead + '<td width="50%" colspan="2">&nbsp;</td></tr>';
  662. theHTMLHead = theHTMLHead + '</table>';
  663. theElm.innerHTML=theHTMLHead;
  664. for (index=0;index<noOpts;index++) {
  665. var thisOption;
  666. if(ns6)
  667. thisOption = document.getElementById('pOption'+index);
  668. else
  669. thisOption = eval('document.forms.mainform.pOption'+index);
  670. for (index2=0;index2<thisOption.length;index2++) {
  671. if (thisOption[index2].value==prodOptGrpArr[index]) {
  672. thisOption.selectedIndex=index2;
  673. thisOption.options[index2].selected = true;
  674. }
  675. else
  676. thisOption.options[index2].selected = false;
  677. }
  678. if(prodOptGrpSet[index]!=0)
  679. loadOptions(prodOptGrpArr[index],index,prodOptGrpSet[index]);
  680. }
  681. }
  682. function setprodsections(){
  683. var noSects = document.forms.mainform.pNumSections.selectedIndex;
  684. var theElm;
  685. var theHTMLHead,theHTML="";
  686. var index=0;
  687. if(ns6)
  688. theElm = document.getElementById('prodsections');
  689. else
  690. theElm = document.all.prodsections;
  691. theHTMLHead = '<table width="100%" border="0" cellspacing="0" cellpadding="3">';
  692. theHTML = theHTML + '<select size="1" id="pSectionGGREPLACEMExx" name="pSectionGGREPLACEMExx" onChange="update_sects(GGREPLACEMExx);"><option value="0">None</option>';
  693. <?php
  694. for($rowcounter=0;$rowcounter < $nallsections;$rowcounter++)
  695. print "theHTML = theHTML +'<option value=\"" . $allsections[$rowcounter]["sectionID"] . "\">" . str_replace("'","\'",$allsections[$rowcounter]["sectionWorkingName"]) . "</option>';\n";
  696. ?>
  697. theHTML = theHTML + '</select>';
  698. for (index=0;index<noSects;index++) {
  699. if(index % 2 == 0) theHTMLHead = theHTMLHead + '<tr>';
  700. theHTMLHead = theHTMLHead + '<td width="25%" align="right">Prod. Section '+(index+1)+':</td><td width="25%">'+theHTML.replace(/GGREPLACEMExx/g,index)+'</td>';
  701. if(index % 2 != 0) theHTMLHead = theHTMLHead + '</tr>';
  702. }
  703. if(index % 2 != 0) theHTMLHead = theHTMLHead + '<td width="50%" colspan="2">&nbsp;</td></tr>';
  704. theHTMLHead = theHTMLHead + '</table>';
  705. theElm.innerHTML=theHTMLHead;
  706. for (index=0;index<noSects;index++) {
  707. var thisSection;
  708. if(ns6)
  709. thisSection = document.getElementById('pSection'+index);
  710. else
  711. thisSection = eval('document.forms.mainform.pSection'+index);
  712. for (index2=0;index2<thisSection.length;index2++) {
  713. if (thisSection[index2].value==prodSectGrpArr[index]) {
  714. thisSection.selectedIndex=index2;
  715. thisSection.options[index2].selected = true;
  716. }
  717. else
  718. thisSection.options[index2].selected = false;
  719. }
  720. }
  721. }
  722. function setstocktype(){
  723. var si = document.forms.mainform.stockOptions.selectedIndex;
  724. document.forms.mainform.inStock.disabled=(si==1);
  725. }
  726. //-->
  727. </script>
  728. <?php
  729. function show_info(){
  730. global $yyPrEx1, $yyPrEx2, $yyDspOrd, $yyDspImg;
  731. ?>
  732. <p><ul><li><strong>Reference:</strong> this is the product ID and must be unique. ( ex. A?? - nano, C?? - video and classic. CC is the same as C but indicates that is must have a shim sent with it. Go to packing slip products to add the trigger product that will ad the shim to the packing slip.)</li>
  733. <li><strong>Product Name:</strong> must be descriptive but short as possible. What the customer sees in the cart.</li>
  734. <li><strong>UPC:</strong> the unique number assigned to this product. Use as the barcode and is all numbers.</li>
  735. <li><strong>Bin:</strong> the location where the product is located.</li>
  736. <li><strong>In Stock/By Options:</strong> In Stock - is used to subtract inventory if the product does not have options. By Options - used when the product has one or more options. When selected the inventory will be subtracted from the options not this product.</li>
  737. <li><strong>Display:</strong> <?php print $yyDspOrd?></li>
  738. <li><strong>Display to Etailer:</strong> used to limit which products are displayed to etailers through the API.</li>
  739. <li><strong>Image/ Large Image:</strong> You can add more than one image that will display on the prod details page only. The first image url will be what is displayed on all other pages. For more than one image url you must put a comma and hit enter after each url. Small images - 140x140. Large images 350x300.</li>
  740. <li><strong>Download:</strong> if the product is downloaded, this is the download url of the software.</li>
  741. <li><strong>Description:</strong> Viewable on flash page. Short description.</li>
  742. <li><strong>Long Description:</strong> Viewable on the prod detail page. </li>
  743. <li><strong>Has Static Page:</strong> used for SEO. Checking the box and leave the text box blank will result in the URL being productID.php. Check the box and put the URL in the text box if the page has a different name than the productID. </li>
  744. <li><strong>Additional Sections: </strong>select multiple categories where the product will be displayed.</li>
  745. <li><strong>Section:</strong> the main section where the product will be displayed. Under product admin, when searching for products by sections, only products with this main section selected will display under the section.</li>
  746. <li><?php print $yyPrEx2?></li>
  747. <li><?php print $yyPrEx1?></li>
  748. <li><strong>Cost: </strong>actual cost to us for the product. (optional)</li>
  749. <li><strong>Customs Cost: </strong>the stated cost when shipping international for the customs form.
  750. <li><strong>Product Weight:</strong> measured in Kilograms. Must be accurate in order to get the final order weight correct. Used for shipping cost to customer and actual final shipping costs.</li>
  751. <li><strong>Drop Shipper:</strong> used when a manufacturer ships the product instead of us. This will cause the order to split shipping can be tracked from two or more locations.
  752. </ul>
  753. </p>
  754. <?php
  755. }
  756. if(@$_POST["posted"]=="1" && (@$_POST["act"]=="modify" || @$_POST["act"]=="clone" || @$_POST["act"]=="addnew")){
  757. if(@$_POST["act"]=="modify" || @$_POST["act"]=="clone"){
  758. $doaddnew = FALSE;
  759. $sSQL = "SELECT pId,pNUM,pName,pName2,pName3,pSection,pDescription,pDescription2,pDescription3,pImage,pPrice,pWholesalePrice,pPricing_group,pListPrice,pDisplay,pSell,pShipping,pShipping2,pLargeImage,pWeight,pLongDescription,pLongDescription2,pLongDescription3,pExemptions,pInStock,pDims,pTax,pDropship,pOrder,pSetOptions,isSet,pCatOnDetail,pUPC,pBin,pEDisplay,pTabName,pCost,pCustomsvalue,pURL,pTitleTag,pMetaDescription";
  760. if(@$digidownloads==TRUE) $sSQL .= ",pDownload";
  761. $sSQL .= " FROM products WHERE pId='" . mysql_real_escape_string(unstripslashes(@$_POST["id"])) . "'";
  762. $result = mysql_query($sSQL) or print(mysql_error());
  763. $alldata = mysql_fetch_assoc($result);
  764. $pId = $alldata["pId"];
  765. $pNUM = $alldata['pNUM'];
  766. $pName = $alldata["pName"];
  767. for($index=2; $index <= $adminlanguages+1; $index++){
  768. $pNames[$index] = $alldata["pName" . $index];
  769. $pDescriptions[$index] = $alldata["pDescription" . $index];
  770. $pLongDescriptions[$index] = $alldata["pLongDescription" . $index];
  771. }
  772. $pSection = $alldata["pSection"];
  773. $pDescription = $alldata["pDescription"];
  774. $pDescription2 = $alldata['pDescription2'];
  775. $pDescription3 = $alldata['pDescription3'];
  776. $pImage = $alldata["pImage"];
  777. $pPrice = $alldata["pPrice"];
  778. $pCost = $alldata["pCost"];
  779. $pCustomsvalue = $alldata["pCustomsvalue"];
  780. $pWholesalePrice = $alldata["pWholesalePrice"];
  781. $pPricing_group = $alldata["pPricing_group"];
  782. $pListPrice = $alldata["pListPrice"];
  783. $pDisplay = $alldata["pDisplay"];
  784. $pEDisplay = $alldata["pEDisplay"];
  785. $pTabName = $alldata["pTabName"];
  786. $pSell = $alldata["pSell"];
  787. $pURL = $alldata["pURL"];
  788. $pShipping = $alldata["pShipping"];
  789. $pShipping2 = $alldata["pShipping2"];
  790. $pLargeImage = $alldata["pLargeImage"];
  791. $pWeight = $alldata["pWeight"];
  792. $pLongDescription = $alldata["pLongDescription"];
  793. $pExemptions = $alldata["pExemptions"];
  794. $pInStock = $alldata["pInStock"];
  795. $pDims = $alldata["pDims"];
  796. $pTax = $alldata["pTax"];
  797. $pDropship = $alldata["pDropship"];
  798. $pOrder = $alldata["pOrder"];
  799. $pSetOptions = $alldata["pSetOptions"];
  800. $completeSet= $alldata["isSet"];
  801. $pCatOnDetail=$alldata["pCatOnDetail"];
  802. $pUPC = $alldata['pUPC'];
  803. $pBin = $alldata['pBin'];
  804. $pTitleTag = $alldata['pTitleTag'];
  805. $pMetaDescription = $alldata['pMetaDescription'];
  806. if(@$digidownloads==TRUE) $pDownload = $alldata["pDownload"];
  807. }else{
  808. $doaddnew = TRUE;
  809. $pId = "";
  810. $pName = "";
  811. for($index=2; $index <= $adminlanguages+1; $index++){
  812. $pNames[$index] = "";
  813. $pDescriptions[$index] = "";
  814. $pLongDescriptions[$index] = "";
  815. }
  816. if(trim(@$_POST["ts"]) != "") $pSection=(int)trim(@$_POST["ts"]); else $pSection = 0;
  817. $pDescription = "";
  818. $pDescription2 = '';
  819. $pDescription3 = '';
  820. $pImage = "prodimages/";
  821. $pPrice = "";
  822. $pWholesalePrice = "";
  823. $pPricing_group = 1;
  824. $pListPrice = 0;
  825. $pDisplay = 1;
  826. $pEDisplay = 1;
  827. $pTabName="";
  828. $pSell = 1;
  829. $pURL="";
  830. $pShipping = "";
  831. $pShipping2 = "";
  832. $pLargeImage = "prodimages/";
  833. $pWeight = "";
  834. $pLongDescription = "";
  835. $pExemptions = 0;
  836. $pInStock = "";
  837. $pDims = "";
  838. $pTax = "";
  839. $pDropship = 0;
  840. $pDownload = "";
  841. $pOrder = 100;
  842. $pCatOnDetail="";
  843. $pTitleTag = '';
  844. $pMetaDescription = '';
  845. }
  846. ?>
  847. <form name="mainform" method="post" action="/admin/prods.php" onsubmit="return formvalidator(this)">
  848. <table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="" align="center">
  849. <tr>
  850. <td width="100%">
  851. <input type="hidden" name="posted" value="1" />
  852. <?php if(@$_POST["act"]=="modify"){ ?>
  853. <input type="hidden" name="act" value="domodify" />
  854. <input type="hidden" id="id" name="id" value="<?php print str_replace('"',"&quot;",$pId)?>" />
  855. <?php }else{ ?>
  856. <input type="hidden" name="act" value="doaddnew" />
  857. <?php } ?>
  858. <input type="hidden" name="tt" value="<?php print @$_POST["tt"];?>" />
  859. <input type="hidden" name="ts" value="<?php print @$_POST["ts"];?>" />
  860. <table width="100%" border="0" cellspacing="0" cellpadding="3" bgcolor="">
  861. <tr>
  862. <td colspan="4" align="center"><strong><?php
  863. if(@$_POST["act"]=="modify")
  864. print $yyYouMod . " &quot;" . $pName . "&quot;";
  865. elseif(@$_POST["act"]=="addnew")
  866. print $yyPrUpd;
  867. else
  868. print $yyYouCln . " &quot;" . $pName . "&quot;";
  869. ?></strong><br />&nbsp;</td>
  870. </tr>
  871. <tr>
  872. <td width="14%" align="right">
  873. <font color="#FF0000">*</font><?php print $yyPrRef?>:
  874. </td>
  875. <td width="36%">
  876. <input type="text" name="newid" size="15" value="<?php print str_replace('"',"&quot;",$pId)?>" /> <a href="#info">?</a>
  877. </td>
  878. <td width="5%" align="right">
  879. <font color="#FF0000">*</font><?php print $yySection?>:
  880. </td>
  881. <td width="15%">
  882. <select size="1" name="pSection">
  883. <option value=""><?php print $yySelect?></option><?php
  884. for($index=0;$index<$nallsections;$index++){
  885. print "<option value='" . $allsections[$index]["sectionID"] . "'";
  886. if($allsections[$index]["sectionID"]==$pSection) print " selected";
  887. print ">" . $allsections[$index]["sectionWorkingName"] . "</option>\n";
  888. } ?>
  889. </select>
  890. <a href="#info">?</a>
  891. </td>
  892. </tr>
  893. <tr>
  894. <td width="14%" align="right">Alt Prod ID:</td>
  895. <td width="36%">
  896. <input type="text" name="altprodid" size="15" value="<?php print str_replace('"',"&quot;",$pNUM)?>" /> <a href="#info">?</a>
  897. </td>
  898. <td colspan="2">&nbsp;</td>
  899. </tr>
  900. <tr>
  901. <td align="right"><font color="#FF0000">*</font><?php print $yyPrNam?>:</td>
  902. <td><input type="text" name="pName" size="25" value="<?php print str_replace('"',"&quot;",$pName)?>" /> <a href="#info">?</a></td>
  903. <td align="right"><font color="#FF0000">*</font><?php print $yyPrPri?>:</td>
  904. <td><input type="text" name="pPrice" id="pPrice" size="15" value="<?php print $pPrice?>" />
  905. <a href="#info">?</a></td>
  906. </tr>
  907. <tr>
  908. <td style="text-align: right;">UPC #:</td>
  909. <td><input type="text" id="pUPC" name="pUPC" size="15" value="<?=$pUPC?>" onblur="checkUPC('pUPC')" />
  910. <input name="upcOK" type="hidden" id="upcOK" />
  911. <a href="#info">?</a></td>
  912. <td>&nbsp;</td>
  913. <td>&nbsp;</td>
  914. </tr>
  915. <tr>
  916. <td style="text-align: right;">BIN #:</td>
  917. <td><input name="pBin" type="text" id="pBin" value="<?=$pBin?>" size="15" />
  918. <a href="#info">?</a></td>
  919. <td>&nbsp;</td>
  920. <td>&nbsp;</td>
  921. </tr>
  922. <?php for($index=2; $index <= $adminlanguages+1; $index++){
  923. if(($adminlangsettings & 1)==1){
  924. ?><tr>
  925. <td align="right"><font color="#FF0000">*</font><?php print $yyPrNam . " " . $index?>:</td><td colspan="3"><input type="text" name="pName<?php print $index?>" size="25" value="<?php print str_replace('"','&quot;',$pNames[$index])?>" />
  926. <a href="#info">?</a></td>
  927. </tr><?php
  928. }
  929. } ?>
  930. <tr>
  931. <?php if($useStockManagement){ ?>
  932. <td align="right">
  933. <input type="hidden" name="pSell" value="<?php if(((int)$pSell & 1)==1) print "ON" ?>" />
  934. <select name="stockOptions" size="1" onchange="setstocktype();">
  935. <option value="0">&nbsp;&nbsp;&nbsp;<?php print $yyInStk?>:</option>
  936. <option value="1"<?php if(((int)$pSell & 2)==2) print "selected" ?>><?php print $yyByOpt?>:</option></select> </td><td><input type="text" name="inStock" size="10" value="<?php print $pInStock?>" />
  937. <a href="#info">?</a></td>
  938. <?php }else{ ?>
  939. <input type="hidden" name="stockOptions" value="<?php if(((int)$pSell & 2)==2) print "1" ?>" />
  940. <td align="right"><?php print $yySellBut?>:</td><td><input type="checkbox" name="pSell" value="ON" <?php if(((int)$pSell & 1)==1) print "checked" ?> /></td>
  941. <?php } ?>
  942. <td width="10%" align="right">MSRP<?php //print $yyWhoPri?> <font size="1">(<a href="#info">info</a>)</font>:<br />
  943. Pricing Group: </td>
  944. <td width="20%"><input type="text" name="pWholesalePrice" id="pWholesalePrice" size="10" value="<?php print $pWholesalePrice?>" />
  945. <select name="pPricing_group" id="pPricing_group" onchange="if($F('pPricing_group')==0) $('pWholesalePrice').value='<?php print $pPrice?>'; else $('pWholesalePrice').value='<?php print $pWholesalePrice?>';">
  946. <option value="0" <?php if ($pPricing_group=="0") {echo "selected=\"selected\"";} ?>>Full Price (0)</option>
  947. <option value="1" <?php if ($pPricing_group=="1") {echo "selected=\"selected\"";} ?>>Sets (1)</option>
  948. <option value="2" <?php if ($pPricing_group=="2") {echo "selected=\"selected\"";} ?>>Individual Items (2)</option>
  949. <option value="3" <?php if ($pPricing_group=="3") {echo "selected=\"selected\"";} ?>>Shieldzone (3)</option>
  950. <option value="4" <?php if ($pPricing_group=="4") {echo "selected=\"selected\"";} ?>>Skullcandy (4)</option>
  951. </select>
  952. <a href="#info">?</a></td>
  953. </tr>
  954. <tr>
  955. <td align="right">Display on ifrogz:</td><td><input type="checkbox" name="pDisplay" value="ON" <?php if((int)$pDisplay != 0) print "checked" ?> />
  956. Display Order: <input name="pOrder" type="text" id="pOrder" value="<?php print $pOrder?>" size="4" />
  957. <a href="#info">?</a></td>
  958. <td align="right"><?php print $yyListPr?> <font size="1">(<a href="#info">info</a>)</font>:</td><td><input type="text" name="pListPrice" size="15" value="<?php if((double)$pListPrice<>0.0) print $pListPrice ?>" /> <a href="#info">?</a></td>
  959. </tr>
  960. <tr>
  961. <td align="right" valign="top">Display to Etailers: </td>
  962. <td><input name="pEDisplay" type="checkbox" id="pEDisplay" value="ON" <?php if((int)$pEDisplay != 0) print "checked" ?> />
  963. <a href="#info">?</a></td>
  964. <td align="right">Cost:</td>
  965. <td nowrap="nowrap"><input name="pCost" type="text" id="pCost" size="15" value="<?=$pCost?>" /> <label>
  966. <input name="cost_percent" type="text" id="cost_percent" size="2" value="40" />%
  967. <input type="button" name="cost_percent_calc" value="go" onclick="$('pCost').value=($F('cost_percent')/100)*$F('pPrice');" />
  968. <a href="#info">?</a></label></td>
  969. <td colspan="2" align="center" valign="top">&nbsp;</td>
  970. </tr>
  971. <tr>
  972. <td align="right" valign="top">Tab Name: </td>
  973. <td><input name="pTabName" type="text" id="pTabName" value="<?=$pTabName?>" />
  974. <a href="#info">?</a></td>
  975. <td align="right">Customs Cost: </td>
  976. <td><input name="pCustomsvalue" type="text" id="pCustomsvalue" size="15" value="<?=$pCustomsvalue?>" />
  977. <input name="cost_percent2" type="text" id="cost_percent2" size="2" value="40" />%
  978. <input type="button" name="cost_percent_calc2" value="go" onclick="$('pCustomsvalue').value=($F('cost_percent2')/100)*$F('pPrice');" />
  979. <a href="#info">?</a></td>
  980. <td colspan="2" align="center" valign="top">&nbsp;</td>
  981. </tr>
  982. <tr>
  983. <td align="right" valign="top"><?php print $yyImage?>: </td>
  984. <td><textarea name="pImage" id="pImage" cols="40" rows="4" ><?php print str_replace('"',"&quot;",$pImage)?></textarea>
  985. <a href="javascript:void(0);" onclick="viewImage('pImage','pImageView');">View</a>
  986. <div style="position:relative; ">
  987. <div id="pImageView" class="imageView" style="display:none;"></div>
  988. </div>
  989. <div style="font-size:10px; ">* For more than one image see below. <a href="#info">?</a></div></td>
  990. <?php if(@$productdimensions==TRUE){
  991. $proddims = split("x", $pDims) ?>
  992. <td align="right"><font color="#FF0000">*</font><?php print $yyDims?>:</td>
  993. <td><input type="text" name="plen" size="4" value="<?php print @$proddims[0]?>" /> <strong>X</strong>
  994. <input type="text" name="pwid" size="4" value="<?php print @$proddims[1]?>" /> <strong>X</strong>
  995. <input type="text" name="phei" size="4" value="<?php print @$proddims[2]?>" /></td>
  996. <?php }else{ ?>
  997. <td colspan="2" align="center" valign="bottom"><strong><?php
  998. if(($shipType > 0 && $shipType < 5) || $shipType==6)
  999. print $yyShpInf;
  1000. else
  1001. print "&nbsp;"; ?></strong></td>
  1002. <?php } ?>
  1003. </tr>
  1004. <tr>
  1005. <td align="right" valign="top"><?php print $yyLgeImg?>:</td>
  1006. <td align="left"><textarea name="pLargeImage" id="pLargeImage" cols="40" rows="4"><?php print str_replace('"',"&quot;",$pLargeImage)?></textarea>
  1007. <a href="javascript:void(0);" onclick="viewImage('pLargeImage','pLargeImageView');">View</a>
  1008. <div style="position:relative; ">
  1009. <div id="pLargeImageView" class="imageView" style="display:none;"></div>
  1010. </div>
  1011. <div style="font-size:10px; ">* For more than one image see below. <a href="#info">?</a></div></td>
  1012. <td align="right" valign="top"><?php
  1013. if($shipType==1)
  1014. print $yyShip . ":<br />" . $yyFirShi;
  1015. elseif($shipType==2 || $shipType==3 || $shipType==4 || $shipType==6)
  1016. print $yyPrWght . ":";
  1017. else
  1018. print "&nbsp;";
  1019. ?></td>
  1020. <td align="left" valign="top"><?php
  1021. if($shipType==1)
  1022. print "<input type=text name='pShipping' size='15' value='" . $pShipping . "' />";
  1023. elseif($shipType==2 || $shipType==3 || $shipType==4 || $shipType==6)
  1024. print "<input type=text name='pShipping' size='15' value='" . $pWeight . "' />";
  1025. else
  1026. print "&nbsp;"; ?></td>
  1027. </tr>
  1028. <tr>
  1029. <td align="right" valign="top">Tech Specs:</td>
  1030. <td align="left"><textarea name="pDescription2" id="pDescription2" cols="40" rows="4"><?php print str_replace('"',"&quot;",$pDescription2)?></textarea></td>
  1031. <td align="right" valign="top">Video:</td>
  1032. <td align="left"><textarea name="pDescription3" id="pDescription3" cols="40" rows="4"><?php echo $pDescription3; ?></textarea></td>
  1033. </tr>
  1034. <tr>
  1035. <?php if($simpleOptions){ ?>
  1036. <td colspan="2">&nbsp;</td>
  1037. <?php }else{ ?>
  1038. <td align="right"><?php print $yyNumOpt?>:</td>
  1039. <td>
  1040. <select size="1" name="pNumOptions" onchange="setprodoptions();">
  1041. <option value='0'><?php print $yyNone?></option>
  1042. <?php for($rowcounter=1; $rowcounter <= maxprodopts; $rowcounter++)
  1043. print "<option value='" . $rowcounter . "'>" . $rowcounter . "</option>"; ?>
  1044. </select> <?php print $yyCompleteSet?> <input name="completeset" type="checkbox" id="completeset" value="yes" <?php if ($completeSet=='yes') {echo "checked";} ?>>
  1045. <?php print $yySetOptions?> <input <?php if (!empty($pSetOptions)) {echo "checked";} ?> name="setoptions" id="setoptions" type="checkbox" value="yes" onchange="setprodoptions();">
  1046. <a href="#info">?</a> </td>
  1047. <?php } ?>
  1048. <td align="right"><?php
  1049. if($shipType==1)
  1050. print $yyShip . ":<br />" . $yySubShi;
  1051. else
  1052. print "&nbsp;"; ?></td>
  1053. <td align="left"><?php
  1054. if($shipType==1)
  1055. print "<input type=text name='pShipping2' size='15' value='" . (double)$pShipping2 . "' />";
  1056. else
  1057. print "&nbsp;"; ?></td>
  1058. </tr>
  1059. <?php if($simpleOptions){
  1060. for($index=0;$index < maxprodopts; $index++){
  1061. if(($index % 2)==0) print "<tr>";
  1062. print '<td align="right">' . $yyPrdOpt . ' ' . ($index+1) . ':</td><td><select size="1" id="pOption' . $index . '" name="pOption' . $index . '"><option value="0">None</option>';
  1063. for($rowcounter=0;$rowcounter < $nalloptions;$rowcounter++){
  1064. print '<option value="' . $alloptions[$rowcounter][0] . '"';
  1065. if($index < $nprodoptions){
  1066. if($prodoptions[$index][1]==$alloptions[$rowcounter][0]) print " selected";
  1067. }
  1068. print ">" . $alloptions[$rowcounter][1] . "</option>";
  1069. }
  1070. print "</td>";
  1071. if(($index % 2) != 0) print "</tr>\n";
  1072. }
  1073. if(($index % 2)==0)
  1074. print "</tr>\n";
  1075. else
  1076. print "<td colspan=\"2\">&nbsp;</td></tr>\n";
  1077. }else{ ?>
  1078. </table>
  1079. <div name="prodoptions" id="prodoptions">
  1080. </div>
  1081. <table width="100%" border="0" cellspacing="0" cellpadding="3" bgcolor="">
  1082. <?php }
  1083. if(@$digidownloads==TRUE){ ?>
  1084. <tr>
  1085. <td width="14%" align="right"><?php print $yyDownl?>:</td>
  1086. <td colspan="4" align="left"><input type="text" size="60" name="pDownload" value="<?php print $pDownload?>" />
  1087. <a href="#info">?</a></td>
  1088. </tr>
  1089. <?php } ?>
  1090. <tr>
  1091. <td align="right"><?php print $yyDesc?>:</td>
  1092. <td colspan="2" valign="top"><textarea name="pDescription" cols="30" rows="6" wrap=virtual><?php print $pDescription?></textarea>
  1093. <a href="#info">?</a></td>
  1094. <td colspan="2" align="center"><?php print $yyDrSppr?>: <select name="pDropship" size="1">
  1095. <option value="0"><?php print $yyNone?></option><?php
  1096. for($index=0;$index<$nalldropship;$index++){
  1097. print "<option value='" . $alldropship[$index]["dsID"] . "'";
  1098. if($alldropship[$index]["dsID"]==$pDropship) print " selected";
  1099. print ">" . $alldropship[$index]["dsName"] . "</option>\n";
  1100. } ?>
  1101. </select>
  1102. <a href="#info">?</a><br />
  1103. <br />
  1104. <?php print $yyExemp?> <font size="1">&lt;Ctrl>+Click</font><br />
  1105. <select name="pExemptions[]" size="3" multiple>
  1106. <option value="1" <?php if(($pExemptions&1)==1) print "selected"?>><?php print $yyExStat?></option>
  1107. <option value="2" <?php if(($pExemptions&2)==2) print "selected"?>><?php print $yyExCoun?></option>
  1108. <option value="4" <?php if(($pExemptions&4)==4) print "selected"?>><?php print $yyExShip?></option>
  1109. </select>
  1110. <a href="#info">?</a><br />
  1111. <img src="/lib/images/misc/clearpixel.gif" width="20" height="3" alt="" />
  1112. <?php if(@$perproducttaxrate==TRUE){ ?>
  1113. <br /><?php print $yyTax?>: <input type="text" style="text-align:right" size="6" name="pTax" value="<?php print $pTax?>" />%
  1114. <?php } ?> </td>
  1115. </tr>
  1116. <?php for($index=2; $index <= $adminlanguages+1; $index++){
  1117. if(($adminlangsettings & 2)==2){ ?>
  1118. <tr>
  1119. <td align="right"><?php print $yyDesc . " " . $index?>:</td>
  1120. <td colspan="2"><textarea name="pDescription<?php print $index?>" cols="30" rows="6" wrap=virtual><?php print $pDescriptions[$index]?></textarea>
  1121. <a href="#info">?</a></td>
  1122. <td colspan="2"> </td>
  1123. </tr>
  1124. <?php }
  1125. }
  1126. ?>
  1127. <tr>
  1128. <td width="14%" rowspan="3" align="right" valign="top"><?php print $yyLnDesc?>:</td>
  1129. <td colspan="2" rowspan="3" align="left" valign="top"><textarea name="pLongDescription" cols="45" rows="6" wrap=virtual><?php print $pLongDescription?></textarea>
  1130. <a href="#info">?</a></td>
  1131. <td colspan="2" align="left">&nbsp;</td>
  1132. </tr>
  1133. <tr>
  1134. <td width="20%" align="left">&nbsp;</td>
  1135. <td width="32%" align="left">&nbsp;</td>
  1136. </tr>
  1137. <tr>
  1138. <td colspan="2" rowspan="4" align="left" valign="top">&nbsp;</td>
  1139. </tr>
  1140. <?php for($index=2; $index <= $adminlanguages+1; $index++){
  1141. if(($adminlangsettings & 4)==4){ ?>
  1142. <tr>
  1143. <td align="right"><?php print $yyLnDesc . " " . $index?>:</td>
  1144. <td colspan="2"><textarea name="pLongDescription<?php print $index?>" cols="45" rows="6" wrap=virtual><?php print $pLongDescriptions[$index]?></textarea>
  1145. <a href="#info">?</a></td>
  1146. </tr>
  1147. <?php }
  1148. }
  1149. ?>
  1150. <tr>
  1151. <td align="right"><?php print $yyStatPg?>:</td>
  1152. <td colspan="2"><input type="checkbox" name="staticpage" value="1"<?php if(((int)$pSell & 4)==4) print ' checked' ?>>
  1153. URL:
  1154. <input name="pURL" type="text" id="pURL" value="<?=$pURL?>" />
  1155. <a href="#info">?</a> <span class="style1">(optional)</span></td>
  1156. </tr>
  1157. <tr>
  1158. <td align="right">Title Tag:</td>
  1159. <td colspan="4"><input type="text" name="title_tag" id="title_tag" value="<?php echo $pTitleTag ?>" size="60" /></td>
  1160. </tr>
  1161. <tr>
  1162. <td align="right">Meta Description:</td>
  1163. <td colspan="4"><input type="text" name="meta_description" id="meta_description" value="<?php echo $pMetaDescription ?>" size="100" /></td>
  1164. </tr>
  1165. <tr>
  1166. <td width="14%" align="right"><strong><?php print $yyAddSec?>:</strong></td>
  1167. <td align="left">
  1168. <?php if(! $simpleSections){
  1169. print '<select size="1" name="pNumSections" onChange="setprodsections();"><option value="0">' . $yyNone . '</option>';
  1170. for($rowcounter=1;$rowcounter <= $maxprodsects; $rowcounter++)
  1171. print "<option value='" . $rowcounter . "'>" . $rowcounter . "</option>";
  1172. print "</select>";
  1173. } ?>&nbsp;<a href="#info">?</a></td>
  1174. <td align="left">&nbsp;</td>
  1175. <td align="left">&nbsp;</td>
  1176. </tr>
  1177. <?php if($simpleSections){
  1178. for($index=0;$index < $maxprodsects; $index++){
  1179. if(($index % 2)==0) print "<tr>";
  1180. print '<td align="right">' . $yyPrdSec . ' ' . ($index+1) . ':</td><td><select size="1" id="pSection' . $index . '" name="pSection' . $index . '"><option value="0">' . $yyNone . '</option>';
  1181. for($rowcounter=0;$rowcounter < $nallsections;$rowcounter++){
  1182. print '<option value="' . $allsections[$rowcounter]["sectionID"] . '"';
  1183. if($index < $nprodsections){
  1184. if($prodsections[$index][0]==$allsections[$rowcounter]["sectionID"]) print " selected";
  1185. }
  1186. print ">" . $allsections[$rowcounter]["sectionWorkingName"] . "</option>";
  1187. }
  1188. print "</td>";
  1189. if(($index % 2) != 0) print "</tr>\n";
  1190. }
  1191. if(($index % 2)==0)
  1192. print "</tr>\n";
  1193. else
  1194. print "<td colspan=\"2\">&nbsp;</td></tr>\n";
  1195. }else{ ?>
  1196. </table>
  1197. <div name="prodsections" id="prodsections">
  1198. </div>
  1199. <table width="100%" border="0" cellspacing="0" cellpadding="3" bgcolor="">
  1200. <?php } ?>
  1201. <tr>
  1202. <td width="100%" colspan="4">
  1203. <p align="center"><input type="submit" value="<?php print $yySubmit?>" />&nbsp;&nbsp;<input type="reset" value="<?php print $yyReset?>" /></p>
  1204. <?php show_info() ?>
  1205. </td>
  1206. </tr>
  1207. </table>
  1208. </td>
  1209. </tr>
  1210. </table>
  1211. </form>
  1212. <?php if(! $doaddnew){ ?>
  1213. <script language="JavaScript" type="text/javascript">
  1214. <!--
  1215. <?php if(! $simpleOptions){ ?>
  1216. document.forms.mainform.pNumOptions.selectedIndex=<?php print $nprodoptions ?>;
  1217. document.forms.mainform.pNumOptions.options[<?php print $nprodoptions ?>].selected = true;
  1218. setprodoptions();
  1219. <?php }
  1220. if(! $simpleSections){ ?>
  1221. document.forms.mainform.pNumSections.selectedIndex=<?php print $nprodsections ?>;
  1222. document.forms.mainform.pNumSections.options[<?php print $nprodsections ?>].selected = true;
  1223. setprodsections();
  1224. <?php }
  1225. if($useStockManagement){ ?>
  1226. setstocktype();
  1227. <?php } ?>
  1228. //-->
  1229. </script>
  1230. <?php }
  1231. }elseif(@$_POST["act"]=="discounts"){
  1232. $sSQL = "SELECT pName FROM products WHERE pID='" . @$_POST["id"] . "'";
  1233. $result = mysql_query($sSQL) or print(mysql_error());
  1234. $rs = mysql_fetch_assoc($result);
  1235. $thisname=$rs["pName"];
  1236. mysql_free_result($result);
  1237. $numassigns=0;
  1238. $sSQL = "SELECT cpaID,cpaCpnID,cpnWorkingName,cpnSitewide,cpnEndDate,cpnType, cpnBeginDate FROM cpnassign LEFT JOIN coupons ON cpnassign.cpaCpnID=coupons.cpnID WHERE cpaType=2 AND cpaAssignment='" . @$_POST["id"] . "'";
  1239. $result = mysql_query($sSQL) or print(mysql_error());
  1240. while($rs=mysql_fetch_assoc($result))
  1241. $alldata[$numassigns++]=$rs;
  1242. mysql_free_result($result);
  1243. $numcoupons=0;
  1244. $sSQL = "SELECT cpnID,cpnWorkingName,cpnSitewide FROM coupons WHERE cpnSitewide=0 AND cpnEndDate >= '" . date("Y-m-d H:i:s",time()) ."'";
  1245. $result = mysql_query($sSQL) or print(mysql_error());
  1246. while($rs=mysql_fetch_assoc($result))
  1247. $alldata2[$numcoupons++]=$rs;
  1248. mysql_free_result($result);
  1249. ?>
  1250. <script language="JavaScript" type="text/javascript">
  1251. <!--
  1252. function delrec(id) {
  1253. cmsg = "<?php print $yyConAss?>\n"
  1254. if (confirm(cmsg)) {
  1255. document.mainform.id.value = id;
  1256. document.mainform.act.value = "deletedisc";
  1257. document.mainform.submit();
  1258. }
  1259. }
  1260. // -->
  1261. </script>
  1262. <tr>
  1263. <form name="mainform" method="post" action="/admin/prods.php">
  1264. <td width="100%">
  1265. <input type="hidden" name="posted" value="1" />
  1266. <input type="hidden" name="act" value="dodiscounts" />
  1267. <input type="hidden" name="id" value="<?php print @$_POST["id"]?>" />
  1268. <input type="hidden" name="tt" value="<?php print @$_POST["tt"];?>" />
  1269. <input type="hidden" name="ts" value="<?php print @$_POST["ts"];?>" />
  1270. <table width="100%" border="0" cellspacing="0" cellpadding="3" bgcolor="">
  1271. <tr>
  1272. <td width="100%" colspan="4" align="center"><strong><?php print $yyAssPrd?> &quot;<?php print $thisname?>&quot;.</strong><br />&nbsp;</td>
  1273. </tr>
  1274. <?php
  1275. $gotone=FALSE;
  1276. if($numcoupons>0){
  1277. $thestr = '<tr><td colspan="4" align="center">' . $yyAsDsCp . ': <select name="assdisc" size="1">';
  1278. for($index=0;$index < $numcoupons;$index++){
  1279. $alreadyassign=FALSE;
  1280. if($numassigns>0){
  1281. for($index2=0;$index2<$numassigns;$index2++){
  1282. if($alldata2[$index]["cpnID"]==$alldata[$index2]["cpaCpnID"]) $alreadyassign=TRUE;
  1283. }
  1284. }
  1285. if(! $alreadyassign){
  1286. $thestr .= "<option value='" . $alldata2[$index]["cpnID"] . "'>" . $alldata2[$index]["cpnWorkingName"] . "</option>\n";
  1287. $gotone=TRUE;
  1288. }
  1289. }
  1290. $thestr .= "</select> <input type='submit' value='Go' /></td></tr>";
  1291. }
  1292. if($gotone){
  1293. print $thestr;
  1294. }else{
  1295. ?>
  1296. <tr>
  1297. <td width="100%" colspan="4" align="center"><br /><strong><?php print $yyNoDis?></td>
  1298. </tr>
  1299. <?php
  1300. }
  1301. if($numassigns>0){
  1302. ?>
  1303. <tr>
  1304. <td width="100%" colspan="4" align="center"><br /><strong><?php print $yyCurDis?> &quot;<?php print $thisname?>&quot;.</strong><br />&nbsp;</td>
  1305. </tr>
  1306. <tr>
  1307. <td><strong><?php print $yyWrkNam?></strong></td>
  1308. <td><strong><?php print $yyDisTyp?></strong></td>
  1309. <td><strong><?php print $yyBegin?></strong></td>
  1310. <td><strong><?php print $yyExpire?></strong></td>
  1311. <td align="center"><strong><?php print $yyDelete?></strong></td>
  1312. </tr>
  1313. <?php
  1314. for($index=0;$index<$numassigns;$index++){
  1315. $prefont = "";
  1316. $postfont = "";
  1317. if((int)$alldata[$index]["cpnSitewide"]==1 || ($alldata[$index]["cpnEndDate"] != '3000-01-01 00:00:00' && strtotime($alldata[$index]["cpnEndDate"])-time() < 0)){
  1318. $prefont = '<font color="#FF0000">';
  1319. $postfont = "</font>";
  1320. }
  1321. ?>
  1322. <tr>
  1323. <td><?php print $prefont . $alldata[$index]["cpnWorkingName"] . $postfont ?></td>
  1324. <td><?php if($alldata[$index]["cpnType"]==0)
  1325. print $prefont . $yyFrSShp . $postfont;
  1326. elseif($alldata[$index]["cpnType"]==1)
  1327. print $prefont . $yyFlatDs . $postfont;
  1328. elseif($alldata[$index]["cpnType"]==2)
  1329. print $prefont . $yyPerDis . $postfont; ?></td>
  1330. <td><?php
  1331. if ($alldata[$index]["cpnBeginDate"] != '0000-00-00 00:00:00') {
  1332. echo $prefont . $alldata[$index]["cpnBeginDate"] . $postfont;
  1333. } else {
  1334. echo $prefont . "&nbsp;" . $postfont;
  1335. }
  1336. ?></td>
  1337. <td><?php if($alldata[$index]["cpnEndDate"] == '3000-01-01 00:00:00')
  1338. print $yyNever;
  1339. elseif(strtotime($alldata[$index]["cpnEndDate"])-time() < 0)
  1340. print '<font color="#FF0000">' . $yyExpird . '</font>';
  1341. else
  1342. print $prefont . date("Y-m-d H:i:s",strtotime($alldata[$index]["cpnEndDate"])) . $postfont?></td>
  1343. <td align="center"><input type="button" name="discount" value="Delete Assignment" onclick="delrec('<?php print $alldata[$index]["cpaID"]?>')" /></td>
  1344. </tr>
  1345. <?php
  1346. }
  1347. }else{
  1348. ?>
  1349. <tr>
  1350. <td width="100%" colspan="4" align="center"><br /><strong><?php print $yyNoAss?></td>
  1351. </tr>
  1352. <?php
  1353. }
  1354. ?>
  1355. <tr>
  1356. <td width="100%" colspan="4" align="center"><br />&nbsp;</td>
  1357. </tr>
  1358. <tr>
  1359. <td width="100%" colspan="4" align="center"><br />
  1360. <a href="/admin/index.php"><strong><?php print $yyAdmHom?></strong></a><br />
  1361. &nbsp;</td>
  1362. </tr>
  1363. </table></td>
  1364. </form>
  1365. </tr>
  1366. <?php
  1367. }elseif(@$_POST["posted"]=="1" && $success){ ?>
  1368. <table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="" align="center">
  1369. <tr>
  1370. <td width="100%">
  1371. <table width="100%" border="0" cellspacing="0" cellpadding="3" bgcolor="">
  1372. <tr>
  1373. <td width="100%" colspan="2" align="center"><br /><strong><?php print $yyUpdSuc?></strong><br /><br /><?php print $yyNowFrd?><br /><br />
  1374. <?php print $yyNoAuto?> <a href="/admin/prods.php<?php
  1375. if(trim(@$_POST["ts"]) != "")
  1376. print "?ts=" . trim(@$_POST["ts"]);
  1377. elseif(trim(@$_POST["tt"]) != "")
  1378. print "?tt=" . trim(@$_POST["tt"]);
  1379. ?>"><strong>click here</strong></a>.<br />
  1380. <br />
  1381. <img src="/lib/images/misc/clearpixel.gif" width="300" height="3" alt="" />
  1382. </td>
  1383. </tr>
  1384. </table>
  1385. </td>
  1386. </tr>
  1387. </table>
  1388. <?php
  1389. }elseif(@$_POST["posted"]=="1"){ ?>
  1390. <table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="" align="center">
  1391. <tr>
  1392. <td width="100%">
  1393. <table width="100%" border="0" cellspacing="0" cellpadding="3" bgcolor="">
  1394. <tr>
  1395. <td width="100%" colspan="2" align="center"><br /><font color="#FF0000"><strong><?php print $yyOpFai?></strong></font><br /><br /><?php print $errmsg?><br /><br />
  1396. <a href="javascript:history.go(-1)"><strong><?php print $yyClkBac?></strong></a></td>
  1397. </tr>
  1398. </table>
  1399. </td>
  1400. </tr>
  1401. </table>
  1402. <?php
  1403. }elseif(@$_GET["tt"] != "" || @$_GET["ts"] != ""){ ?>
  1404. <script language="JavaScript" type="text/javascript">
  1405. <!--
  1406. function modrec(id,evt) {
  1407. document.mainform.id.value = id;
  1408. <?php if(strstr(@$HTTP_SERVER_VARS["HTTP_USER_AGENT"], "Gecko")){ ?>
  1409. if(evt.ctrlKey || evt.altKey)
  1410. <?php }else{ ?>
  1411. theevnt=window.event;
  1412. if(theevnt.ctrlKey)
  1413. <?php } ?>
  1414. document.mainform.act.value = "clone";
  1415. else
  1416. document.mainform.act.value = "modify";
  1417. document.mainform.submit();
  1418. }
  1419. function newrec(id) {
  1420. document.mainform.id.value = id;
  1421. document.mainform.act.value = "addnew";
  1422. document.mainform.submit();
  1423. }
  1424. function discounts(id) {
  1425. document.mainform.id.value = id;
  1426. document.mainform.act.value = "discounts";
  1427. document.mainform.submit();
  1428. }
  1429. function delrec(id) {
  1430. cmsg = "<?php print $yyConDel?>\n"
  1431. if (confirm(cmsg)) {
  1432. document.mainform.id.value = id;
  1433. document.mainform.act.value = "delete";
  1434. document.mainform.submit();
  1435. }
  1436. }
  1437. var arrProdToRelate=new Array();
  1438. var strProdToRelate='';
  1439. var arrRelatedProds=new Array();
  1440. var strRelatedProds='';
  1441. var count=0;
  1442. function loadRelatedProds(prod,type,relprod){
  1443. //alert(prod+','+type+','+relprod);
  1444. var url = "/admin/relatedaj.php";
  1445. var params = "prod="+prod+'&type='+type+'&relprod='+relprod;
  1446. //alert(params);
  1447. var ajax = new Ajax.Updater(
  1448. {success: "toadd_"+prod},
  1449. url,
  1450. {
  1451. method: "post",
  1452. parameters: params,
  1453. //onLoading: function() { Element.show("holder_working"+prod); },
  1454. //onComplete: function() { Element.hide("holder_working"+prod); },
  1455. evalScripts: true
  1456. });
  1457. }
  1458. function setProdToRelate(prod,type){
  1459. loadRelatedProds(prod,'','');
  1460. //Element.toggle('counthref'+prod);
  1461. //Element.toggle('count'+prod);
  1462. //$('count'+prod).onClick='';
  1463. Element.toggle('related'+prod);
  1464. arrlen=arrProdToRelate.length;
  1465. if(type=='Add'){
  1466. arrProdToRelate.push(prod);
  1467. $('prodstorelate'+prod).value=prod;
  1468. count++;
  1469. } else if (type=='Delete'){
  1470. for(i=0;i<arrlen;i++){
  1471. if(arrProdToRelate[i]==prod) arrProdToRelate.splice(i,1);
  1472. }
  1473. $('prodstorelate'+prod).value='';
  1474. count--;
  1475. }
  1476. if(count==0) resetAll();
  1477. else addRelatedProds(prod,'');
  1478. }
  1479. function setRelatedProds(reprod,ele){
  1480. //alert(ele);
  1481. /*if(type==1){
  1482. if($('relatedprods'+reprod).value==''){
  1483. if(count>0) {
  1484. arrRelatedProds.push(reprod);
  1485. if(type==''){
  1486. $('relatedprods'+reprod).value=reprod;
  1487. $('row_'+reprod).style.background='#BFC9E0';
  1488. }
  1489. addRelatedProds(reprod,'Add');
  1490. } else alert('There is no product for this to be related to!');
  1491. } else {
  1492. for(i=0;i<arrRelatedProds.length;i++){
  1493. if(arrRelatedProds[i]==reprod) arrRelatedProds.splice(i,1);
  1494. }
  1495. resetRelatedProd(reprod);
  1496. addRelatedProds(reprod,'Delete');
  1497. }
  1498. }else{*/
  1499. if(count>0) {
  1500. arrRelatedProds.push(reprod);
  1501. addRelatedProds(reprod,'Add');
  1502. }
  1503. $('autocomplete'+ele).value='';
  1504. //}
  1505. }
  1506. function resetRelatedProd(prod){
  1507. $('relatedprods'+prod).value='';
  1508. $('row_'+prod).style.background='';
  1509. }
  1510. function addRelatedProds(prod,type){
  1511. for(i=0;i<arrProdToRelate.length;i++){
  1512. loadRelatedProds(arrProdToRelate[i],type,prod);
  1513. }
  1514. }
  1515. function resetAll(){
  1516. allprods=document.getElementsByClassName('relatedprods');
  1517. cnt=allprods.length;
  1518. for(i=0;i<cnt;i++){
  1519. if(allprods[i].value!='')resetRelatedProd(allprods[i].value);
  1520. }
  1521. }
  1522. // -->
  1523. </script>
  1524. <style type="text/css">
  1525. <!--
  1526. tr.prodRow:hover {background-color: #FFFFCC; color: #000;}
  1527. -->
  1528. </style>
  1529. <table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="" align="center">
  1530. <tr>
  1531. <form name="mainform" method="post" action="/admin/prods.php">
  1532. <td width="100%">
  1533. <input type="hidden" name="posted" value="1" />
  1534. <input type="hidden" name="act" value="xxxxx" />
  1535. <input type="hidden" name="id" value="xxxxx" />
  1536. <input type="hidden" name="tt" value="<?php print @$_GET["tt"];?>" />
  1537. <input type="hidden" name="ts" value="<?php print @$_GET["ts"];?>" />
  1538. <table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="">
  1539. <tr>
  1540. <td width="100%" colspan="8" align="center"><strong><?php print $yyPrUpd?></strong>&nbsp;&nbsp;<input type="button" value="<?php print $yyNewPr?>" onclick="newrec()" /><br />&nbsp;</td>
  1541. </tr>
  1542. <tr>
  1543. <td><strong><?php print $yyPrId?></strong></td>
  1544. <td><strong>Display Order</strong></td>
  1545. <td><strong><?php print $yyPrName?></strong></td>
  1546. <td><strong>Price</strong></td>
  1547. <td><strong>Show to Etailers</strong></td>
  1548. <td><div align="center"><strong>Related</strong></div></td>
  1549. <td width="5%" align="center"><font size="1"><strong><?php print $yyDiscnt?></strong></font></td>
  1550. <td width="5%" align="center"><font size="1"><strong><?php print $yyModify?></strong></font></td>
  1551. <td width="5%" align="center"><font size="1"><strong><?php print $yyDelete?></strong></font></td>
  1552. </tr>
  1553. <?php
  1554. $allcoupon="";
  1555. $numcoupons=0;
  1556. $sSQL = "SELECT DISTINCT cpaAssignment FROM cpnassign WHERE cpaType=2";
  1557. $result = mysql_query($sSQL) or print(mysql_error());
  1558. while($rs=mysql_fetch_array($result))
  1559. $allcoupon[$numcoupons++]=$rs;
  1560. mysql_free_result($result);
  1561. if($stockManage != 0)
  1562. $sSQL = "SELECT pID,pName,pDisplay,pInStock,rootSection,pSell,pOrder,pEDisplay,pPrice,topSection FROM products LEFT OUTER JOIN sections ON products.pSection=sections.sectionID ";
  1563. else
  1564. $sSQL = "SELECT pID,pName,pDisplay,pSell,rootSection,pOrder,pPrice,topSection FROM products LEFT OUTER JOIN sections ON products.pSection=sections.sectionID ";
  1565. if(@$_GET["tt"]=="ALL")
  1566. ; // Nothing
  1567. else
  1568. $sSQL .= "WHERE pSection=" . $_GET["ts"];
  1569. if(@$adminsortorder!="") $sSQL .= " ORDER BY " . $adminsortorder; else $sSQL .= " ORDER BY pOrder,pName";
  1570. $result = mysql_query($sSQL) or print(mysql_error());
  1571. $haveerrprods=FALSE;
  1572. $bgcolor="#FFFFFF";
  1573. if(mysql_num_rows($result) > 0){
  1574. while($alldata = mysql_fetch_row($result)){
  1575. // Check to see if parent section exists
  1576. $parent_exists = FALSE;
  1577. $sql = "SELECT * FROM sections WHERE sectionID = " . $alldata[9];
  1578. $res = mysql_query($sql) or die('Problem querying parent section.');
  1579. if (mysql_num_rows($res) > 0) {
  1580. $parent_exists = TRUE;
  1581. }
  1582. if($bgcolor=="#E7EAEF") $bgcolor="#FFFFFF"; else $bgcolor="#E7EAEF"; ?>
  1583. <tr class="prodRow" bgcolor="<?php print $bgcolor?>" id="row_<?=$alldata[0]?>">
  1584. <td><strong><a href="javascript:void(0);" onclick="setRelatedProds('<?=$alldata[0]?>')"><?php print $alldata[0]?></a></strong></td>
  1585. <td><strong><?php print $alldata[6]?></strong></td>
  1586. <td><strong><?php
  1587. if( ! $parent_exists){
  1588. print "<font color='#FF0000'>*</font> ";
  1589. $haveerrprods=TRUE;
  1590. }
  1591. $stockbyoptions=false;
  1592. if($stockManage != 0)
  1593. if(($alldata[5] & 2) == 2) $stockbyoptions=true;
  1594. if(((int)$alldata[3] <= 0 || (int)$alldata[2] == 0) && ! $stockbyoptions) print "<font color='#FF0000'>";
  1595. if((int)$alldata[2] == 0) print "<strike>";
  1596. print str_replace(" ", "&nbsp;", $alldata[1]);
  1597. if((int)$alldata[2] == 0) print "</strike>";
  1598. if(((int)$alldata[3] <= 0 || (int)$alldata[2] == 0) && ! $stockbyoptions) print "</font>";
  1599. ?></strong><?php if($stockManage>0) print "&nbsp;(" . ($stockbyoptions?"-":$alldata[3]) . ")"?>
  1600. </td>
  1601. <td><?=sprintf("$%.2f", $alldata[8])?></td>
  1602. <td>
  1603. <?
  1604. if((int)$alldata[7]==1) print 'yes';
  1605. else print "<font color='#FF0000'>no</font>";
  1606. ?> </td>
  1607. <td align="center">
  1608. <? $sql_cross="SELECT * FROM crosssale WHERE prodID='".$alldata[0]."' ORDER BY prodID";
  1609. $result_cross=mysql_query($sql_cross);
  1610. $cnt_cross=0;
  1611. $str_cross='';
  1612. while($row_cross=mysql_fetch_assoc($result_cross)) {
  1613. $str_cross.= ($cnt_cross+1).'. '.$row_cross['related'].'<br />';
  1614. $cnt_cross++;
  1615. }
  1616. //if($cnt_cross>0){
  1617. ?>
  1618. <!-- <div id="count<?=$alldata[0]?>" style="display:none"><?=$cnt_cross?></div>
  1619. --> <div id="count<?=$alldata[0]?>"><a href="javascript:void(0);" onclick="setProdToRelate('<?=$alldata[0]?>','Add')"><?=$cnt_cross?></a></div>
  1620. <? //} else {?>
  1621. <!-- <div id="count<?=$alldata[0]?>" style="display:none">Add</div>
  1622. <div id="counthref<?=$alldata[0]?>"><a href="javascript:void(0)" onclick="setProdToRelate('<?=$alldata[0]?>','Add')">Add</a></div>
  1623. --> <? //} ?>
  1624. <input name="relatedprods<?=$alldata[0]?>" type="hidden" id="relatedprods<?=$alldata[0]?>" class="relatedprods" />
  1625. <input name="prodstorelate<?=$alldata[0]?>" type="hidden" id="prodstorelate<?=$alldata[0]?>" class="prodstorelate" />
  1626. <div style="position:relative;">
  1627. <div id="related<?=$alldata[0]?>" style="display:none; position:absolute; left:-490px; top:-16px; background-color:#E7EAEF; border: 1px solid #003366; width:500px; min-height:100px; text-align:left;">
  1628. <div style="background-color:#BFC9E0; padding:2px; z-index:100;">
  1629. <div style="float:right;"><a href="javascript:void(0);" style="color:#FFFFFF;" onclick="setProdToRelate('<?=$alldata[0]?>','Delete')"><img src="/lib/images/collapse.gif" border="0" /></a></div>
  1630. <div style="font-weight:bold;"><?=$alldata[0]?></div>
  1631. </div>
  1632. <div id="toadd_<?=$alldata[0]?>" style="padding:6px;"></div>
  1633. <div style="padding:2px; ">
  1634. <input type="text" id="autocomplete<?=$alldata[0]?>" name="pID" style="font-size:14px;width:430px;"/> <input name="addrel" type="button" onclick="setRelatedProds($('autocomplete<?=$alldata[0]?>').value,'<?=$alldata[0]?>')" value="add" />
  1635. <span id="indicator<?=$alldata[0]?>" style="display: none;"><img src="/lib/images/indicator.gif" alt="Working..." width="16" height="16" /></span>
  1636. </div>
  1637. <div id="autocomplete_choices<?=$alldata[0]?>" class="autocomplete"></div>
  1638. <script language="JavaScript" type="text/javascript">
  1639. new Ajax.Autocompleter("autocomplete<?=$alldata[0]?>", "autocomplete_choices<?=$alldata[0]?>", "/admin/relatedautocomplete.php", {indicator: 'indicator<?=$alldata[0]?>'});
  1640. /* function getSelectionId(text, li) {
  1641. $('autocomplete<?=$alldata[0]?>').value='';
  1642. }
  1643. */
  1644. </script>
  1645. </div>
  1646. </div>
  1647. </td>
  1648. <td align="center"><input <?php
  1649. for($index=0;$index<$numcoupons;$index++){
  1650. if($allcoupon[$index][0]==$alldata[0]){
  1651. print 'style="color: #FF0000"';
  1652. break;
  1653. }
  1654. }
  1655. ?> type="button" value="<?php print $yyAssign?>" onclick="discounts('<?php print str_replace(array("\\","'"),array("\\\\","\'"),$alldata[0])?>')" /></td>
  1656. <td><input type=button value="<?php print $yyModify?>" onclick="modrec('<?php print str_replace(array("\\","'"),array("\\\\","\'"),$alldata[0])?>',event)" /></td>
  1657. <td><input type=button value="<?php print $yyDelete?>" onclick="delrec('<?php print str_replace(array("\\","'"),array("\\\\","\'"),$alldata[0])?>')" /></td>
  1658. </tr>
  1659. <?php
  1660. }
  1661. if($haveerrprods){
  1662. ?>
  1663. <tr>
  1664. <td width="100%" colspan="8"><br />
  1665. <strong><font color='#FF0000'>* </font></strong><?php print $yySeePr?></td>
  1666. </tr>
  1667. <?php
  1668. }
  1669. }else{
  1670. ?>
  1671. <tr>
  1672. <td width="100%" colspan="6" align="center"><br /><?php print $yyPrNone?><br />&nbsp;</td>
  1673. </tr>
  1674. <?php
  1675. }
  1676. ?>
  1677. <tr>
  1678. <td width="100%" colspan="6" align="center"><br /><strong><?php print $yyANewPr?></strong>&nbsp;&nbsp;<input type="button" value="<?php print $yyNewPr?>" onclick="newrec()" /><br />&nbsp;</td>
  1679. </tr>
  1680. <tr>
  1681. <td width="100%" colspan="6" align="center"><br />
  1682. <a href="/admin/index.php"><strong><?php print $yyAdmHom?></strong></a><br />
  1683. <img src="/lib/images/misc/clearpixel.gif" width="300" height="3" alt="" /></td>
  1684. </tr>
  1685. </table></td>
  1686. </form>
  1687. </tr>
  1688. </table>
  1689. <?php
  1690. }else{ ?>
  1691. <script language="JavaScript" type="text/javascript">
  1692. <!--
  1693. function modrec(id) {
  1694. document.mainform.action="/admin/prods.php";
  1695. document.mainform.id.value = id;
  1696. document.mainform.act.value = "modify";
  1697. document.mainform.submit();
  1698. }
  1699. function newrec(id) {
  1700. document.mainform.action="/admin/prods.php";
  1701. document.mainform.id.value = id;
  1702. document.mainform.act.value = "addnew";
  1703. document.mainform.submit();
  1704. }
  1705. function dumpinventory(){
  1706. document.mainform.action="/admin/dumporders.php";
  1707. document.mainform.act.value = "dumpinventory";
  1708. document.mainform.submit();
  1709. }
  1710. function dump2COinventory(){
  1711. document.mainform.action="/admin/dumporders.php";
  1712. document.mainform.act.value = "dump2COinventory";
  1713. document.mainform.submit();
  1714. }
  1715. function delrec(id) {
  1716. cmsg = "<?php print $yyConDel?>\n"
  1717. if (confirm(cmsg)) {
  1718. document.mainform.action="/admin/prods.php";
  1719. document.mainform.id.value = id;
  1720. document.mainform.act.value = "delete";
  1721. document.mainform.submit();
  1722. }
  1723. }
  1724. function displaySection(section, num) {
  1725. // Change sign in the button
  1726. var button = $('show'+num);
  1727. if (button.value == '+') {
  1728. button.value = '-';
  1729. } else {
  1730. button.value = '+';
  1731. }
  1732. // Toggle visibility for the section
  1733. var aRows = $$('tr.sectionprod'+section);
  1734. console.log(section);
  1735. for (i=0; i<aRows.length; i++) {
  1736. aRows[i].toggle();
  1737. }
  1738. }
  1739. // -->
  1740. </script>
  1741. <style type="text/css">
  1742. <!--
  1743. .section {
  1744. font-weight: bold;
  1745. }
  1746. tr.sectionprod td {
  1747. padding-left: 50px;
  1748. }
  1749. -->
  1750. </style>
  1751. <table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="" align="center">
  1752. <tr>
  1753. <form name="mainform" method="post" action="/admin/prods.php">
  1754. <td width="100%">
  1755. <input type="hidden" name="posted" value="1" />
  1756. <input type="hidden" name="act" value="xxxxx" />
  1757. <input type="hidden" name="id" value="xxxxx" />
  1758. <table width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor="">
  1759. <tr>
  1760. <td width="100%" colspan="4" align="center"><br /><strong><?php print $yyPrClk?></strong><br />&nbsp;</td>
  1761. </tr>
  1762. <tr>
  1763. <td colspan='4'><input type="button" value="<?php print $yyNewPr?>" onclick="newrec()" />&nbsp;&nbsp;<strong><a href="/admin/prods.php?tt=ALL"><?php print $yyPrAll?></a></strong></td>
  1764. </tr>
  1765. <?php
  1766. //$sSQL = "SELECT sectionID,sectionWorkingName FROM sections WHERE rootSection=1 ORDER BY sectionWorkingName";
  1767. $sSQL = "SELECT s.sectionID, s.sectionWorkingName, p.pID, p.pName
  1768. FROM products p
  1769. LEFT OUTER JOIN sections s ON p.pSection=s.sectionID
  1770. WHERE p.pSection IS NOT NULL
  1771. AND p.pID != ''
  1772. AND s.sectionID IS NOT NULL
  1773. ORDER BY s.sectionWorkingName, p.pID";
  1774. $result = mysql_query($sSQL) or print(mysql_error());
  1775. if(mysql_num_rows($result) > 0){
  1776. $success=TRUE;
  1777. $lastSection = -1;
  1778. $i = 0;
  1779. while($alldata = mysql_fetch_assoc($result)){
  1780. if ($lastSection != $alldata['sectionID']) {
  1781. print "<tr class='section'><td><input type='button' id='show".$i."' onclick='displaySection(\"".$alldata['sectionID']."\", ".$i.")' value='+' />&nbsp;<a href='/admin/prods.php?ts=" . $alldata['sectionID'] . "'>".$alldata['sectionWorkingName']."</a></td></tr>";
  1782. }
  1783. print "<tr class='sectionprod".$alldata['sectionID']." sectionprod' style='display: none;'><td>".$alldata['pID']."&nbsp;-&nbsp;".$alldata['pName']."</td></tr>";
  1784. $lastSection = $alldata['sectionID'];
  1785. $i++;
  1786. }
  1787. }else
  1788. $success=FALSE;
  1789. mysql_free_result($result);
  1790. $sSQL = "SELECT payProvEnabled,payProvData1 FROM payprovider WHERE payProvID=2";
  1791. $result = mysql_query($sSQL) or print(mysql_error());
  1792. $rs = mysql_fetch_assoc($result);
  1793. if($rs["payProvEnabled"]==1 AND trim($rs["payProvData1"]) != ""){
  1794. ?>
  1795. <tr>
  1796. <td width="100%" colspan="4" align="center"><input type="button" value="2Checkout Inventory" onclick="dump2COinventory()" /></td>
  1797. </tr>
  1798. <?php
  1799. }
  1800. $alldata="";
  1801. if($stockManage != 0){
  1802. $sSQL = "SELECT pID,pName,pDisplay,pInStock,pSell FROM products WHERE pInStock<=0";
  1803. if(@$adminsortorder!="") $sSQL .= " ORDER BY " . $adminsortorder; else $sSQL .= " ORDER BY pName";
  1804. $sSQL .= " LIMIT 1000";
  1805. //echo $sSQL;
  1806. $result = mysql_query($sSQL) or print(mysql_error());
  1807. ?>
  1808. <tr>
  1809. <td width="100%" colspan="4" align="center"><br /><strong><?php print $yyPrOOS?></strong><br />&nbsp;</td>
  1810. </tr>
  1811. <tr>
  1812. <td width="100%" colspan="4" align="center"><input type="button" value="<?php print $yyDmpInv?>" onclick="dumpinventory()" /></td>
  1813. </tr>
  1814. <?php
  1815. if(mysql_num_rows($result) > 0){
  1816. while($alldata = mysql_fetch_row($result)){
  1817. if(($alldata[4] & 2) != 2 && $alldata[2] != 0){ ?>
  1818. <tr>
  1819. <td><strong><?php print $alldata[0]?></strong></td>
  1820. <td><strong><?php
  1821. if((int)$alldata[3] <= 0 || (int)$alldata[2] == 0) print "<font color='#FF0000'>";
  1822. if((int)$alldata[2] == 0) print "<strike>";
  1823. print $alldata[1];
  1824. if((int)$alldata[2] == 0) print "</strike>";
  1825. if((int)$alldata[3] <= 0 || (int)$alldata[2] == 0) print "</font>";
  1826. ?></strong></td>
  1827. <td><input type=button value="<?php print $yyModify?>" onclick="modrec('<?php print str_replace(array("\\","'"),array("\\\\","\'"),$alldata[0])?>')" /></td>
  1828. <td><input type=button value="<?php print $yyDelete?>" onclick="delrec('<?php print str_replace(array("\\","'"),array("\\\\","\'"),$alldata[0])?>')" /></td>
  1829. </tr>
  1830. <?php }
  1831. }
  1832. }else{
  1833. ?>
  1834. <tr>
  1835. <td width="100%" colspan="4" align="center"><br /><strong><?php print $yyPrNoOS?></strong><br />&nbsp;</td>
  1836. </tr>
  1837. <?php
  1838. }
  1839. }
  1840. ?>
  1841. <tr>
  1842. <td width="100%" colspan="4" align="center"><br /><strong><?php print $yyANewPr?></strong>&nbsp;&nbsp;<input type="button" value="<?php print $yyNewPr?>" onclick="newrec()" /><br />&nbsp;</td>
  1843. </tr>
  1844. <tr>
  1845. <td width="100%" colspan="4" align="center"><br />
  1846. <a href="/admin/index.php"><strong><?php print $yyAdmHom?></strong></a><br />
  1847. <img src="/lib/images/misc/clearpixel.gif" width="300" height="3" alt="" /></td>
  1848. </tr>
  1849. </table></td>
  1850. </form>
  1851. </tr>
  1852. </table>
  1853. <?php
  1854. }
  1855. ?>