PageRenderTime 43ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/public/admin/endpoints/products/createSimple.php

http://flumpshop.googlecode.com/
PHP | 125 lines | 108 code | 12 blank | 5 comment | 5 complexity | ed2741ffced625863cbe5bb1de065917 MD5 | raw file
  1. <?php
  2. $USR_REQUIREMENT = "can_add_products";
  3. require_once dirname(__FILE__)."/../header.php";
  4. ?><script type="text/javascript" src="../../tiny_mce/jquery.tinymce.js"></script>
  5. <script type="text/javascript">
  6. $().ready(function() {
  7. $('#description').tinymce({
  8. // Location of TinyMCE script
  9. script_url : '../../tiny_mce/tiny_mce.js',
  10. // General options
  11. theme : "advanced",
  12. plugins : "pagebreak,style,layer,table,advlink,iespell,inlinepopups,preview,media,searchreplace,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,advlist",
  13. // Theme options
  14. theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,forecolor",
  15. theme_advanced_buttons2 : "search,|,bullist,numlist,|,blockquote,|,link,unlink,code,|,preview,|",
  16. theme_advanced_buttons3 : "hr,removeformat,|,sub,sup,|,charmap,iespell,media,cleanup",
  17. theme_advanced_toolbar_location : "top",
  18. theme_advanced_toolbar_align : "left",
  19. theme_advanced_statusbar_location : "bottom",
  20. theme_advanced_resizing : true,
  21. // Example content CSS (should be your site CSS)
  22. content_css : "../../../style/cssProvider.php?theme=<?php echo $config->getNode("site","theme");?>&sub=main",
  23. // Drop lists for link/image/media/template dialogs
  24. template_external_list_url : "lists/template_list.js",
  25. external_link_list_url : "lists/link_list.js",
  26. media_external_list_url : "lists/media_list.js"
  27. });
  28. });
  29. </script><div class="ui-widget"><h1>Create a New Product</h1></div>
  30. <p>Hey, you've taken the first step toward creating a new product. I'll carefully guide you through the process of doing so.</p>
  31. <strong>Before You Start</strong>
  32. <p>To save some time later, it's best that you make sure you've made some categories to organise your products. If you haven't done so already, head over to the <a href="../switchboard/categories.php" onclick="loader('Please wait...','Loading Category Manager');">Category Management section</a> to add some now.</p>
  33. <form action="processCreateSimple.php" method="post" class="ui-widget" enctype="multipart/form-data" onsubmit="if ($(this).valid()) loader('Saving data...','Creating Product');">
  34. <div class="ui-widget-header">1. Name the Product</div>
  35. <div class="ui-widget-content">
  36. <p>First, you need to type the name of the product. Try to make it different to any other product, but keep it brief. The maximum length of the name is 255 characters.</p>
  37. <label for="name">Enter the product name: <input type="text" maxlength="255" name="name" id="name" class="ui-widget-content ui-state-default required" /></label>
  38. </div>
  39. <div class="ui-widget-header">2. Describe the Product</div>
  40. <div class="ui-widget-content">
  41. <p>Here you should type a detailed description of the product. Remember, you're trying to sell it, so make it appealing to users! You can leave this box blank if you want, and you can type as much as you want here.</p>
  42. <label for="description">Describe the product:<br /><textarea rows="10" cols="45" name="description" id="description" class="ui-widget-content ui-state-default"></textarea></label>
  43. </div>
  44. <div class="ui-widget-header">3. Categorise the Product</div>
  45. <div class="ui-widget-content">
  46. <p>Here, you can place the product into one of your categories to help users find it. If you don't set a category, visitors to your site can only find the product by searching for it. A product can be in as many categories as you want it to be.</p>
  47. <p>Look out! I don't check if you've put a product in a category more than once, so make sure you double check.</p>
  48. <div id="categoryselect_container"></div>
  49. <a href='javascript:' onclick='addCategorySelector();'>Add another category...</a>
  50. </div>
  51. <div class="ui-widget-header">4. Customise the Product</div>
  52. <div class="ui-widget-content">
  53. <p>If it's been set up, then each category you selected will have a series of <em style="cursor:pointer" onclick="alert('Special options for products that change depending on what categories a product belongs to.');">Features</em> that come with it. These help you to organise and describe your product, and more importantly, help your visitors find them. Any boxes shown below are optional.</p>
  54. <p>If you type anything in here, then change a category, any information in this section will be lost.</p>
  55. <div id="category_feature_fields"></div>
  56. </div>
  57. <div class="ui-widget-header">5. Price the Product</div>
  58. <div class="ui-widget-content">
  59. <p>Now you can enter a price for the new product. I currently only work with GBP, so make sure that's what your using. Visitors to the site will only see the price is <em style="cursor:pointer" onclick="alert('You site administrator may have chosen whether or not the site works as an online catalogue, or a fully-featured online shop. If shop mode is off, then no prices, stock, or related information is shown to visitors.');">Shop Mode</em> is enabled. However, it helps to have all the information in one place.</p>
  60. <label for="price">Enter the Price: &pound;<input type="text" maxlength="11" value="0.00" name="price" id="price" class="ui-widget-content ui-state-default required number" /></label>
  61. </div>
  62. <div class="ui-widget-header">6. Stock the Product</div>
  63. <div class="ui-widget-content">
  64. <p>Also optional, here you can enter the amount of stock you currently have for the product. If Shop Mode is enabled, then this product won't be sold if the stock runs out.</p>
  65. <label for="stock">Set the Stock:
  66. <input type="text" maxlength="10" value="0" name="stock" id="stock" class="ui-widget-content ui-state-default required number" /></label>
  67. </div>
  68. <div class="ui-widget-header">7. Weigh the Product</div>
  69. <div class="ui-widget-content">
  70. <p>If Delivery Rates are set up, then this weight will be used to automatically calculate the cost of delivering the product to all supported countries. It's only necessary if Shop Mode is enabled.</p>
  71. <label for="weight">Set the Weight: <input type="text" maxlength="8" value="0" name="weight" id="weight" class="ui-widget-content ui-state-default required number" />Kg</label>
  72. </div>
  73. <div class="ui-widget-header">8. Display the Product</div>
  74. <div class="ui-widget-content">
  75. <p>Finally, if you have a picture of the product, upload it here so the visitors can see it. You can add more pictures of it later if you want.</p>
  76. <label for="image">Choose an Image: <input type="file" name="image" id="image" class="ui-widget-content ui-state-default" /></label>
  77. </div>
  78. <div class="ui-widget-header">9. Create the Product</div>
  79. <div class="ui-widget-content">
  80. <p>Great, once you're sure the product's ready to go, click the Create button below to create the product. You can always change it later if you don't like it.</p>
  81. <input type="submit" value="Create" name="submit" id="submit" style="font-size: 13px; padding: .2em .4em;" onclick="$('#description').val(tinyMCE.get('description').getContent());return true" />
  82. </div>
  83. </form>
  84. <script>
  85. $('form').validate({
  86. messages: {
  87. name: "Please name the product",
  88. price: "Please enter the price here, without units",
  89. stock: "Please enter the stock here, as a number",
  90. weight: "Please enter a weight here, without units",
  91. }
  92. });
  93. document.categorySelectNo = 0;
  94. function updateFeatures() {
  95. str = "";
  96. for (i=0;i<document.categorySelectNo;i++) str = str+$('#category_'+i).val()+",";
  97. $('#category_feature_fields').html("<img src='../../../images/loading.gif' />Updating feature list...");
  98. $('#category_feature_fields').load('featureFields.php?&id='+str);
  99. }
  100. function addCategorySelector() {
  101. $('#categoryselect_container').append("<div id='newField_"+document.categorySelectNo+"'><img src='../../../images/loading.gif' />Loading category list...</div>");
  102. $('#newField_'+document.categorySelectNo).load("categorySelect.php?id="+document.categorySelectNo);
  103. document.categorySelectNo++;
  104. }
  105. $.ajaxSetup({cache:true});
  106. addCategorySelector();
  107. </script>
  108. </body></html>