Guest User

Untitled

a guest
Mar 19th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. <script> <?php $this->callfunction($product) ?> </scipt>
  2.  
  3. <catalog_product_view>
  4. <reference name="content">
  5. <block type="<name>/catalog_product_callfunction" name="callfunction" output="toHtml"
  6. template="catalog/product/callfunction.phtml"
  7. as="callfunction"/>
  8. </reference>
  9. </catalog_product_view>
  10.  
  11. class <Company>_<Name>_Block_Catalog_Product_Callfunction extends Mage_Catalog_Block_Product_View
  12. {
  13. public function getCallfunction($product){
  14. // return json
  15. }
  16. }
  17.  
  18. <?php $_product = Mage::registry('current_product') ?>
  19. <script type="text/javascript">
  20. <?php echo $this->getCallfunction($_product); ?>
  21. </script>
  22.  
  23. <?xml version="1.0"?>
  24. <layout version="0.1.0">
  25. <catalog_product_view >
  26. <reference name="content">
  27. <block type="custommodule/custommodule" name="myscript" template="catalog/product/myscript.phtml"/>
  28. </reference>
  29. </catalog_product_view>
  30. </layout>
  31.  
  32. <?php
  33. if(Mage::registry('current_product')){
  34. <script type="text/javascript">
  35. <?php echo $this->getCallfunction((Mage::registry('current_product')); ?>
  36. </script>
  37. }
  38. ?>
  39.  
  40. <?xml version="1.0"?>
  41. <config>
  42. <modules>
  43. <Amit_Custommodule>
  44. <codePool>community</codePool>
  45. <active>true</active>
  46. </Amit_Custommodule>
  47. </modules>
  48. </config>
  49.  
  50. <?xml version="1.0" ?>
  51. <config>
  52. <modules>
  53. <Amit_Custommodule>
  54. <version>1.0.0</version>
  55. </Amit_Custommodule>
  56. </modules>
  57. <global>
  58. <!-- start of block -->
  59. <blocks>
  60. <custommodule>
  61. <class>Amit_Custommodule_Block</class>
  62. </custommodule>
  63. </blocks>
  64. </global>
  65.  
  66. </config>
  67.  
  68. <?php
  69. class Amit_Custommodule_Block_Custommodule extends Mage_Catalog_Block_Product_View{
  70.  
  71. public function callfunction($product){
  72. $arr=array(
  73. 'name'=> $product->getName(),
  74. 'sku' =>$product->getSku(),
  75. );
  76. json_encode($arr);
  77.  
  78. }
  79. }
  80.  
  81. <script type="text/javascript">
  82. var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
  83. </script>
Add Comment
Please, Sign In to add comment