PageRenderTime 54ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 1ms

/application/views/pages/admin/prods2.php

https://bitbucket.org/chadsaun/ifrogz-panel
PHP | 1843 lines | 1768 code | 19 blank | 56 comment | 272 complexity | 3878b83f41e987cbe166589aed2a6e8b MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. <script language="JavaScript" type="text/javascript" src="http://assets.ifrogz.com/lib/packages/scriptaculous-js/1.5.1/prototype.js"></script>
  2. <script language="JavaScript" type="text/javascript" src="http://assets.ifrogz.com/lib/packages/scriptaculous-js/1.5.1/effects.js"></script>
  3. <script language="JavaScript" type="text/javascript" src="http://assets.ifrogz.com/lib/packages/scriptaculous-js/1.5.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 sf_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 sf_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 sf_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 .= "pImage='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pImage"]))) . "', ";
  145. $sSQL .= "pLongDescription='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pLongDescription"]))) . "', ";
  146. $sSQL .= "pUPC='" . mysql_real_escape_string(unstripslashes(trim($_POST['pUPC']))) . "', ";
  147. $sSQL .= "pBin='" . mysql_real_escape_string(unstripslashes(trim($_POST['pBin']))) . "', ";
  148. for($index=2; $index <= $adminlanguages+1; $index++){
  149. if(($adminlangsettings & 1)==1) $sSQL .= "pName" . $index . "='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pName" . $index]))) . "', ";
  150. if(($adminlangsettings & 2)==2) $sSQL .= "pDescription" . $index . "='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pDescription" . $index]))) . "', ";
  151. if(($adminlangsettings & 4)==4) $sSQL .= "pLongDescription" . $index . "='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pLongDescription" . $index]))) . "', ";
  152. }
  153. if($setoptions=='yes') {
  154. $comma='';
  155. for($rowcounter=0; $rowcounter < maxprodopts; $rowcounter++){
  156. if(@$_POST["set_options_list" . $rowcounter] != "" && @$_POST["set_options_list" . $rowcounter] != 0){
  157. $str_options .= $comma.@$_POST["set_options_list" . $rowcounter];
  158. $comma=',';
  159. }
  160. }
  161. $sSQL .= "pSetOptions='" . $str_options . "',";
  162. } else $sSQL .= "pSetOptions='',";
  163. $sSQL .= "isSet='" . $completeset . "',";
  164. $sSQL .= "pLargeImage='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pLargeImage"]))) . "', ";
  165. if(trim(@$_POST["pDisplay"]) == "ON")
  166. $sSQL .= "pDisplay=1,pOrder=" . trim(@$_POST["pOrder"]) . ",";
  167. else
  168. $sSQL .= "pDisplay=0,";
  169. if(trim(@$_POST["pEDisplay"]) == "ON")
  170. $sSQL .= "pEDisplay=1,";
  171. else
  172. $sSQL .= "pEDisplay=0,";
  173. $sSQL .= "pTabName='".mysql_real_escape_string(unstripslashes(trim($_POST['pTabName']))) . "', ";
  174. if(@$perproducttaxrate==TRUE)
  175. $sSQL .= "pTax=" . trim(@$_POST["pTax"]) . ",";
  176. if($stockManage != 0 && is_numeric(trim(@$_POST["inStock"])))
  177. $sSQL .= "pInStock=" . trim(@$_POST["inStock"]) . ",";
  178. if(trim(@$_POST["pSell"]) == "ON") $pSell=1; else $pSell=0;
  179. if(trim(@$_POST["stockOptions"]) == "1") $pSell += 2;
  180. if(trim(@$_POST["staticpage"]) == "1") $pSell += 4;
  181. $sSQL .= "pSell=" . $pSell . ",";
  182. $sSQL .= "pURL='" . trim($_POST['pURL']) . "',";
  183. if(@$productdimensions==TRUE)
  184. $sSQL .= "pDims='" . trim(@$_POST["plen"]) . "x" . trim(@$_POST["pwid"]) . "x" . trim(@$_POST["phei"]) . "',";
  185. if(@$digidownloads==TRUE)
  186. $sSQL .= "pDownload='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pDownload"]))) . "',";
  187. if($shipType==1){
  188. if(! is_numeric(trim(@$_POST["pShipping"])))
  189. $sSQL .= "pShipping=0,";
  190. else
  191. $sSQL .= "pShipping=" . trim(@$_POST["pShipping"]) . ",";
  192. if(! is_numeric(trim(@$_POST["pShipping2"])))
  193. $sSQL .= "pShipping2=0,";
  194. else
  195. $sSQL .= "pShipping2=" . trim(@$_POST["pShipping2"]) . ",";
  196. }elseif($shipType==2 || $shipType==3 || $shipType==4 || $shipType==6){
  197. if(! is_numeric(trim(@$_POST["pShipping"])))
  198. $sSQL .= "pWeight=0,";
  199. else
  200. $sSQL .= "pWeight=" . trim(@$_POST["pShipping"]) . ",";
  201. }
  202. if(trim(@$_POST["pWholesalePrice"]) != "")
  203. $sSQL .= "pWholesalePrice=" . trim(@$_POST["pWholesalePrice"]) . ",";
  204. else
  205. $sSQL .= "pWholesalePrice=0,";
  206. //wholesale pricing group added 6-6-06 By Blake
  207. $sSQL .= "pPricing_group=" .trim(@$_POST["pPricing_group"]). ",";
  208. //
  209. if(trim(@$_POST["pListPrice"]) != "")
  210. $sSQL .= "pListPrice=" . trim(@$_POST["pListPrice"]) . ",";
  211. else
  212. $sSQL .= "pListPrice=0,";
  213. $sSQL .= "pPrice=" . trim(@$_POST["pPrice"]) . ",";
  214. if(! is_numeric(trim(@$_POST["pCost"])))
  215. $sSQL .= "pCost=0,";
  216. else
  217. $sSQL .= "pCost=" . trim(@$_POST["pCost"]) . ",";
  218. if(! is_numeric(trim(@$_POST["pCustomsvalue"])))
  219. $sSQL .= "pCustomsvalue=0,";
  220. else
  221. $sSQL .= "pCustomsvalue=" . trim(@$_POST["pCustomsvalue"]) . ",";
  222. $sSQL .= "pCatOnDetail='" . trim(@$_POST["pCatOnDetail"]) . "' ";
  223. $sSQL .= "WHERE pID='" . @$_POST["id"] . "'";
  224. //echo $sSQL;
  225. //exit();
  226. mysql_query($sSQL) or print(mysql_error());
  227. $sSQL = "DELETE FROM prodoptions WHERE poProdID='" . @$_POST["id"] . "'";
  228. mysql_query($sSQL) or print(mysql_error());
  229. for($rowcounter=0; $rowcounter < maxprodopts; $rowcounter++){
  230. if(@$_POST["pOption" . $rowcounter] != "" && @$_POST["pOption" . $rowcounter] != 0){
  231. $sSQL = "INSERT INTO prodoptions (poProdID,poOptionGroup) VALUES ('" . @$_POST["newid"] . "'," . @$_POST["pOption" . $rowcounter] . ")";
  232. mysql_query($sSQL) or print(mysql_error());
  233. }
  234. }
  235. $sSQL = "DELETE FROM multisections WHERE pID='" . @$_POST["id"] . "'";
  236. mysql_query($sSQL) or print(mysql_error());
  237. for($rowcounter=0; $rowcounter < $maxprodsects; $rowcounter++){
  238. if(@$_POST["pSection" . $rowcounter] != "" && @$_POST["pSection" . $rowcounter] != 0 && @$_POST["pSection"] != @$_POST["pSection" . $rowcounter]){
  239. $sSQL = "INSERT INTO multisections (pID,pSection) VALUES ('" . @$_POST["newid"] . "'," . @$_POST["pSection" . $rowcounter] . ")";
  240. mysql_query($sSQL) or print(mysql_error());
  241. }
  242. }
  243. $dorefresh=TRUE;
  244. }else
  245. $errmsg = $yyPrDup;
  246. }elseif(@$_POST["act"]=="doaddnew"){
  247. $sSQL = "SELECT * FROM sf_products WHERE pID='" . trim(@$_POST["newid"]) . "'";
  248. $result = mysql_query($sSQL) or print(mysql_error());
  249. $success = (mysql_num_rows($result)==0);
  250. mysql_free_result($result);
  251. if($success){
  252. $sSQL = "INSERT INTO sf_products (pUPC,pBin,pID,pNUM,pName,pSection,pDropship,pExemptions,pDescription,pImage,pLongDescription,pCatOnDetail,";
  253. for($index=2; $index <= $adminlanguages+1; $index++){
  254. if(($adminlangsettings & 1)==1) $sSQL .= "pName" . $index . ",";
  255. if(($adminlangsettings & 2)==2) $sSQL .= "pDescription" . $index . ",";
  256. if(($adminlangsettings & 4)==4) $sSQL .= "pLongDescription" . $index . ",";
  257. }
  258. $sSQL .= "pSetOptions,isSet,pLargeImage,pPrice,pCost,pCustomsvalue,pWholesalePrice,pPricing_group,pListPrice,";
  259. if($shipType==1) $sSQL .= "pShipping,pShipping2,";
  260. $sSQL .= "pDisplay,pOrder,pEDisplay,pTabName,";
  261. if(@$perproducttaxrate==TRUE) $sSQL .= "pTax,";
  262. if($stockManage != 0 && is_numeric(trim(@$_POST["inStock"]))) $sSQL .= "pInStock,";
  263. if(@$productdimensions==TRUE) $sSQL .= 'pDims,';
  264. if(@$digidownloads==TRUE) $sSQL .= 'pDownload,';
  265. $sSQL .= "pSell,pURL,pWeight) VALUES (";
  266. $sSQL .= "'" . trim(unstripslashes(@$_POST["pUPC"])) . "',";
  267. $sSQL .= "'" . trim(unstripslashes(@$_POST["pBin"])) . "',";
  268. $sSQL .= "'" . trim(unstripslashes(@$_POST["newid"])) . "',";
  269. $sSQL .= "'" . trim(unstripslashes(@$_POST["altprodid"])) . "',";
  270. $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pName"])) . "',";
  271. $sSQL .= @$_POST["pSection"] . ",";
  272. $sSQL .= @$_POST["pDropship"] . ",";
  273. $sSQL .= $pExemptions . ",";
  274. $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pDescription"])) . "',";
  275. $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pImage"])) . "',";
  276. $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pLongDescription"])) . "',";
  277. $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pCatOnDetail"])) . "',";
  278. for($index=2; $index <= $adminlanguages+1; $index++){
  279. if(($adminlangsettings & 1)==1) $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pName" . $index])) . "',";
  280. if(($adminlangsettings & 2)==2) $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pDescription" . $index])) . "',";
  281. if(($adminlangsettings & 4)==4) $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pLongDescription" . $index])) . "',";
  282. }
  283. if($setoptions=='yes') {
  284. $comma='';
  285. for($rowcounter=0; $rowcounter < maxprodopts; $rowcounter++){
  286. if(@$_POST["set_options_list" . $rowcounter] != "" && @$_POST["set_options_list" . $rowcounter] != 0){
  287. $str_options .= $comma.@$_POST["set_options_list" . $rowcounter];
  288. $comma=',';
  289. }
  290. }
  291. $sSQL .= "'" . $str_options . "',";
  292. } else $sSQL .= "'',";
  293. $sSQL .= "'" . $completeset . "',";
  294. $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pLargeImage"])) . "',";
  295. $sSQL .= "'".trim(@$_POST["pPrice"]) . "',";
  296. $sSQL .= "'".trim(@$_POST["pCost"]) . "',";
  297. $sSQL .= "'".trim(@$_POST["pCustomsvalue"]) . "',";
  298. if(trim(@$_POST["pWholesalePrice"]) != "")
  299. $sSQL .= trim(@$_POST["pWholesalePrice"]) . ",";
  300. else
  301. $sSQL .= "0,";
  302. //wholesale pricing group added 6-6-06 By Blake
  303. $sSQL .= trim(@$_POST["pPricing_group"]) . ",";
  304. //
  305. if(trim(@$_POST["pListPrice"]) != "")
  306. $sSQL .= trim(@$_POST["pListPrice"]) . ",";
  307. else
  308. $sSQL .= "0,";
  309. if($shipType==1){
  310. if(! is_numeric(trim(@$_POST["pShipping"])))
  311. $sSQL .= "0,";
  312. else
  313. $sSQL .= trim(@$_POST["pShipping"]) . ",";
  314. if(! is_numeric(trim(@$_POST["pShipping2"])))
  315. $sSQL .= "0,";
  316. else
  317. $sSQL .= trim(@$_POST["pShipping2"]) . ",";
  318. }
  319. if(trim(@$_POST["pDisplay"]) == "ON")
  320. $sSQL .= "1," . trim(@$_POST["pOrder"]) . ",";
  321. else
  322. $sSQL .= "0,0,";
  323. if(trim(@$_POST["pEDisplay"]) == "ON")
  324. $sSQL .= "1,";
  325. else
  326. $sSQL .= "0,";
  327. $sSQL .= "'" . mysql_real_escape_string(unstripslashes(@$_POST["pTabName"])) . "',";
  328. if(@$perproducttaxrate==TRUE) $sSQL .= "'" . @$_POST["pTax"] . "',";
  329. if($stockManage != 0 && is_numeric(trim(@$_POST["inStock"])))
  330. $sSQL .= trim(@$_POST["inStock"]) . ",";
  331. if(@$productdimensions==TRUE)
  332. $sSQL .= "'" . trim(@$_POST["plen"]) . "x" . trim(@$_POST["pwid"]) . "x" . trim(@$_POST["phei"]) . "',";
  333. if(@$digidownloads==TRUE)
  334. $sSQL .= "'" . mysql_real_escape_string(unstripslashes(trim(@$_POST["pDownload"]))) . "',";
  335. if(trim(@$_POST["pSell"]) == "ON") $pSell=1; else $pSell=0;
  336. if(trim(@$_POST["stockOptions"]) == "1") $pSell += 2;
  337. if(trim(@$_POST["staticpage"]) == "1") $pSell += 4;
  338. $sSQL .= $pSell . ",";
  339. $sSQL .= "'" . trim($_POST['pURL']) . "',";
  340. if($shipType <= 1 || ! is_numeric(trim(@$_POST["pShipping"])))
  341. $sSQL .= "0";
  342. elseif($shipType==2 || $shipType==3 || $shipType==4 || $shipType==6)
  343. $sSQL .= trim(@$_POST["pShipping"]) . "";
  344. else{
  345. $sSQL .= trim(@$_POST["pShipping"]) . ".";
  346. if((int)trim(@$_POST["pShipping2"]) < 10) $sSQL .= "0";
  347. $sSQL .= trim(@$_POST["pShipping2"]);
  348. }
  349. $sSQL .= ")";
  350. //echo $sSQL;
  351. mysql_query($sSQL) or print(mysql_error());
  352. //exit();
  353. for($rowcounter=0; $rowcounter < maxprodopts; $rowcounter++){
  354. if(@$_POST["pOption" . $rowcounter] != "" && @$_POST["pOption" . $rowcounter] != 0){
  355. $sSQL = "INSERT INTO prodoptions (poProdID,poOptionGroup) VALUES ('" . @$_POST["newid"] . "'," . @$_POST["pOption" . $rowcounter] . ")";
  356. mysql_query($sSQL) or print(mysql_error());
  357. }
  358. }
  359. $sSQL = "DELETE FROM multisections WHERE pID='" . @$_POST["newid"] . "'";
  360. mysql_query($sSQL) or print(mysql_error());
  361. for($rowcounter=0; $rowcounter < $maxprodsects; $rowcounter++){
  362. if(@$_POST["pSection" . $rowcounter] != "" && @$_POST["pSection" . $rowcounter] != 0 && @$_POST["pSection"] != @$_POST["pSection" . $rowcounter]){
  363. $sSQL = "INSERT INTO multisections (pID,pSection) VALUES ('" . @$_POST["newid"] . "'," . @$_POST["pSection" . $rowcounter] . ")";
  364. mysql_query($sSQL) or print(mysql_error());
  365. }
  366. }
  367. $dorefresh=TRUE;
  368. }else
  369. $errmsg = "Sorry, that product reference is already in use. Please use your browser back button to return and correct the problem.";
  370. }elseif(@$_POST["act"]=="dodiscounts"){
  371. $sSQL = "INSERT INTO cpnassign (cpaCpnID,cpaType,cpaAssignment) VALUES (" . @$_POST["assdisc"] . ",2,'" . @$_POST["id"] . "')";
  372. mysql_query($sSQL) or print(mysql_error());
  373. $dorefresh=TRUE;
  374. }elseif(@$_POST["act"]=="deletedisc"){
  375. $sSQL = "DELETE FROM cpnassign WHERE cpaID=" . @$_POST["id"];
  376. mysql_query($sSQL) or print(mysql_error());
  377. $dorefresh=TRUE;
  378. }
  379. if(@$_POST["act"]=="modify" || @$_POST["act"]=="clone" || @$_POST["act"]=="addnew"){
  380. $sSQL = "SELECT optGrpID, optGrpWorkingName FROM optiongroup ORDER BY optGrpWorkingName";
  381. $nalloptions=0;
  382. $result = mysql_query($sSQL) or print(mysql_error());
  383. while($rs = mysql_fetch_row($result))
  384. $alloptions[$nalloptions++] = $rs;
  385. mysql_free_result($result);
  386. if(@$_POST["act"]=="modify" || @$_POST["act"]=="clone"){
  387. $sSQL = "SELECT poID, poOptionGroup FROM prodoptions WHERE poProdID='" . trim(@$_POST["id"]) . "' ORDER BY poID";
  388. $nprodoptions=0;
  389. $result = mysql_query($sSQL) or print(mysql_error());
  390. while($rs = mysql_fetch_row($result))
  391. $prodoptions[$nprodoptions++] = $rs;
  392. // set Options selected items
  393. $sSQL = "SELECT pSetOptions FROM sf_products WHERE pID='" . trim(@$_POST["id"]) . "'";
  394. $setoptions=0;
  395. $result = mysql_query($sSQL) or print(mysql_error());
  396. $rs = mysql_fetch_row($result);
  397. if(!empty($rs[0])) {
  398. $setoptions = explode(',',$rs[0]);
  399. $nsetoptions = count($setoptions);
  400. } else $nsetoptions = 0;
  401. //echo '$nsetoptions='.$nsetoptions;
  402. $sSQL = "SELECT pSection FROM multisections WHERE pID='" . trim(@$_POST["id"]) . "'";
  403. $result = mysql_query($sSQL) or print(mysql_error());
  404. while($rs = mysql_fetch_row($result))
  405. $prodsections[$nprodsections++] = $rs;
  406. }
  407. $sSQL = "SELECT sectionID, sectionWorkingName, sectionDisabled FROM sf_sections WHERE rootSection=1 ORDER BY sectionWorkingName";
  408. $result = mysql_query($sSQL) or print(mysql_error());
  409. while($rs = mysql_fetch_assoc($result))
  410. $allsections[$nallsections++] = $rs;
  411. mysql_free_result($result);
  412. $sSQL = "SELECT dsID,dsName FROM dropshipper ORDER BY dsName";
  413. $result = mysql_query($sSQL) or print(mysql_error());
  414. while($rs = mysql_fetch_assoc($result))
  415. $alldropship[$nalldropship++] = $rs;
  416. mysql_free_result($result);
  417. }
  418. }
  419. if($dorefresh){
  420. print '<meta http-equiv="refresh" content="2; url=/admin/prods2.php';
  421. if(trim(@$_POST["ts"]) != "")
  422. print "?ts=" . trim(@$_POST["ts"]);
  423. elseif(trim(@$_POST["tt"]) != "")
  424. print "?tt=" . trim(@$_POST["tt"]);
  425. print '">';
  426. }
  427. ?>
  428. <script language="JavaScript" type="text/javascript">
  429. <!--
  430. var ie=(document.all != (void 0));
  431. var ns6=(document.getElementById&&!document.all);
  432. <?php if(@$_POST["act"]=="addnew" || @$_POST["act"]=="modify" || @$_POST["act"]=="clone"){ ?>
  433. function checkastring(thestr,validchars){
  434. for (i=0; i < thestr.length; i++){
  435. ch = thestr.charAt(i);
  436. for (j = 0; j < validchars.length; j++)
  437. if (ch == validchars.charAt(j))
  438. break;
  439. if (j == validchars.length)
  440. return(false);
  441. }
  442. return(true);
  443. }
  444. function formvalidator(theForm)
  445. {
  446. checkUPC('pUPC');
  447. //alert($('upcOK').value);
  448. if($('upcOK').value=='false') {
  449. //alert('in');
  450. return (false);
  451. }
  452. if (theForm.newid.value == ""){
  453. alert("<?php print $yyPlsEntr?> \"<?php print $yyPrRef?>\".");
  454. theForm.newid.focus();
  455. return (false);
  456. }
  457. if (theForm.pSection.options[theForm.pSection.selectedIndex].value == ""){
  458. alert("<?php print $yyPlsSel?> \"<?php print $yySection?>\".");
  459. theForm.pSection.focus();
  460. return (false);
  461. }
  462. if (theForm.pName.value == ""){
  463. alert("<?php print $yyPlsEntr?> \"<?php print $yyPrNam?>\".");
  464. theForm.pName.focus();
  465. return (false);
  466. }
  467. <?php for($index=2; $index <= $adminlanguages+1; $index++){
  468. if(($adminlangsettings & 1)==1){ ?>
  469. if (theForm.pName<?php print $index?>.value == ""){
  470. alert("<?php print $yyPlsEntr?> \"<?php print $yyPrNam . " " . $index?>\".");
  471. theForm.pName<?php print $index?>.focus();
  472. return (false);
  473. }
  474. <?php }
  475. } ?>
  476. if (theForm.pPrice.value == ""){
  477. alert("<?php print $yyPlsEntr?> \"<?php print $yyPrPri?>\".");
  478. theForm.pPrice.focus();
  479. return (false);
  480. }
  481. var checkOK = "'\" ";
  482. var checkStr = theForm.newid.value;
  483. var allValid = true;
  484. for (i = 0; i < checkStr.length; i++){
  485. ch = checkStr.charAt(i);
  486. for (j = 0; j < checkOK.length; j++)
  487. if (ch == checkOK.charAt(j)){
  488. allValid = false;
  489. break;
  490. }
  491. }
  492. if (!allValid){
  493. alert("<?php print $yyQuoSpa?> \"<?php print $yyPrRef?>\".");
  494. theForm.newid.focus();
  495. return (false);
  496. }
  497. if (!checkastring(theForm.pPrice.value,"0123456789.")){
  498. alert("<?php print $yyOnlyDec?> \"<?php print $yyPrPri?>\".");
  499. theForm.pPrice.focus();
  500. return (false);
  501. }
  502. if (!checkastring(theForm.pWholesalePrice.value,"0123456789.")){
  503. alert("<?php print $yyOnlyDec?> \"<?php print $yyWhoPri?>\".");
  504. theForm.pWholesalePrice.focus();
  505. return (false);
  506. }
  507. if (!checkastring(theForm.pListPrice.value,"0123456789.")){
  508. alert("<?php print $yyOnlyDec?> \"<?php print $yyListPr?>\".");
  509. theForm.pListPrice.focus();
  510. return (false);
  511. }
  512. <?php if(@$productdimensions==TRUE){ ?>
  513. if (theForm.elements['pExemptions[]'].options[2].selected!=true){
  514. if (theForm.plen.value == ""){
  515. alert("<?php print $yyPlsEntr?> \"<?php print $yyDims?>\".");
  516. theForm.plen.focus();
  517. return(false);
  518. }
  519. if (theForm.pwid.value == ""){
  520. alert("<?php print $yyPlsEntr?> \"<?php print $yyDims?>\".");
  521. theForm.pwid.focus();
  522. return(false);
  523. }
  524. if (theForm.phei.value == ""){
  525. alert("<?php print $yyPlsEntr?> \"<?php print $yyDims?>\".");
  526. theForm.phei.focus();
  527. return(false);
  528. }
  529. }
  530. var checkOK = "0123456789.";
  531. if (!checkastring(theForm.plen.value,checkOK)){
  532. alert("<?php print $yyOnlyDec?> \"<?php print $yyDims?>\".");
  533. theForm.plen.focus();
  534. return(false);
  535. }
  536. if (!checkastring(theForm.pwid.value,checkOK)){
  537. alert("<?php print $yyOnlyDec?> \"<?php print $yyDims?>\".");
  538. theForm.pwid.focus();
  539. return(false);
  540. }
  541. if (!checkastring(theForm.phei.value,checkOK)){
  542. alert("<?php print $yyOnlyDec?> \"<?php print $yyDims?>\".");
  543. theForm.phei.focus();
  544. return(false);
  545. }
  546. <?php }
  547. if(($shipType > 0 && $shipType < 5) || $shipType==6){ ?>
  548. var checkOK = "0123456789.";
  549. if (!checkastring(theForm.pShipping.value,checkOK)){
  550. <?php if($shipType==1){ ?>
  551. alert("<?php print $yyOnlyDec?> \"<?php print $yyShip . ": " . $yyFirShi?>\".");
  552. <?php }else{ ?>
  553. alert("<?php print $yyOnlyDec?> \"<?php print $yyPrWght?>\".");
  554. <?php } ?>
  555. theForm.pShipping.focus();
  556. return (false);
  557. }
  558. <?php } ?>
  559. <?php if($shipType==1){ ?>
  560. if (!checkastring(theForm.pShipping2.value,"0123456789.")){
  561. alert("<?php print $yyOnlyDec?> \"<?php print $yyShip . ": " . $yySubShi?>\".");
  562. theForm.pShipping2.focus();
  563. return (false);
  564. }
  565. <?php } ?>
  566. <?php if($stockManage != 0){ ?>
  567. if (!(theForm.stockOptions.selectedIndex==1) && theForm.inStock.value == ""){
  568. alert("<?php print $yyPlsEntr?> \"<?php print $yyInStk?>\".");
  569. theForm.inStock.focus();
  570. return (false);
  571. }
  572. if (!(theForm.stockOptions.selectedIndex==1) && !checkastring(theForm.inStock.value,"0123456789")){
  573. alert("<?php print $yyOnlyNum?> \"<?php print $yyInStk?>\".");
  574. theForm.inStock.focus();
  575. return (false);
  576. }
  577. if(theForm.stockOptions.selectedIndex==1 && theForm.pNumOptions.selectedIndex==0){
  578. alert("<?php print $yyStkWrn?>");
  579. theForm.stockOptions.focus();
  580. return (false);
  581. }
  582. <?php } ?>
  583. <?php if(@$perproducttaxrate==TRUE){ ?>
  584. if (theForm.pTax.value == ""){
  585. alert("<?php print $yyPlsEntr?> \"<?php print $yyTax?>\".");
  586. theForm.pTax.focus();
  587. return(false);
  588. }
  589. if (!checkastring(theForm.pTax.value,"0123456789.")){
  590. alert("<?php print $yyOnlyDec?> \"<?php print $yyTax?>\".");
  591. theForm.pTax.focus();
  592. return (false);
  593. }
  594. <?php } ?>
  595. return (true);
  596. }
  597. <?php } ?>
  598. var prodOptGrpArr = new Array();
  599. var prodSectGrpArr = new Array();
  600. var prodOptGrpSet = new Array();
  601. <?php
  602. $rowcounter=0;
  603. for($rowcounter=0;$rowcounter < $nprodoptions;$rowcounter++)
  604. print "prodOptGrpArr[" . $rowcounter . "]=" . $prodoptions[$rowcounter][1] . ";\r\n";
  605. print "for(ii=" . $rowcounter . ";ii<" . maxprodopts . ";ii++) prodOptGrpArr[ii]=0;\r\n";
  606. for($rowcounter=0;$rowcounter < $nsetoptions;$rowcounter++)
  607. print "prodOptGrpSet[" . $rowcounter . "]=" . $setoptions[$rowcounter] . ";\r\n";
  608. print "for(ii=" . $rowcounter . ";ii<" . maxprodopts . ";ii++) prodOptGrpSet[ii]=0;\r\n";
  609. for($rowcounter=0;$rowcounter < $nprodsections;$rowcounter++)
  610. print "prodSectGrpArr[" . $rowcounter . "]=" . $prodsections[$rowcounter][0] . ";\r\n";
  611. print "for(ii=" . $rowcounter . ";ii<" . $maxprodsects . ";ii++) prodSectGrpArr[ii]=0;\r\n";
  612. ?>
  613. function update_opts(index){
  614. var thisOption;
  615. if(ns6)
  616. thisOption = document.getElementById('pOption'+index);
  617. else
  618. thisOption = eval('document.forms.mainform.pOption'+index);
  619. prodOptGrpArr[index] = thisOption.options[thisOption.selectedIndex].value;
  620. }
  621. function update_sects(index){
  622. var thisSection;
  623. if(ns6)
  624. thisSection = document.getElementById('pSection'+index);
  625. else
  626. thisSection = eval('document.forms.mainform.pSection'+index);
  627. prodSectGrpArr[index] = thisSection.options[thisSection.selectedIndex].value;
  628. }
  629. function setprodoptions(){
  630. var setoptions =$('setoptions').checked;
  631. var noOpts = document.forms.mainform.pNumOptions.selectedIndex;
  632. var theElm;
  633. var theHTMLHead,theHTML="";
  634. var index=0;
  635. if(ns6)
  636. theElm = document.getElementById('prodoptions');
  637. else
  638. theElm = document.all.prodoptions;
  639. theHTMLHead = '<table width="100%" border="0" cellspacing="0" cellpadding="3">';
  640. 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>';
  641. <?php
  642. for($rowcounter=0;$rowcounter < $nalloptions;$rowcounter++)
  643. print "theHTML = theHTML +'<option value=\"" . $alloptions[$rowcounter][0] . "\">" . str_replace("'","\'",$alloptions[$rowcounter][1]) . "</option>';\n";
  644. ?>
  645. theHTML = theHTML + '</select>';
  646. if(setoptions) {
  647. 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>';
  648. }
  649. for (index=0;index<noOpts;index++) {
  650. if(index % 2 == 0) theHTMLHead = theHTMLHead + '<tr>';
  651. theHTMLHead = theHTMLHead + '<td width="15%" align="right"><?php print $yyPrdOpt?> '+(index+1)+':</td><td width="35%">'+theHTML.replace(/GGREPLACEMExx/g,index)+'</td>';
  652. if(index % 2 != 0) theHTMLHead = theHTMLHead + '</tr>';
  653. }
  654. if(index % 2 != 0) theHTMLHead = theHTMLHead + '<td width="50%" colspan="2">&nbsp;</td></tr>';
  655. theHTMLHead = theHTMLHead + '</table>';
  656. theElm.innerHTML=theHTMLHead;
  657. for (index=0;index<noOpts;index++) {
  658. var thisOption;
  659. if(ns6)
  660. thisOption = document.getElementById('pOption'+index);
  661. else
  662. thisOption = eval('document.forms.mainform.pOption'+index);
  663. for (index2=0;index2<thisOption.length;index2++) {
  664. if (thisOption[index2].value==prodOptGrpArr[index]) {
  665. thisOption.selectedIndex=index2;
  666. thisOption.options[index2].selected = true;
  667. }
  668. else
  669. thisOption.options[index2].selected = false;
  670. }
  671. if(prodOptGrpSet[index]!=0)
  672. loadOptions(prodOptGrpArr[index],index,prodOptGrpSet[index]);
  673. }
  674. }
  675. function setprodsections(){
  676. var noSects = document.forms.mainform.pNumSections.selectedIndex;
  677. var theElm;
  678. var theHTMLHead,theHTML="";
  679. var index=0;
  680. if(ns6)
  681. theElm = document.getElementById('prodsections');
  682. else
  683. theElm = document.all.prodsections;
  684. theHTMLHead = '<table width="100%" border="0" cellspacing="0" cellpadding="3">';
  685. theHTML = theHTML + '<select size="1" id="pSectionGGREPLACEMExx" name="pSectionGGREPLACEMExx" onChange="update_sects(GGREPLACEMExx);"><option value="0">None</option>';
  686. <?php
  687. for($rowcounter=0;$rowcounter < $nallsections;$rowcounter++)
  688. print "theHTML = theHTML +'<option value=\"" . $allsections[$rowcounter]["sectionID"] . "\">" . str_replace("'","\'",$allsections[$rowcounter]["sectionWorkingName"]) . "</option>';\n";
  689. ?>
  690. theHTML = theHTML + '</select>';
  691. for (index=0;index<noSects;index++) {
  692. if(index % 2 == 0) theHTMLHead = theHTMLHead + '<tr>';
  693. theHTMLHead = theHTMLHead + '<td width="25%" align="right">Prod. Section '+(index+1)+':</td><td width="25%">'+theHTML.replace(/GGREPLACEMExx/g,index)+'</td>';
  694. if(index % 2 != 0) theHTMLHead = theHTMLHead + '</tr>';
  695. }
  696. if(index % 2 != 0) theHTMLHead = theHTMLHead + '<td width="50%" colspan="2">&nbsp;</td></tr>';
  697. theHTMLHead = theHTMLHead + '</table>';
  698. theElm.innerHTML=theHTMLHead;
  699. for (index=0;index<noSects;index++) {
  700. var thisSection;
  701. if(ns6)
  702. thisSection = document.getElementById('pSection'+index);
  703. else
  704. thisSection = eval('document.forms.mainform.pSection'+index);
  705. for (index2=0;index2<thisSection.length;index2++) {
  706. if (thisSection[index2].value==prodSectGrpArr[index]) {
  707. thisSection.selectedIndex=index2;
  708. thisSection.options[index2].selected = true;
  709. }
  710. else
  711. thisSection.options[index2].selected = false;
  712. }
  713. }
  714. }
  715. function setstocktype(){
  716. var si = document.forms.mainform.stockOptions.selectedIndex;
  717. document.forms.mainform.inStock.disabled=(si==1);
  718. }
  719. //-->
  720. </script>
  721. <?php
  722. function show_info(){
  723. global $yyPrEx1, $yyPrEx2, $yyDspOrd, $yyDspImg;
  724. ?>
  725. <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>
  726. <li><strong>Product Name:</strong> must be descriptive but short as possible. What the customer sees in the cart.</li>
  727. <li><strong>UPC:</strong> the unique number assigned to this product. Use as the barcode and is all numbers.</li>
  728. <li><strong>Bin:</strong> the location where the product is located.</li>
  729. <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>
  730. <li><strong>Display:</strong> <?php print $yyDspOrd?></li>
  731. <li><strong>Display to Etailer:</strong> used to limit which products are displayed to etailers through the API.</li>
  732. <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>
  733. <li><strong>Download:</strong> if the product is downloaded, this is the download url of the software.</li>
  734. <li><strong>Description:</strong> Viewable on flash page. Short description.</li>
  735. <li><strong>Long Description:</strong> Viewable on the prod detail page. </li>
  736. <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>
  737. <li><strong>Additional Sections: </strong>select multiple categories where the product will be displayed.</li>
  738. <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>
  739. <li><?php print $yyPrEx2?></li>
  740. <li><?php print $yyPrEx1?></li>
  741. <li><strong>Cost: </strong>actual cost to us for the product. (optional)</li>
  742. <li><strong>Customs Cost: </strong>the stated cost when shipping international for the customs form.
  743. <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>
  744. <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.
  745. </ul>
  746. </p>
  747. <?php
  748. }
  749. if(@$_POST["posted"]=="1" && (@$_POST["act"]=="modify" || @$_POST["act"]=="clone" || @$_POST["act"]=="addnew")){
  750. if(@$_POST["act"]=="modify" || @$_POST["act"]=="clone"){
  751. $doaddnew = FALSE;
  752. $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";
  753. if(@$digidownloads==TRUE) $sSQL .= ",pDownload";
  754. $sSQL .= " FROM sf_products WHERE pId='" . mysql_real_escape_string(unstripslashes(@$_POST["id"])) . "'";
  755. $result = mysql_query($sSQL) or print(mysql_error());
  756. $alldata = mysql_fetch_assoc($result);
  757. $pId = $alldata["pId"];
  758. $pNUM = $alldata['pNUM'];
  759. $pName = $alldata["pName"];
  760. for($index=2; $index <= $adminlanguages+1; $index++){
  761. $pNames[$index] = $alldata["pName" . $index];
  762. $pDescriptions[$index] = $alldata["pDescription" . $index];
  763. $pLongDescriptions[$index] = $alldata["pLongDescription" . $index];
  764. }
  765. $pSection = $alldata["pSection"];
  766. $pDescription = $alldata["pDescription"];
  767. $pImage = $alldata["pImage"];
  768. $pPrice = $alldata["pPrice"];
  769. $pCost = $alldata["pCost"];
  770. $pCustomsvalue = $alldata["pCustomsvalue"];
  771. $pWholesalePrice = $alldata["pWholesalePrice"];
  772. $pPricing_group = $alldata["pPricing_group"];
  773. $pListPrice = $alldata["pListPrice"];
  774. $pDisplay = $alldata["pDisplay"];
  775. $pEDisplay = $alldata["pEDisplay"];
  776. $pTabName = $alldata["pTabName"];
  777. $pSell = $alldata["pSell"];
  778. $pURL = $alldata["pURL"];
  779. $pShipping = $alldata["pShipping"];
  780. $pShipping2 = $alldata["pShipping2"];
  781. $pLargeImage = $alldata["pLargeImage"];
  782. $pWeight = $alldata["pWeight"];
  783. $pLongDescription = $alldata["pLongDescription"];
  784. $pExemptions = $alldata["pExemptions"];
  785. $pInStock = $alldata["pInStock"];
  786. $pDims = $alldata["pDims"];
  787. $pTax = $alldata["pTax"];
  788. $pDropship = $alldata["pDropship"];
  789. $pOrder = $alldata["pOrder"];
  790. $pSetOptions = $alldata["pSetOptions"];
  791. $completeSet= $alldata["isSet"];
  792. $pCatOnDetail=$alldata["pCatOnDetail"];
  793. $pUPC = $alldata['pUPC'];
  794. $pBin = $alldata['pBin'];
  795. if(@$digidownloads==TRUE) $pDownload = $alldata["pDownload"];
  796. }else{
  797. $doaddnew = TRUE;
  798. $pId = "";
  799. $pName = "";
  800. for($index=2; $index <= $adminlanguages+1; $index++){
  801. $pNames[$index] = "";
  802. $pDescriptions[$index] = "";
  803. $pLongDescriptions[$index] = "";
  804. }
  805. if(trim(@$_POST["ts"]) != "") $pSection=(int)trim(@$_POST["ts"]); else $pSection = 0;
  806. $pDescription = "";
  807. $pImage = "prodimages/";
  808. $pPrice = "";
  809. $pWholesalePrice = "";
  810. $pPricing_group = 1;
  811. $pListPrice = 0;
  812. $pDisplay = 1;
  813. $pEDisplay = 1;
  814. $pTabName="";
  815. $pSell = 1;
  816. $pURL="";
  817. $pShipping = "";
  818. $pShipping2 = "";
  819. $pLargeImage = "prodimages/";
  820. $pWeight = "";
  821. $pLongDescription = "";
  822. $pExemptions = 0;
  823. $pInStock = "";
  824. $pDims = "";
  825. $pTax = "";
  826. $pDropship = 0;
  827. $pDownload = "";
  828. $pOrder = 100;
  829. $pCatOnDetail="";
  830. }
  831. ?>
  832. <form name="mainform" method="post" action="/admin/prods2.php" onsubmit="return formvalidator(this)">
  833. <table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="" align="center">
  834. <tr>
  835. <td width="100%">
  836. <input type="hidden" name="posted" value="1" />
  837. <?php if(@$_POST["act"]=="modify"){ ?>
  838. <input type="hidden" name="act" value="domodify" />
  839. <input type="hidden" id="id" name="id" value="<?php print str_replace('"',"&quot;",$pId)?>" />
  840. <?php }else{ ?>
  841. <input type="hidden" name="act" value="doaddnew" />
  842. <?php } ?>
  843. <input type="hidden" name="tt" value="<?php print @$_POST["tt"];?>" />
  844. <input type="hidden" name="ts" value="<?php print @$_POST["ts"];?>" />
  845. <table width="100%" border="0" cellspacing="0" cellpadding="3" bgcolor="">
  846. <tr>
  847. <td colspan="4" align="center"><strong><?php
  848. if(@$_POST["act"]=="modify")
  849. print $yyYouMod . " &quot;" . $pName . "&quot;";
  850. elseif(@$_POST["act"]=="addnew")
  851. print $yyPrUpd;
  852. else
  853. print $yyYouCln . " &quot;" . $pName . "&quot;";
  854. ?></strong><br />&nbsp;</td>
  855. </tr>
  856. <tr>
  857. <td width="14%" align="right">
  858. <font color="#FF0000">*</font><?php print $yyPrRef?>:
  859. </td>
  860. <td width="36%">
  861. <input type="text" name="newid" size="15" value="<?php print str_replace('"',"&quot;",$pId)?>" /> <a href="#info">?</a>
  862. </td>
  863. <td width="5%" align="right">
  864. <font color="#FF0000">*</font><?php print $yySection?>:
  865. </td>
  866. <td width="15%">
  867. <select size="1" name="pSection">
  868. <option value=""><?php print $yySelect?></option><?php
  869. for($index=0;$index<$nallsections;$index++){
  870. print "<option value='" . $allsections[$index]["sectionID"] . "'";
  871. if($allsections[$index]["sectionID"]==$pSection) print " selected";
  872. print ">" . $allsections[$index]["sectionWorkingName"] . "</option>\n";
  873. } ?>
  874. </select>
  875. <a href="#info">?</a>
  876. </td>
  877. </tr>
  878. <tr>
  879. <td width="14%" align="right">Alt Prod ID:</td>
  880. <td width="36%">
  881. <input type="text" name="altprodid" size="15" value="<?php print str_replace('"',"&quot;",$pNUM)?>" /> <a href="#info">?</a>
  882. </td>
  883. <td colspan="2">&nbsp;</td>
  884. </tr>
  885. <tr>
  886. <td align="right"><font color="#FF0000">*</font><?php print $yyPrNam?>:</td>
  887. <td><input type="text" name="pName" size="25" value="<?php print str_replace('"',"&quot;",$pName)?>" /> <a href="#info">?</a></td>
  888. <td align="right"><font color="#FF0000">*</font><?php print $yyPrPri?>:</td>
  889. <td><input type="text" name="pPrice" id="pPrice" size="15" value="<?php print $pPrice?>" />
  890. <a href="#info">?</a></td>
  891. </tr>
  892. <tr>
  893. <td style="text-align: right;">UPC #:</td>
  894. <td><input type="text" id="pUPC" name="pUPC" size="15" value="<?=$pUPC?>" onblur="checkUPC('pUPC')" />
  895. <input name="upcOK" type="hidden" id="upcOK" />
  896. <a href="#info">?</a></td>
  897. <td>&nbsp;</td>
  898. <td>&nbsp;</td>
  899. </tr>
  900. <tr>
  901. <td style="text-align: right;">BIN #:</td>
  902. <td><input name="pBin" type="text" id="pBin" value="<?=$pBin?>" size="15" />
  903. <a href="#info">?</a></td>
  904. <td>&nbsp;</td>
  905. <td>&nbsp;</td>
  906. </tr>
  907. <?php for($index=2; $index <= $adminlanguages+1; $index++){
  908. if(($adminlangsettings & 1)==1){
  909. ?><tr>
  910. <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])?>" />
  911. <a href="#info">?</a></td>
  912. </tr><?php
  913. }
  914. } ?>
  915. <tr>
  916. <?php if($useStockManagement){ ?>
  917. <td align="right">
  918. <input type="hidden" name="pSell" value="<?php if(((int)$pSell & 1)==1) print "ON" ?>" />
  919. <select name="stockOptions" size="1" onchange="setstocktype();">
  920. <option value="0">&nbsp;&nbsp;&nbsp;<?php print $yyInStk?>:</option>
  921. <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?>" />
  922. <a href="#info">?</a></td>
  923. <?php }else{ ?>
  924. <input type="hidden" name="stockOptions" value="<?php if(((int)$pSell & 2)==2) print "1" ?>" />
  925. <td align="right"><?php print $yySellBut?>:</td><td><input type="checkbox" name="pSell" value="ON" <?php if(((int)$pSell & 1)==1) print "checked" ?> /></td>
  926. <?php } ?>
  927. <td width="10%" align="right">MSRP<?php //print $yyWhoPri?> <font size="1">(<a href="#info">info</a>)</font>:<br />
  928. Pricing Group: </td>
  929. <td width="20%"><input type="text" name="pWholesalePrice" id="pWholesalePrice" size="10" value="<?php print $pWholesalePrice?>" />
  930. <select name="pPricing_group" id="pPricing_group" onchange="if($F('pPricing_group')==0) $('pWholesalePrice').value='<?php print $pPrice?>'; else $('pWholesalePrice').value='<?php print $pWholesalePrice?>';">
  931. <option value="0" <?php if ($pPricing_group=="0") {echo "selected=\"selected\"";} ?>>Full Price (0)</option>
  932. <option value="1" <?php if ($pPricing_group=="1") {echo "selected=\"selected\"";} ?>>Sets (1)</option>
  933. <option value="2" <?php if ($pPricing_group=="2") {echo "selected=\"selected\"";} ?>>Individual Items (2)</option>
  934. <option value="3" <?php if ($pPricing_group=="3") {echo "selected=\"selected\"";} ?>>Shieldzone (3)</option>
  935. <option value="4" <?php if ($pPricing_group=="4") {echo "selected=\"selected\"";} ?>>Skullcandy (4)</option>
  936. </select>
  937. <a href="#info">?</a></td>
  938. </tr>
  939. <tr>
  940. <td align="right">Display on ifrogz:</td><td><input type="checkbox" name="pDisplay" value="ON" <?php if((int)$pDisplay != 0) print "checked" ?> />
  941. Display Order: <input name="pOrder" type="text" id="pOrder" value="<?php print $pOrder?>" size="4" />
  942. <a href="#info">?</a></td>
  943. <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>
  944. </tr>
  945. <tr>
  946. <td align="right" valign="top">Display to Etailers: </td>
  947. <td><input name="pEDisplay" type="checkbox" id="pEDisplay" value="ON" <?php if((int)$pEDisplay != 0) print "checked" ?> />
  948. <a href="#info">?</a></td>
  949. <td align="right">Cost:</td>
  950. <td nowrap="nowrap"><input name="pCost" type="text" id="pCost" size="15" value="<?=$pCost?>" /> <label>
  951. <input name="cost_percent" type="text" id="cost_percent" size="2" value="40" />%
  952. <input type="button" name="cost_percent_calc" value="go" onclick="$('pCost').value=($F('cost_percent')/100)*$F('pPrice');" />
  953. <a href="#info">?</a></label></td>
  954. <td colspan="2" align="center" valign="top">&nbsp;</td>
  955. </tr>
  956. <tr>
  957. <td align="right" valign="top">Tab Name: </td>
  958. <td><input name="pTabName" type="text" id="pTabName" value="<?=$pTabName?>" />
  959. <a href="#info">?</a></td>
  960. <td align="right">Customs Cost: </td>
  961. <td><input name="pCustomsvalue" type="text" id="pCustomsvalue" size="15" value="<?=$pCustomsvalue?>" />
  962. <input name="cost_percent2" type="text" id="cost_percent2" size="2" value="40" />%
  963. <input type="button" name="cost_percent_calc2" value="go" onclick="$('pCustomsvalue').value=($F('cost_percent2')/100)*$F('pPrice');" />
  964. <a href="#info">?</a></td>
  965. <td colspan="2" align="center" valign="top">&nbsp;</td>
  966. </tr>
  967. <tr>
  968. <td align="right" valign="top"><?php print $yyImage?>: </td>
  969. <td><textarea name="pImage" id="pImage" cols="40" rows="4" ><?php print str_replace('"',"&quot;",$pImage)?></textarea>
  970. <a href="javascript:void(0);" onclick="viewImage('pImage','pImageView');">View</a>
  971. <div style="position:relative; ">
  972. <div id="pImageView" class="imageView" style="display:none;"></div>
  973. </div>
  974. <div style="font-size:10px; ">* For more than one image see below. <a href="#info">?</a></div></td>
  975. <?php if(@$productdimensions==TRUE){
  976. $proddims = split("x", $pDims) ?>
  977. <td align="right"><font color="#FF0000">*</font><?php print $yyDims?>:</td>
  978. <td><input type="text" name="plen" size="4" value="<?php print @$proddims[0]?>" /> <strong>X</strong>
  979. <input type="text" name="pwid" size="4" value="<?php print @$proddims[1]?>" /> <strong>X</strong>
  980. <input type="text" name="phei" size="4" value="<?php print @$proddims[2]?>" /></td>
  981. <?php }else{ ?>
  982. <td colspan="2" align="center" valign="bottom"><strong><?php
  983. if(($shipType > 0 && $shipType < 5) || $shipType==6)
  984. print $yyShpInf;
  985. else
  986. print "&nbsp;"; ?></strong></td>
  987. <?php } ?>
  988. </tr>
  989. <tr>
  990. <td align="right" valign="top"><?php print $yyLgeImg?>:</td>
  991. <td align="left"><textarea name="pLargeImage" id="pLargeImage" cols="40" rows="4"><?php print str_replace('"',"&quot;",$pLargeImage)?></textarea>
  992. <a href="javascript:void(0);" onclick="viewImage('pLargeImage','pLargeImageView');">View</a>
  993. <div style="position:relative; ">
  994. <div id="pLargeImageView" class="imageView" style="display:none;"></div>
  995. </div>
  996. <div style="font-size:10px; ">* For more than one image see below. <a href="#info">?</a></div></td>
  997. <td align="right" valign="top"><?php
  998. if($shipType==1)
  999. print $yyShip . ":<br />" . $yyFirShi;
  1000. elseif($shipType==2 || $shipType==3 || $shipType==4 || $shipType==6)
  1001. print $yyPrWght . ":";
  1002. else
  1003. print "&nbsp;";
  1004. ?></td>
  1005. <td align="left" valign="top"><?php
  1006. if($shipType==1)
  1007. print "<input type=text name='pShipping' size='15' value='" . $pShipping . "' />";
  1008. elseif($shipType==2 || $shipType==3 || $shipType==4 || $shipType==6)
  1009. print "<input type=text name='pShipping' size='15' value='" . $pWeight . "' />";
  1010. else
  1011. print "&nbsp;"; ?></td>
  1012. </tr>
  1013. <tr>
  1014. <?php if($simpleOptions){ ?>
  1015. <td colspan="2">&nbsp;</td>
  1016. <?php }else{ ?>
  1017. <td align="right"><?php print $yyNumOpt?>:</td>
  1018. <td>
  1019. <select size="1" name="pNumOptions" onchange="setprodoptions();">
  1020. <option value='0'><?php print $yyNone?></option>
  1021. <?php for($rowcounter=1; $rowcounter <= maxprodopts; $rowcounter++)
  1022. print "<option value='" . $rowcounter . "'>" . $rowcounter . "</option>"; ?>
  1023. </select> <?php print $yyCompleteSet?> <input name="completeset" type="checkbox" id="completeset" value="yes" <?php if ($completeSet=='yes') {echo "checked";} ?>>
  1024. <?php print $yySetOptions?> <input <?php if (!empty($pSetOptions)) {echo "checked";} ?> name="setoptions" id="setoptions" type="checkbox" value="yes" onchange="setprodoptions();">
  1025. <a href="#info">?</a> </td>
  1026. <?php } ?>
  1027. <td align="right"><?php
  1028. if($shipType==1)
  1029. print $yyShip . ":<br />" . $yySubShi;
  1030. else
  1031. print "&nbsp;"; ?></td>
  1032. <td align="left"><?php
  1033. if($shipType==1)
  1034. print "<input type=text name='pShipping2' size='15' value='" . (double)$pShipping2 . "' />";
  1035. else
  1036. print "&nbsp;"; ?></td>
  1037. </tr>
  1038. <?php if($simpleOptions){
  1039. for($index=0;$index < maxprodopts; $index++){
  1040. if(($index % 2)==0) print "<tr>";
  1041. print '<td align="right">' . $yyPrdOpt . ' ' . ($index+1) . ':</td><td><select size="1" id="pOption' . $index . '" name="pOption' . $index . '"><option value="0">None</option>';
  1042. for($rowcounter=0;$rowcounter < $nalloptions;$rowcounter++){
  1043. print '<option value="' . $alloptions[$rowcounter][0] . '"';
  1044. if($index < $nprodoptions){
  1045. if($prodoptions[$index][1]==$alloptions[$rowcounter][0]) print " selected";
  1046. }
  1047. print ">" . $alloptions[$rowcounter][1] . "</option>";
  1048. }
  1049. print "</td>";
  1050. if(($index % 2) != 0) print "</tr>\n";
  1051. }
  1052. if(($index % 2)==0)
  1053. print "</tr>\n";
  1054. else
  1055. print "<td colspan=\"2\">&nbsp;</td></tr>\n";
  1056. }else{ ?>
  1057. </table>
  1058. <div name="prodoptions" id="prodoptions">
  1059. </div>
  1060. <table width="100%" border="0" cellspacing="0" cellpadding="3" bgcolor="">
  1061. <?php }
  1062. if(@$digidownloads==TRUE){ ?>
  1063. <tr>
  1064. <td width="14%" align="right"><?php print $yyDownl?>:</td>
  1065. <td colspan="4" align="left"><input type="text" size="60" name="pDownload" value="<?php print $pDownload?>" />
  1066. <a href="#info">?</a></td>
  1067. </tr>
  1068. <?php } ?>
  1069. <tr>
  1070. <td align="right"><?php print $yyDesc?>:</td>

Large files files are truncated, but you can click here to view the full file