WordPress.org

Plugin Directory

Changeset 1686745


Ignore:
Timestamp:
06/28/17 07:26:26 (4 months ago)
Author:
sormano
Message:

EDD Sale Price 1.0.3

Location:
edd-sale-price/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • edd-sale-price/trunk/edd-sale-price.php

    r1201483 r1686745  
    44 * Plugin URI:      http://jeroensormani.com 
    55 * Description:     Put your digital products on sale. 
    6  * Version:         1.0.2 
     6 * Version:         1.0.3 
    77 * Author:          Jeroen Sormani 
    8  * Author URI:      http://www.jeroensormani.com/ 
     8 * Author URI:      http://jeroensormani.com/ 
    99 * Text Domain:     edd-sale-price 
    1010 */ 
     
    3030     * @var string $version Plugin version number. 
    3131     */ 
    32     public $version = '1.0.2'; 
     32    public $version = '1.0.3'; 
    3333 
    3434 
  • edd-sale-price/trunk/includes/class-eddsp-sale-price.php

    r1166911 r1686745  
    5050     * @since 1.0.0 
    5151     * 
    52      * @param   double  $price          Regular price of the product. 
     52     * @param   float   $price          Regular price of the product. 
    5353     * @param   int     $download_id    ID of the download we're changing the price for. 
    54      * @return  double                  The new price, if the product is in sale this will be the sale price. 
     54     * @return  float                   The new price, if the product is in sale this will be the sale price. 
    5555     */ 
    5656    public function maybe_display_sale_price( $price, $download_id ) { 
     
    8282     * @param   array   $prices         Array of regular prices for a single product. 
    8383     * @param   int     $download_id    ID of the download we're changing the price for. 
    84      * @return  double                  Array of new prices, if the variant is in sale this will be the sale price. 
     84     * @return  float                   Array of new prices, if the variant is in sale this will be the sale price. 
    8585     */ 
    8686    public function maybe_display_variable_sale_prices( $prices, $download_id ) { 
     
    9191        endif; 
    9292 
    93         foreach ( $prices as $key => $price ) : 
    94  
    95             if ( isset( $price['sale_price'] ) && ! empty( $price['sale_price'] ) ) : 
    96                 $prices[ $key ]['regular_amount']   = $price['amount']; 
    97                 $prices[ $key ]['amount']           = $price['sale_price']; 
    98             endif; 
    99  
    100         endforeach; 
     93        if ( is_array( $prices ) ) : 
     94            foreach ( $prices as $key => $price ) : 
     95 
     96                if ( isset( $price['sale_price'] ) && ! empty( $price['sale_price'] ) ) : 
     97                    $prices[ $key ]['regular_amount'] = $price['amount']; 
     98                    $prices[ $key ]['amount']         = $price['sale_price']; 
     99                endif; 
     100 
     101            endforeach; 
     102        endif; 
    101103 
    102104        return $prices; 
     
    234236     * @since 1.0.0, EDD 2.4.0 
    235237     * 
    236      * @param   double  $price          Regular price of the product. 
     238     * @param   float   $price          Regular price of the product. 
    237239     * @param   int     $download_id    ID of the download we're changing the price for. 
    238      * @return  double                  The new price, if the product is in sale this will be the sale price. 
     240     * @return  float                   The new price, if the product is in sale this will be the sale price. 
    239241     */ 
    240242    public function checkout_maybe_display_sale_price( $label, $item_id, $options ) { 
     
    250252            $prices = $download->get_prices(); 
    251253            $regular_price  = isset( $prices[ $options['price_id'] ]['regular_amount'] ) ? $prices[ $options['price_id'] ]['regular_amount'] : $regular_price; 
    252             $sale_price     = $prices[ $options['price_id'] ]['sale_price']; 
     254            $sale_price     = isset( $prices[ $options['price_id'] ]['sale_price'] ) ? $prices[ $options['price_id'] ]['sale_price'] : ''; 
    253255        else : 
    254256            $sale_price = get_post_meta( $item_id, 'edd_sale_price', true ); 
  • edd-sale-price/trunk/readme.txt

    r1201482 r1686745  
    11=== EDD Sale Price === 
    22Contributors: sormano, shopplugins 
    3 Donate link: http://www.jeroensormani.com/donate/ 
    43Tags: edd, easy digital downloads, edd sale, easy digital downloads sale, edd sale price, easy digital downloads sale price, edd promotion, easy digital downloads promotion, edd promo, easy digital downloads promo, edd discount, easy digital downloads discount 
    5 Requires at least: 3.7 
    6 Tested up to: 4.2 
    7 Stable tag: 1.0.2 
     4Requires at least: 4.0 
     5Tested up to: 4.8 
     6Stable tag: 1.0.3 
    87License: GPLv3 or later 
    98License URI: http://www.gnu.org/licenses/gpl-3.0.html 
     
    4241The checkout is one of those places where we improved this. But due to a new change, it does require Easy Digital Downloads 2.3+ 
    4342 
     43= Can I display the regular price within the purchase button? = 
     44 
     45It is possible through a code snippet, though there are two things to consider: 
     461) The purchase button will become a lot bigger 
     472) Due to the way the buttons are loaded, you will see (for example) \<s\>$50<\/s\> for about half a second. The 's' tags are there for the strikethrough. Its not ideal, but unfortunately we don't have any control over this. 
     48 
     49If you'd like to activate this: `add_filter( 'eddsp_display_regular_price_text_buy_button', '__return_true' );` 
     50 
    4451== Screenshots == 
    4552 
     
    5259 
    5360== Changelog == 
     61 
     62= 1.0.3 - 28/06/2016 = 
     63 
     64* [Fix] - Notice caused on checkout pre-save of sale price fields 
     65* Bump tested up to version to WP 4.8 
    5466 
    5567= 1.0.2 - 18/07/2015 = 
Note: See TracChangeset for help on using the changeset viewer.