Advertisement
Guest User

javascript opencart

a guest
Jul 28th, 2012
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DONT MIND THIS 2 JAVASCRIPT - They are for product seo and category seo URLs
  2. <script type="text/javascript">// <![CDATA[
  3. $(document).ready(function(){
  4. var keyword = $("input[name=keyword]").val();
  5. $("input[name*='product_description[2][name]']").keyup(function(){
  6. var text = $(this).val();
  7. text = text.toLowerCase();
  8. text = text.replace(/[^a-zA-Z0-9]+/g,'-');
  9. $("input[name=keyword]").val(text);
  10. });})
  11. // ]]></script>
  12.  
  13. <script type="text/javascript">// <![CDATA[
  14. $(document).ready(function(){
  15. var keyword = $("input[name=keyword]").val();
  16. $("input[name*='category_description[2][name]']").keyup(function(){
  17. var text = $(this).val();
  18. text = text.toLowerCase();
  19. text = text.replace(/[^a-zA-Z0-9]+/g,'-');
  20. $("input[name=keyword]").val(text);
  21. });})
  22. // ]]></script>
  23.  
  24.  
  25.  
  26. THESE ARE THE 4 JAVASCRIPT TO TAKE VALUES FROM FIELD AND ADD/SUBTRACT TAXES from my custom fields to original fields and vice versa:
  27.  
  28. <script type="text/javascript">// <![CDATA[
  29. $(document).ready(function(){
  30. var price = $("input[name=price]").val();
  31. $("input[name*='IVA']").keyup(function(){
  32. var text = $(this).val();
  33. text = Math.round(((text*100)/121)*100)/100;
  34. $("input[name=price]").val(text);
  35. });})
  36. // ]]></script>
  37.  
  38. <script type="text/javascript">// <![CDATA[
  39. $(document).ready(function(){
  40. var IVA = $("input[name=IVA]").val();
  41. $("input[name*='price']").keyup(function(){
  42. var text = $(this).val();
  43. text = Math.round(((text*121)/100)*100)/100;
  44. $("input[name=IVA]").val(text);
  45. });})
  46. // ]]></script>
  47.  
  48.  
  49.  
  50.  
  51. CONIVA AND SENZAIVA ARE 2 CUSTOM FIELD PLACED IN THE SAME PAGE OF PRODUCT FORM.
  52. <script type="text/javascript">// <![CDATA[
  53. $(document).ready(function(){
  54. var SENZAIVA = $("input[name=SENZAIVA]").val();
  55. $("input[name*='CONIVA']").keyup(function(){
  56. var text = $(this).val();
  57. text = Math.round(((text*100)/121)*100)/100;
  58. $("input[name=SENZAIVA]").val(text);
  59. });})
  60. // ]]></script>
  61.  
  62. <script type="text/javascript">// <![CDATA[
  63. $(document).ready(function(){
  64. var CONIVA = $("input[name=CONIVA]").val();
  65. $("input[name*='SENZAIVA']").keyup(function(){
  66. var text = $(this).val();
  67. text = Math.round(((text*121)/100)*100)/100;
  68. $("input[name=CONIVA]").val(text);
  69. });})
  70. // ]]></script>
  71. BASICALLY I've 4 field: 1 opencart original (price) and 3 custom inserted in product form (IVA, CONIVA, SENZAIVA)
  72. all 4 are in the same page (product form)
  73. IVA value edit price value -- price value edit iva value
  74. coniva value edit senzaiva value -- senzaiva value edit coniva value
  75. but coniva and senzaiva edit also the price, and i don't want this.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement