Plugin Directory

Changeset 2298752


Ignore:
Timestamp:
05/05/2020 07:03:53 PM (6 years ago)
Author:
patternsinthecloud
Message:
  • Fixed: Updated to include the latest schedule-options.js file for the new Multi-Product page template support.
Location:
autoship-cloud/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • autoship-cloud/trunk/autoship.php

    r2298734 r2298752  
    44Plugin URI: https://autoship.cloud
    55Description: Autoship Cloud for WooCommerce
    6 Version: 2.0.5
     6Version: 2.0.6
    77Author: Patterns In the Cloud LLC
    88Author URI: https://qpilot.cloud
     
    1414*/
    1515
    16 define( 'Autoship_Version', '2.0.5' );
     16define( 'Autoship_Version', '2.0.6' );
    1717if ( ! defined( 'Autoship_Plugin_Dir' ) ) {
    1818    define( 'Autoship_Plugin_Dir', __DIR__ );
  • autoship-cloud/trunk/js/schedule-options.js

    r2298734 r2298752  
    157157       */
    158158
     159      // Toggle Price
     160      var togglePriceDisplay = function( $thisProduct, resetPrice ){
     161
     162        var priceInfo = priceData[ retrieveProductId( $thisProduct ) ];
     163
     164        if ( priceInfo != undefined )
     165        displayCustomPrice( $thisProduct, priceInfo.customized_price_enabled && !resetPrice ? priceInfo.autoship_price : priceInfo.original_price, priceInfo.original_price_selector );
     166
     167      }
     168
    159169      // Displays the Custom Autoship Price HTML
    160170      var displayCustomPrice = function ( $thisProduct, $priceHTML, $containerSelector ){
     
    170180      var selectDisplay = function( $thisProduct, $autoshipOptions ){
    171181
    172         if ( !selectFrequency( $thisProduct, $autoshipOptions ) )
    173         return;
    174 
     182        if ( selectFrequency( $thisProduct, $autoshipOptions ) )
    175183        $autoshipOptions.find(window.autoshipTemplateData.frequencyCls).addClass('active');
    176 
    177         var priceInfo = priceData[ retrieveProductId( $thisProduct ) ];
    178 
    179         if ( priceInfo != undefined && priceInfo.customized_price_enabled )
    180         displayCustomPrice( $thisProduct, priceInfo.autoship_price, priceInfo.original_price_selector );
    181184
    182185      };
     
    205208        $autoshipOptions.find(window.autoshipTemplateData.frequencyCls).removeClass('active');
    206209
    207         var priceInfo = priceData[ retrieveProductId( $thisProduct ) ];
    208 
    209         if ( priceInfo != undefined && priceInfo.customized_price_enabled )
    210         displayCustomPrice( $thisProduct, priceInfo.original_price, priceInfo.original_price_selector );
    211 
    212210      };
    213211
     
    270268
    271269        var $autoshipOptions = $( variationForm ).find(window.autoshipTemplateData.optionsCls);
    272         var $percentDiscount = $autoshipOptions.find(window.autoshipTemplateData.discountPriceCls);
    273         var $discountedPrice = $autoshipOptions.find(window.autoshipTemplateData.checkoutPriceCls);
    274270        var autoshipDataValues = autoshipData( variationId, variationForm );
    275271
    276272        if ( autoshipDataValues ){
     273
    277274          initAutoshipData( variationForm, autoshipDataValues );
    278275          setVariationId( variationForm, variationId );
     276
     277          // Retrigger the click on the yes to refresh html prices etc.
     278          var $autoshipYesRadio = $autoshipOptions.find( window.autoshipTemplateData.yesBtn );
     279          if ( $autoshipYesRadio.is(':checked') )
     280          $autoshipYesRadio.trigger('click');
     281
    279282        } else {
    280283          setVariationId( variationForm, 0 );
     
    326329          var $thisProduct              = findProduct( e.target );
    327330          var $autoshipOptions          = $thisProduct.find(window.autoshipTemplateData.optionsCls);
    328           selectDisplay( $thisProduct, $autoshipOptions ); });
     331          selectDisplay( $thisProduct, $autoshipOptions );
     332          togglePriceDisplay( $thisProduct, false );});
    329333        $autoshipOptions.find(window.autoshipTemplateData.noBtn).on( 'click' , function(e){
    330334          var $thisProduct              = findProduct( e.target );
    331335          var $autoshipOptions          = $thisProduct.find(window.autoshipTemplateData.optionsCls);
    332           selectHide( $thisProduct, $autoshipOptions ); });
     336          selectHide( $thisProduct, $autoshipOptions );
     337          togglePriceDisplay( $thisProduct, true ); });
    333338
    334339        $('body').on( 'reset_data', window.autoshipTemplateData.variationFormCls, function( e ){
     
    407412
    408413        // Toggle the labels
    409         toggleAutoshipLabels( $autoshipOptions, autoshipData.percent_discount !== 0 || autoshipData.recurring_percent_discount !== 0 );
     414        toggleAutoshipLabels( $autoshipOptions, autoshipData.show_discount_str );
    410415
    411416        $autoshipOptions.removeClass('hidden').removeClass('loading');
     
    443448      $autoshipYesRadio.trigger('click');
    444449
    445       $( $thisProduct ).trigger( "autoship_product_initialized", [ $thisProduct, $autoshipOptions, priceData, $autoshipNoRadio, $addToCartBtn ] );
    446 
    447450    })
    448451
  • autoship-cloud/trunk/readme.txt

    r2298734 r2298752  
    88WC tested up to: 4.0.1
    99Requires PHP: 5.6
    10 Stable tag: 2.0.5
     10Stable tag: 2.0.6
    1111License: GPLv2 or later
    1212License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    153153
    154154== Changelog ==
     155
     156= 2.0.6 - 2020-05-05 =
     157
     158* Fixed: Updated to include the latest schedule-options.js file for the new Multi-Product page template support.
    155159
    156160= 2.0.5 - 2020-05-05 =
  • autoship-cloud/trunk/src/products.php

    r2298734 r2298752  
    10101010    // The Percent Discount for Recurring Orders
    10111011    'recurring_percent_discount'      => $recurring_percent_discount,
     1012
     1013    // Toggles the Discount String on the Product Pages
     1014    'show_discount_str'               => $percent_discount || $recurring_percent_discount,
    10121015
    10131016    // If Add to Scheduled Order is endabled for the product
Note: See TracChangeset for help on using the changeset viewer.