Changeset 1270367
- Timestamp:
- 10/21/2015 02:15:40 PM (10 years ago)
- Location:
- category-related-products-for-ithemes-exchange/trunk
- Files:
-
- 5 edited
-
exchange-addon-category-related-products.php (modified) (3 diffs)
-
lib/functions.php (modified) (1 diff)
-
lib/hooks.php (modified) (5 diffs)
-
lib/settings.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
category-related-products-for-ithemes-exchange/trunk/exchange-addon-category-related-products.php
r1036807 r1270367 2 2 /* 3 3 * Plugin Name: iThemes Exchange - Category Related Products 4 * Version: 1.0. 14 * Version: 1.0.2 5 5 * Description: Display related products based on categories 6 6 * Plugin URI: http://tywayne.com 7 7 * Author: Ty Carlson 8 8 * Author URI: http://tywayne.com 9 * Text Domain: exchange-addon-category-related-products9 * Text Domain: category-related-products-for-ithemes-exchange 10 10 */ 11 11 … … 15 15 * @since 1.0.0 16 16 */ 17 define( 'IT_Exchange_Category_Related_Products_Version', '1.0. 1' );17 define( 'IT_Exchange_Category_Related_Products_Version', '1.0.2' ); 18 18 19 19 /** … … 26 26 function it_exchange_register_category_related_products_addon() { 27 27 $options = array( 28 'name' => __( 'Category Related Products', ' exchange-addon-category-related-products' ),29 'description' => __( 'Display related products based on iThemes Exchange product categories.', ' exchange-addon-category-related-products' ),28 'name' => __( 'Category Related Products', 'category-related-products-for-ithemes-exchange' ), 29 'description' => __( 'Display related products based on iThemes Exchange product categories.', 'category-related-products-for-ithemes-exchange' ), 30 30 'author' => 'Ty Carlson', 31 31 'author_url' => 'http://tywayne.com/', -
category-related-products-for-ithemes-exchange/trunk/lib/functions.php
r1036806 r1270367 15 15 function it_exchange_get_product_categories() { 16 16 // get the exchange product 17 global $post; 18 $exchange_product = it_exchange_get_product( $post->ID ); 17 $exchange_product = $GLOBALS['it_exchange']['product']; 19 18 20 19 // get terms for the it_exchange_category taxonomy -
category-related-products-for-ithemes-exchange/trunk/lib/hooks.php
r1036788 r1270367 29 29 so that we can exclude it from the related product list 30 30 */ 31 global $post; 32 $current_product_id = $post->ID; 31 $current_exchange_product = $GLOBALS['it_exchange']['product']; 33 32 34 33 // get the settings for display 35 34 $settings = it_exchange_get_option( 'category_related_products' ); 36 $count = $settings['count'];35 $count = !empty($settings['count']) ? $settings['count'] : '5'; 37 36 38 if ( $settings['width-int'] && $settings['width-unit']) {37 if ( !empty($settings['width-int']) && !empty($settings['width-unit']) ) { 39 38 $width = $settings['width-int'] . $settings['width-unit']; 40 39 } else { … … 47 46 'post_type' => 'it_exchange_prod', 48 47 'orderby' => 'rand', 49 'post__not_in' => array( $current_ product_id),48 'post__not_in' => array( $current_exchange_product->ID ), 50 49 'tax_query' => array( 51 50 array( … … 58 57 ); 59 58 60 $ the_query = new WP_Query( $args );59 $products = get_posts( $args ); 61 60 ?> 62 61 63 62 <?php // the loop for related products ?> 64 <?php if ( $the_query->have_posts() ) :?>63 <?php if ( !empty( $products ) ) { ?> 65 64 66 65 <?php // Heading above the related products list. The heading text is filterable with it_exchange_category_related_product_heading ?> 67 66 <?php do_action( 'it_exchange_category_related_product_before_heading' ); ?> 68 67 <h3 class="it-exchange-category-related-products-heading"> 69 <?php $heading = apply_filters( 'it_exchange_category_related_product_heading', __( 'Related Products', ' exchange-addon-category-related-products' ) ); ?>68 <?php $heading = apply_filters( 'it_exchange_category_related_product_heading', __( 'Related Products', 'category-related-products-for-ithemes-exchange' ) ); ?> 70 69 <?php echo $heading; ?> 71 70 </h3> … … 74 73 <?php do_action( 'it_exchange_category_related_product_before_product_list' ); ?> 75 74 <ul class="it-exchange-category-related-product-list"> 76 <?php while ( $the_query->have_posts() ) : $the_query->the_post();?>75 <?php foreach ( $products as $product ) { ?> 77 76 78 77 <?php // setup the exchange product so we have access to the API ?> 79 <?php $exchange_product = it_exchange_get_product( $p ost->ID ); ?>78 <?php $exchange_product = it_exchange_get_product( $product->ID ); ?> 80 79 <?php $GLOBALS['it_exchange']['product'] = $exchange_product; ?> 81 80 <li class="it-exchange-category-related-product <?php echo ( ! it_exchange( 'product', 'has-images' ) ) ? ' no-images' : 'has-images'; ?>" style="max-width:<?php echo $width; ?>"> … … 93 92 </li> 94 93 95 <?php endwhile;?>94 <?php } ?> 96 95 </ul> 97 96 <?php do_action( 'it_exchange_category_related_product_after_product_list' ); ?> 98 <?php wp_reset_postdata(); ?>99 <?php endif;?>97 <?php $GLOBALS['it_exchange']['product'] = $current_exchange_product; ?> 98 <?php } ?> 100 99 101 100 <?php -
category-related-products-for-ithemes-exchange/trunk/lib/settings.php
r1036788 r1270367 49 49 <div class="wrap"> 50 50 <?php ITUtility::screen_icon( 'it-exchange' ); ?> 51 <h2><?php _e( 'Category Related Products Settings', ' exchange-addon-category-related-products' ); ?></h2>51 <h2><?php _e( 'Category Related Products Settings', 'category-related-products-for-ithemes-exchange' ); ?></h2> 52 52 53 53 <?php do_action( 'it_exchange_category_related_products_settings_page_top' ); ?> … … 59 59 do_action( 'it_exchange_category_related_products_settings_form_top' ); 60 60 if ( ! empty( $_POST['__it-form-prefix'] ) && 'it-exchange-addon-category-related-products' == $_POST['__it-form-prefix'] ) 61 ITUtility::show_status_message( __( 'Options Saved', ' exchange-addon-category-related-products' ) );61 ITUtility::show_status_message( __( 'Options Saved', 'category-related-products-for-ithemes-exchange' ) ); 62 62 63 63 ?> … … 66 66 <tbody> 67 67 <tr valign="top"> 68 <th scope="row"><label for="category-related-products-count"><?php _e( 'Related Products Count', ' exchange-addon-category-related-products' ) ?></label></th>68 <th scope="row"><label for="category-related-products-count"><?php _e( 'Related Products Count', 'category-related-products-for-ithemes-exchange' ) ?></label></th> 69 69 <td> 70 70 <?php … … 78 78 79 79 <label for="category-related-products-count"> 80 <span class="description"><?php _e( 'How many related products would you like to display?', ' exchange-addon-category-related-products' ); ?></span>80 <span class="description"><?php _e( 'How many related products would you like to display?', 'category-related-products-for-ithemes-exchange' ); ?></span> 81 81 </label> 82 82 </td> 83 83 </tr> 84 84 <tr valign="top"> 85 <th scope="row"><label for="category-related-products-width"><?php _e( 'Related Product Width', ' exchange-addon-category-related-products' ) ?></label></th>85 <th scope="row"><label for="category-related-products-width"><?php _e( 'Related Product Width', 'category-related-products-for-ithemes-exchange' ) ?></label></th> 86 86 <td> 87 87 <?php … … 123 123 124 124 <label for="category-related-products-width"> 125 <span class="description"><?php _e( 'Width of each product in the related products list', ' exchange-addon-category-related-products' ); ?></span>125 <span class="description"><?php _e( 'Width of each product in the related products list', 'category-related-products-for-ithemes-exchange' ); ?></span> 126 126 </label> 127 127 </td> -
category-related-products-for-ithemes-exchange/trunk/readme.txt
r1217649 r1270367 3 3 Tags: iThemes Exchange, addon, ecommerce 4 4 Requires at least: 3.9 5 Tested up to: 4.3 6 Stable tag: 1.0. 15 Tested up to: 4.3.1 6 Stable tag: 1.0.2 7 7 License: GPLv2 or later 8 8 … … 30 30 == Changelog == 31 31 32 = 1.0.2 = 33 * Bugfix: resolve undefined index notices when options have not been saved yet 34 * Bugfix: better handling of querying exchange products so we don't mess up other queries 35 * Enhancement: Update text domain to match wp.org slug so it can be translated 36 32 37 = 1.0.1 = 33 38 * Removed php notice from front end do to undefined variable
Note: See TracChangeset
for help on using the changeset viewer.