PageRenderTime 64ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/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

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.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

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