PageRenderTime 57ms CodeModel.GetById 30ms RepoModel.GetById 1ms app.codeStats 0ms

/wpsc-admin/includes/settings-tabs/marketing.php

https://github.com/wp-e-commerce/WP-e-Commerce
PHP | 210 lines | 189 code | 21 blank | 0 comment | 10 complexity | b6bababd520918b6cf76980cc1a51be1 MD5 | raw file
  1. <?php
  2. class WPSC_Settings_Tab_Marketing extends WPSC_Settings_Tab {
  3. public function __construct() {
  4. add_action( 'admin_notices', array( $this, 'yoast_check' ) );
  5. }
  6. public function yoast_check() {
  7. $yoast_options = get_option( 'Yoast_Google_Analytics' );
  8. $wpec_tracking = isset( $yoast_options['wpec_tracking'] ) && $yoast_options['wpec_tracking'] ? true : false;
  9. if ( $wpec_tracking ) {
  10. ?>
  11. <div class="error">
  12. <p><?php _e( '<strong>You appear to have Google Analytics for WordPress installed.</strong>. <br /> This is not a problem, however, you also appear to have the WPeC tracking enabled. We highly recommend disabling that setting and using the settings on this page.', 'wp-e-commerce' ); ?></p>
  13. </div>
  14. <?php
  15. }
  16. }
  17. public function display() {
  18. $this->marketing_settings_form();
  19. $this->rss_address_settings_form();
  20. $this->google_merch_center_settings_form();
  21. $this->google_analytics_integration_settings_form();
  22. }
  23. public function marketing_settings_form() {
  24. $wpsc_also_bought = get_option( 'wpsc_also_bought' );
  25. $wpsc_also_bought1 = '';
  26. if ( '1' == $wpsc_also_bought )
  27. $wpsc_also_bought1 = "checked='checked'";
  28. $wpsc_share_this = get_option( 'wpsc_share_this' );
  29. $wpsc_share_this1 = '';
  30. if ( '1' == $wpsc_share_this )
  31. $wpsc_share_this1 = "checked='checked'";
  32. $facebook_like = get_option( 'wpsc_facebook_like' );
  33. $facebook_like1 = '';
  34. if ( 'on' == $facebook_like )
  35. $facebook_like1 = "checked='checked'";
  36. $display_find_us = get_option( 'display_find_us' );
  37. $display_find_us1 = '';
  38. if ( '1' == $display_find_us )
  39. $display_find_us1 = "checked='checked'";
  40. ?>
  41. <h3><?php esc_html_e( 'Marketing Settings', 'wp-e-commerce'); ?></h3>
  42. <table class='form-table'>
  43. <tr>
  44. <th>
  45. <?php esc_html_e( "'Users who bought this also bought'", 'wp-e-commerce' ); ?>
  46. </th>
  47. <td>
  48. <label>
  49. <input <?php echo $wpsc_also_bought1; ?> type='checkbox' name='wpsc_also_bought' />
  50. <?php esc_html_e( "Add 'Users who bought this also bought' item to the single products page.", 'wp-e-commerce' ); ?>
  51. </label>
  52. </td>
  53. </tr>
  54. <tr>
  55. <th>
  56. <?php esc_html_e( "'Share This' Social Bookmarks", 'wp-e-commerce' ); ?>
  57. </th>
  58. <td>
  59. <label>
  60. <input <?php echo $wpsc_share_this1; ?> type='checkbox' name='wpsc_share_this' />
  61. <?php esc_html_e( 'Add the \'Share this link\' item to the single products page.', 'wp-e-commerce' ); ?>
  62. </label>
  63. </td>
  64. </tr>
  65. <tr>
  66. <th>
  67. <?php esc_html_e( "'How Customer Found Us' Survey", 'wp-e-commerce' ) ?>
  68. </th>
  69. <td>
  70. <label>
  71. <input <?php echo $display_find_us1; ?> type='checkbox' name='display_find_us' />
  72. <?php esc_html_e( 'Add the \'How did you find out about us\' drop-down option at checkout.', 'wp-e-commerce' ); ?>
  73. </label>
  74. </td>
  75. </tr>
  76. <tr>
  77. <th>
  78. <?php esc_html_e( "Facebook 'Like' Button", 'wp-e-commerce' ) ?>
  79. </th>
  80. <td>
  81. <input type='hidden' value='0' name='wpsc_options[wpsc_facebook_like]' />
  82. <input <?php echo $facebook_like1; ?> type='checkbox' name='wpsc_options[wpsc_facebook_like]' />
  83. <?php esc_html_e( 'Add the Facebook Like button on your single products page.', 'wp-e-commerce' ); ?>
  84. </td>
  85. </tr>
  86. </table>
  87. <?php
  88. }
  89. public function rss_address_settings_form() {
  90. ?>
  91. <h3><?php esc_html_e( 'Product RSS Address', 'wp-e-commerce'); ?></h3>
  92. <p><?php esc_html_e( 'People can use this RSS feed to keep up to date with your product list.', 'wp-e-commerce' ); ?></p>
  93. <table class='form-table'>
  94. <tr>
  95. <th>
  96. <?php esc_html_e( 'RSS Feed Address', 'wp-e-commerce' ); ?>
  97. </th>
  98. <td>
  99. <?php $rss_url = add_query_arg( array( 'rss' => 'true', 'action' => 'product_list' ), home_url( '/' ) ); ?>
  100. <a href="<?php echo esc_url( $rss_url ); ?>"><code><?php echo esc_url( $rss_url ); ?></code></a>
  101. </td>
  102. </tr>
  103. </table>
  104. <?php
  105. }
  106. public function google_merch_center_settings_form() {
  107. ?>
  108. <h3><?php esc_html_e( 'Google Merchant Centre / Google Product Search', 'wp-e-commerce'); ?></h3>
  109. <p><?php printf( __( 'To import your products into <a href="%s" target="_blank">Google Merchant Centre</a> so that they appear within Google Product Search results, sign up for a Google Merchant Centre account and add a scheduled data feed with the following URL:', 'wp-e-commerce' ), 'http://www.google.com/merchants/' ); ?></p>
  110. <table class='form-table'>
  111. <tr>
  112. <th>
  113. <?php esc_html_e( 'Google Product Feed', 'wp-e-commerce' ); ?>
  114. </th>
  115. <td>
  116. <?php $google_feed_url = add_query_arg( array( 'rss' => 'true', 'action' => 'product_list', 'xmlformat' => 'google' ), home_url( '/' ) ); ?>
  117. <a href="<?php echo esc_url( $google_feed_url ); ?>"><code><?php echo esc_url( $google_feed_url ); ?></code></a>
  118. </td>
  119. </tr>
  120. </table>
  121. <?php
  122. }
  123. public function google_analytics_integration_settings_form() {
  124. ?>
  125. <h3><?php esc_html_e( 'Google Analytics E-Commerce Tracking', 'wp-e-commerce' ); ?></h3>
  126. <p><?php printf( __( 'Track successful transactions and items purchased in <a href="%s">Google Analytics</a>.', 'wp-e-commerce' ), 'http://www.google.com/analytics/' ); ?></p>
  127. <input type='hidden' name='change-settings' value='true' />
  128. <table class='form-table'>
  129. <tr>
  130. <th>
  131. <?php _e( 'Enable', 'wp-e-commerce' ); ?>
  132. </th>
  133. <td>
  134. <label>
  135. <input value='1' type='hidden' name='wpsc_ga_disable_tracking' />
  136. <input value='0' <?php checked( '0', get_option( 'wpsc_ga_disable_tracking' ) ); ?> type='checkbox' name='wpsc_ga_disable_tracking' />
  137. <?php _e( 'Enable Google Analytics tracking', 'wp-e-commerce' ); ?>
  138. </label>
  139. <p class='description'><?php _e( 'If, for whatever reason, you decide you do not want any tracking, disable it.', 'wp-e-commerce' ); ?></p>
  140. </td>
  141. </tr>
  142. <tr>
  143. <th>
  144. <?php _ex( 'Google Analytics Tracking ID', 'google analytics', 'wp-e-commerce' ); ?>
  145. </th>
  146. <td>
  147. <input value="<?php echo esc_attr( get_option( 'wpsc_ga_tracking_id' ) ); ?>" type='text' name='wpsc_ga_tracking_id' />
  148. <span class='description'><?php _e( 'e.g. <code>UA-XXXXX-Y</code>', 'wp-e-commerce' ); ?></span>
  149. </td>
  150. </tr>
  151. <tr>
  152. <th>
  153. <?php _e( 'Universal Analytics', 'wp-e-commerce' ); ?>
  154. </th>
  155. <td>
  156. <label>
  157. <input value="1" <?php checked( '1', get_option( 'wpsc_ga_use_universal' ) ); ?> type="checkbox" name="wpsc_ga_use_universal" />
  158. <?php printf( __( 'Use <a%s>Universal Analytics</a> tracking code', 'wp-e-commerce' ), ' href="https://support.google.com/analytics/answer/2790010?hl=en-GB&ref_topic=6010376" target="universal_analytics"' ); ?>
  159. </label>
  160. </td>
  161. </tr>
  162. <tr>
  163. <th>
  164. <?php _e( 'Tracking Code Present', 'wp-e-commerce' ); ?>
  165. </th>
  166. <td>
  167. <label>
  168. <input value='1' <?php checked( '1', get_option( 'wpsc_ga_currently_tracking' ) ); ?> type='checkbox' name='wpsc_ga_currently_tracking' />
  169. <?php _e( 'Google Analytics is tracking my site', 'wp-e-commerce' ); ?>
  170. </label>
  171. <p class='description'><?php printf( __( 'Enable this if the Google Analytics tracking code is already present on your site, e.g. manually placed in your theme, or managed by another plugin. We will only insert the <a href="%s">E-Commerce tracking events</a> on the transaction results page.', 'wp-e-commerce' ), 'https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEcommerce'); ?></p>
  172. </td>
  173. </tr>
  174. <tr>
  175. <th>
  176. <?php _e( 'Advanced Mode', 'wp-e-commerce' ); ?>
  177. </th>
  178. <td>
  179. <label>
  180. <input value='1' <?php checked( '1', get_option( 'wpsc_ga_advanced' ) ); ?> type='checkbox' name='wpsc_ga_advanced' />
  181. <?php _e( 'Enable Advanced Mode', 'wp-e-commerce' ); ?>
  182. </label>
  183. <p class='description'><?php _e( 'By default, we insert the multiple-domain asynchronous tracking code. This should be fine for 99% of users. If you need to fine-tune it, select the Advanced option. Then, instead of simply entering your tracking ID, you will enter the tracking code from Google Analytics into the header.php file of your theme.', 'wp-e-commerce' ); ?></p>
  184. </td>
  185. </tr>
  186. </table>
  187. <?php
  188. }
  189. }