Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.62 KB | None | 0 0
  1. <?php
  2. /**
  3. * Copyright © 2015 Magento. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6.  
  7. // @codingStandardsIgnoreFile
  8.  
  9. ?>
  10. <?php
  11. $_helper = $this->helper('SmartwavePortoHelperData');
  12.  
  13. $popup = $_helper->getConfig('porto_settings/newsletter');
  14. if($popup['enable']) {
  15.  
  16. $delay = $popup["delay"];
  17. ?>
  18. if ($screenWidth >1600) {
  19.  
  20. <script type="text/javascript">
  21. require([
  22. 'jquery',
  23. 'jquery/jquery.cookie'
  24. ], function ($) {
  25. $(document).ready(function(){
  26. <?php if($popup['enable'] == 1): ?>
  27. if($("body").hasClass("cms-index-index")) {
  28. <?php endif; ?>
  29. var check_cookie = $.cookie('newsletter_popup');
  30. if(window.location!=window.parent.location){
  31. $('#newsletter_popup').remove();
  32. } else {
  33. if(check_cookie == null || check_cookie == 'shown') {
  34. setTimeout(function(){
  35. beginNewsletterForm();
  36. }, <?php echo $delay; ?>);
  37. }
  38. /* if($.cookie('newsletter_popup') == 'dontshowitagain'){
  39. $('#newsletter_popup').hide();
  40. } else {*/
  41. $('#footer_newsletter').on('change', function(){
  42. if($(this).length){
  43. var check_cookie = $.cookie('newsletter_popup');
  44. if(check_cookie == null || check_cookie == 'shown') {
  45. $.cookie('newsletter_popup','dontshowitagain');
  46. }
  47. else
  48. {
  49. $.cookie('newsletter_popup','shown');
  50. beginNewsletterForm();
  51. }
  52. } else {
  53. $.cookie('newsletter_popup','shown');
  54. }
  55. });
  56. $("close-button").click()
  57. {
  58. $.cookie('newsletter_popup','dontshowitagain');
  59. }
  60. // }
  61. }
  62. <?php if($popup['enable'] == 1): ?>
  63. }
  64. <?php endif; ?>
  65. });
  66.  
  67. function beginNewsletterForm() {
  68. $.fancybox({
  69. 'padding': '0px',
  70. 'autoScale': true,
  71. 'transitionIn': 'fade',
  72. 'transitionOut': 'fade',
  73. 'type': 'inline',
  74. 'href': '#newsletter_popup',
  75. 'onComplete': function() {
  76. $.cookie('newsletter_popup', 'shown');
  77. },
  78. 'tpl': {
  79. closeBtn: '<a id="close-button "title="Close" class="fancybox-item fancybox-close fancybox-newsletter-close" href="javascript:;"></a>'
  80. },
  81. 'helpers': {
  82. overlay: {
  83. locked: false
  84. }
  85. }
  86. });
  87. $('#newsletter_popup').trigger('click');
  88. }
  89. });
  90. </script>
  91. <style type="text/css">
  92. <?php
  93. if($popup["custom_style"]){
  94. echo $popup["custom_style"];
  95. }
  96. ?>
  97. #newsletter_popup
  98. {
  99. <?php
  100. if($popup["width"]){
  101. echo "width:".$popup["width"].";";
  102. }
  103. if($popup["height"]){
  104. echo "height:".$popup["height"].";";
  105. }
  106. if($popup["bg_color"]){
  107. echo "background-color:".$popup["bg_color"].";";
  108. }
  109.  
  110. if(isset($popup["bg_image"]) && $popup["bg_image"]){
  111. $folderName = SmartwavePortoModelConfigBackendImageNewsletterbg::UPLOAD_DIR;
  112. $path = $folderName . '/' . $popup["bg_image"];
  113. $imageUrl = $_helper->getBaseUrl() . $path;
  114. ?>
  115. background-image:url(<?php echo $imageUrl;?>);
  116. <?php
  117. }
  118. ?>
  119. }
  120. </style>
  121. <div class="newsletter" id="newsletter_popup" style="display: none;">
  122. <div class="block-content" >
  123. <?php
  124. if(isset($popup["logo_src"]) && $popup["logo_src"]){
  125. $folderName = SmartwavePortoModelConfigBackendImageNewsletterlogo::UPLOAD_DIR;
  126. $path = $folderName . '/' . $popup["logo_src"];
  127. $logoUrl = $_helper->getBaseUrl() . $path;
  128. ?>
  129. <img src="<?php echo $logoUrl; ?>" alt="" />
  130. <?php
  131. }
  132. ?>
  133. <?php echo $popup["content"]; ?>
  134. <form class="form subscribe"
  135. novalidate
  136. action="<?php echo $block->getFormActionUrl() ?>"
  137. method="post"
  138. data-mage-init='{"validation": {"errorClass": "mage-error"}}'
  139. id="newsletter-validate-detail">
  140. <!--
  141. <div class="field newsletter">
  142. <div class="control">
  143. <input name="email" type="email" id="footer_newsletter"
  144. data-validate="{required:true, 'validate-email':true}"/>
  145. </div>
  146. </div>
  147. <div class="actions">
  148. <button class="action subscribe primary" title="<?php echo __('Go') ?>" type="submit">
  149. <span><?php echo __('Go') ?></span>
  150.  
  151. </div> -->
  152. </form>
  153. <div class="subscribe-bottom">
  154. <input type="checkbox" value="dontshowitagain" id="newsletter_popup_dont_show_again" style="display: none;" />
  155. <!-- <label for="newsletter_popup_dont_show_again"><?php echo __("Don't show this popup again"); ?></label> -->
  156. </div>
  157. </div>
  158. </div>
  159. <?php
  160. }
  161.  
  162. ?>
  163.  
  164. $screenWidth = '<script type="text/javascript">document.write(screen.availWidth);</script>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement