Plugin Directory

Changeset 2796280


Ignore:
Timestamp:
10/09/2022 10:24:08 PM (3 years ago)
Author:
vark
Message:

Version: 2.0.3.2

Location:
pricing-deals-for-woocommerce/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • pricing-deals-for-woocommerce/trunk/admin/vtprd-license-options.php

    r2791573 r2796280  
    187187          // works in conjunction with new PRO plugin update message on the plugins page, using after-nag logic
    188188
    189           if ( ($vtprd_license_options['pro_plugin_version_status'] == 'Pro Version Error') &&
    190                ($vtprd_license_options['status'] == 'valid') && //v1.1.8.2
    191                ($vtprd_license_options['state']  == 'active') ) { //v1.1.8.2
    192             //FULL message for rego screen
    193             $message  =  '<strong>Pro Plugin  ** Update Required ** </strong>' ;
    194             $message .=  "<span style='color:grey !important;'><em>&nbsp;&nbsp;&nbsp; (pro plugin will not discount until updated)</em></span>" ;
    195            
    196             $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Your Pro Version = ' .$vtprd_license_options['pro_version'] .'&nbsp;&nbsp;<strong> Required Pro Version = '  .VTPRD_MINIMUM_PRO_VERSION .'</strong>';
    197 
    198             //v1.1.8.2 begin
    199             $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;<em>** Only MANUAL updates are available **</em>'; //v1.1.8.2   
    200             /* //v2.0.3
    201             if ($vtprd_license_options['prod_or_test'] == 'test') {
    202               $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;<em>In a TEST environment, only MANUAL updates are available:</em>'; //v1.1.8.2                               
    203             } else {
    204               $message .=  '<br><br>&nbsp;&nbsp; 1. &nbsp;&nbsp;<em>For Plugin update, CLICK HERE: </em>'; //v1.1.8.2
    205               //$message .=  '&nbsp;&nbsp;<a style="text-decoration: underline;font-size:18px;" href="'.esc_url(VTPRD_ADMIN_URL).'edit.php?post_type=vtprd-rule&page=vtprd_license_options_page&action=force_plugin_updates_check">Check for Plugin Updates</a>'; //v1.1.8.2 - removed home_url, also bounces to license page, which then sets the transient and goes on to the plugins page.
    206               $message .=  '<br><br>&nbsp;&nbsp; 2. &nbsp;&nbsp;<em>If no Plugin update is available, please update manually:</em>'; //v1.1.8.2
    207             }
    208             */
    209            
    210             //(1)
    211             $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;   <strong>1)   &nbsp;&nbsp;Log into the </strong>&nbsp; ';
    212             $homeURL = 'https://www.varktech.com/your-account/your-login/';
    213            
    214             $message .=  '<a target="_blank" href="' .esc_url($homeURL). '">Varktech.com - Your Login</a> &nbsp; page';         
    215            
    216 
    217             //(2)
    218             $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;   <strong>2)   &nbsp;&nbsp;Download the new PRO zip file version</strong>&nbsp; from ';
    219             $homeURL = 'https://www.varktech.com/checkout/purchase-history/';
    220                            
    221             $message .=  'your &nbsp;&nbsp;  <a target="_blank" href="' .esc_url($homeURL). '">Varktech.com - Purchase History</a> &nbsp; page &nbsp;&nbsp;  ';           
    222                        
    223            
    224             //(3)
    225             $homeURL1 = VTPRD_ADMIN_URL.'plugins.php';
    226             $homeURL2 = $this->vtprd_strip_out_http($homeURL1);
    227             $homeNAME = str_replace( '/wp-admin/plugins.php', '', $homeURL2  ?? '' );      //v2.0.3           
    228            
    229            
    230            
    231             $homeURL = VTPRD_ADMIN_URL.'plugin-install.php';
    232             $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;  <strong>3)   &nbsp;&nbsp;Go to your &nbsp; </strong>  <a target="_blank" href="' .esc_url($homeURL1). '">' .esc_textarea($homeNAME). ' - Plugins Page</a> , ';
    233             $message .=  '&nbsp; and use  &nbsp; <a target="_blank" href="' .esc_url($homeURL). '">Add New</a>';
    234             $message .=  '<strong>&nbsp; to upload and activate the new zip file </strong>' ;
    235                    
    236             $message .= '<span style="color:grey !important">';
    237            
    238             $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;&nbsp;In your website back end Plugins Page, &nbsp;&nbsp; delete the old version of the * Pro Plugin * <em>(no settings will be lost)</em>. ';
    239             $message .=  '<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;&nbsp;In your website back end ADD NEW Page,  &nbsp;&nbsp; UPload and Activate the Pro Plugin  &nbsp;&nbsp; <em>Using the new zip file downloaded from Varktech!</em> ';
    240             $message .=  '</strong>';
    241            
    242             $message .= '<br>&nbsp;';
    243             $message .= '</span>';
    244            
    245             //$message .=  "<span style='color:grey !important;'><br><br><em>&nbsp;&nbsp;&nbsp; (This message displays when the Pro version is installed, regardless of whether it's active)</em></span>" ;
    246            
    247             $admin_notices = '<div id="message" class="error fade" style="background-color: #FFEBE8 !important;"> <p style="font-size: 18px; !important;">' . $message . ' </p></div>';           
    248             //echo $admin_notices; //v2.0.3
     189          if ($vtprd_license_options['pro_plugin_version_status'] == 'Pro Version Error') {
     190          //v2.0.0a end                     
     191            $admin_notices = vtprd_full_pro_upd_msg(); //V2.0.0.1 MSG move to functions.php       
     192            $allowed_html = vtprd_get_allowed_html(); //v2.0.3
    249193            echo wp_kses($admin_notices ,$allowed_html ); //v2.0.3
     194            //v2.0.0 end
    250195          }
    251196   
     
    746691   
    747692     $url = esc_url( home_url() ); //SET URL     
    748      $url_no_http = $this->vtprd_strip_out_http($url); //v1.1.6.1
     693     $url_no_http = vtprd_strip_out_http($url); //v2.0.3.2 moved to functions.php
    749694     
    750695    //TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST v1.1.8.2
     
    16761621
    16771622
    1678 
     1623  //v2.0.3.2 moved to functions.php
     1624  /*
    16791625  //from http://stackoverflow.com/questions/15699101/get-client-ip-address-using-php
    16801626  public  function  vtprd_strip_out_http($url) {
     
    16891635      return $url;
    16901636  }
     1637  */
    16911638
    16921639
  • pricing-deals-for-woocommerce/trunk/core/vtprd-apply-rules.php

    r2791573 r2796280  
    9393
    9494      //error_log( print_r(  ' ', true ) );       
    95       //error_log( print_r(  'TOP OF CLASS VTPRD_Apply_Rules ', true ) );
     95       //error_log( print_r(  'TOP OF CLASS VTPRD_Apply_Rules ', true ) );
    9696      //error_log( print_r(  'REQUEST_URI= ' .$_SERVER["REQUEST_URI"], true ) );   
    9797   
     
    223223       //  when JUST a catalog discount was processed, CART still needs loading               
    224224       //Move parent cart contents to vtprd_cart
     225         //error_log( print_r(  'vtprd_load_vtprd_cart_for_processing - CART rule', true ) );
    225226        vtprd_load_vtprd_cart_for_processing();
    226227 
     
    538539         
    539540          //RELOAD vtprd_cart in this situation - it'll be because Catalog rules were just processed...
     541           //error_log( print_r(  'vtprd_load_vtprd_cart_for_processing - CART rule RELOAD', true ) );
    540542          vtprd_load_vtprd_cart_for_processing();
    541543         
  • pricing-deals-for-woocommerce/trunk/readme.txt

    r2795847 r2796280  
    55Requires at least: 3.3
    66Tested up to: 6.0.2
    7 Stable tag: 2.0.3.1
     7Stable tag: 2.0.3.2
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    422422
    423423== Changelog ==
     424
     425= 2.0.3.2 - 2022-10-08 =
     426* Fix - Cart deal discount type - by default supplies crossouts in the cart, checkout and emails.
     427        In rare cases, the crossout was not supplied. This fix repairs this issue.
     428* Enhancement  - Changed Pro update nag to have full message on plugins page
    424429
    425430
  • pricing-deals-for-woocommerce/trunk/vt-pricing-deals.php

    r2795847 r2796280  
    44Plugin URI: http://varktech.com
    55Description: A discounting e-commerce add-on for WooCommerce, php8.1+ compatible.   
    6 Version: 2.0.3.1
     6Version: 2.0.3.2
    77Author: Vark
    88Author URI: http://varktech.com
     
    6565    //v2.0.2.02 end
    6666   
    67     define('VTPRD_VERSION',                               '2.0.3.1');  //v2.0.3.1 no change, just for version control
     67    define('VTPRD_VERSION',                               '2.0.3.2');  //v2.0.3.2 fix for cart deal crossouts
    6868    define('VTPRD_MINIMUM_PRO_VERSION',                   '2.0.3');
    6969    define('VTPRD_LAST_UPDATE_DATE',                      '2022-10-05');
     
    14091409
    14101410      global $vtprd_license_options;
    1411    
     1411
    14121412      //$pageURL = $_SERVER["REQUEST_URI"];  //v2.0.3
    14131413      $pageURL =  sanitize_url($_SERVER["REQUEST_URI"]); //v2.0.3     
     
    14301430                return;
    14311431             break;                   
     1432         //v2.0.3.2 begin
     1433         case (strpos($pageURL,'plugins.php') !== false ):         
     1434                $admin_notices = vtprd_full_pro_upd_msg(); //V2.0.0.1 MSG move to functions.php       
     1435                $allowed_html = vtprd_get_allowed_html(); //v2.0.3
     1436                echo wp_kses($admin_notices ,$allowed_html ); //v2.0.3
     1437
     1438                return;
     1439             break;
     1440                             
    14321441        default:         
    1433             //v1.1.8.2 re-coded
    1434             //IF PROD, don't show on plugins page, there's already an update msg after the pro plugin entry!!
    1435            
    1436             //v2.0.3 begin       upload-plugin     
    1437             /*
    1438             if ( ($vtprd_license_options['prod_or_test'] == 'prod') &&
    1439                  (strpos($pageURL,'plugins.php') !== false ) ) {
    1440                 return;
    1441             }
    1442             */
    1443             //v2.0.3 end
    14441442           
    14451443            $message  =  '<strong>' . __('Update Required for: ' , 'vtprd') . ' &nbsp;&nbsp;'  .VTPRD_PRO_PLUGIN_NAME . '</strong>' ;
     
    14481446            $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . __('Your Pro Version = ' , 'vtprd') .$vtprd_license_options['pro_version'] .'&nbsp;&nbsp;&nbsp;&nbsp;<strong>' . __(' <em>Required</em> Pro Version = ' , 'vtprd') .VTPRD_MINIMUM_PRO_VERSION .'</strong>';
    14491447                         
    1450             //*****************
    1451             //v2.1.0 begin
    1452             //*****************
    1453             /*
    1454            
    1455             WITH THE UPDATE TO THE INMOTION SERVER, AUTO UPDATES FOR PRICING DEALS NO LONGER FUNCTION
    1456            
    1457             ALL UPDATES MUST NOW BE MANUAL.
    1458             */       
     1448            //ALL UPDATES MUST NOW BE MANUAL.
     1449               
    14591450              $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;&nbsp;<span style="font-size:16px;font-weight:bold;">' . __('Go to the '  , 'vtprd') .'&nbsp;&nbsp;';
    1460               $homeURL = VTPRD_ADMIN_URL.'edit.php?post_type=vtprd-rule&page=vtprd_license_options_page';
    1461               $message .=  '<a href="'.esc_url($homeURL).'">Register Pro License Page</a> For Instructions</span>' ;
    1462             /*
    1463             if ($vtprd_license_options['prod_or_test'] == 'test') {
    1464               $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;<em>' . __('In a TEST environment, only MANUAL updates are available:'  , 'vtprd') .'</em>'; //v1.1.8.2           
    1465               $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;&nbsp;' . __('Go to the '  , 'vtprd') .'&nbsp;&nbsp;';
    1466               $message .=  '<a href="'.VTPRD_ADMIN_URL.'edit.php?post_type=vtprd-rule&page=vtprd_license_options_page">Register Pro License Page</a> For Instructions' ;               
    1467             } else {
    1468               $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . __('CLICK HERE: '  , 'vtprd') .'&nbsp;&nbsp;';
    1469               $message .=  '<a style="text-decoration: underline;font-size:16px;"  href="'.VTPRD_ADMIN_URL.'edit.php?post_type=vtprd-rule&page=vtprd_license_options_page&action=force_plugin_updates_check"><strong>' . __('Check for Plugin Updates', 'vtprd'). '</strong></a>'; //v1.1.8.2 - bounces to license page, which then sets the transient and goes on to the plugins page.                                             
    1470             }
    1471             */             
    1472             //v2.1.0 END             
     1451              $homeURL = VTPRD_ADMIN_URL.'plugins.php?plugin_status=all&paged=1&s';            //v2.0.0.a updated
     1452              $message .=  '<a href="'.esc_url($homeURL).'">Plugins Page</a> For Instructions</span>' ;              //v2.0.0.a updated
     1453           
     1454            //v2.0.3.2 END             
    14731455          break;     
    14741456      }
     
    15251507            */
    15261508           
    1527               $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;&nbsp;' . __('Go to the '  , 'vtprd') .'&nbsp;&nbsp;';
    1528               $homeURL = VTPRD_ADMIN_URL.'edit.php?post_type=vtprd-rule&page=vtprd_license_options_page';
    1529               $message .=  '<a href="'.esc_url($homeURL).'">Register Pro License Page</a> For Instructions' ;             
     1509              $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;&nbsp;' . __('See Plugin update instructions above'  , 'vtmin') .'&nbsp;&nbsp;';   //v2.0.3.2           
    15301510               
    15311511            /*
  • pricing-deals-for-woocommerce/trunk/woo-integration/vtprd-parent-cart-validation.php

    r2791573 r2796280  
    20932093                   error_log( print_r(  ' ', true ) );
    20942094                   error_log( print_r(  'Function begin - vtprd_maybe_cart_item_subtotal, $subtotal= ' .$subtotal. $on_cart_Page.' $cart_item_key= ' .$cart_item_key, true ) );
     2095                   error_log( print_r(  ' vtprd_orig_cart_price_ = ' .$_SESSION['vtprd_orig_cart_price_'.$cart_item_key]. ' for item_key= ' .$cart_item_key , true ) );
     2096                   error_log( print_r(  ' vtprd_orig_cart_price_with_taxation_ = ' .$_SESSION['vtprd_orig_cart_price_with_taxation_'.$cart_item_key] . ' for item_key= ' .$cart_item_key , true ) ); 
    20952097                   */
    2096              
    2097                //error_log( print_r(  ' vtprd_orig_cart_price_ = ' .$_SESSION['vtprd_orig_cart_price_'.$cart_item_key. ' for item_key= ' .$cart_item_key , true ) );
    2098               //error_log( print_r(  ' vtprd_orig_cart_price_with_taxation_ = ' .$_SESSION['vtprd_orig_cart_price_with_taxation_'.$cart_item_key . ' for item_key= ' .$cart_item_key , true ) ); 
    20992098   
    21002099    global $post, $vtprd_info, $vtprd_setup_options, $woocommerce, $vtprd_cart;
     
    21092108     
    21102109        //error_log( print_r(  ' ', true ) );
    2111         //error_log( print_r(  '$_SESSION array=', true ) );     
    2112         //error_log( var_export($_SESSION, true ) );
     2110         //error_log( print_r(  '$_SESSION array=', true ) );     
     2111         //error_log( var_export($_SESSION, true ) );
    21132112        //error_log( print_r(  ' ', true ) );
    21142113        //error_log( print_r(  '$cart_item array=', true ) );     
     
    21222121         (sanitize_text_field($_SESSION['do_no_actions'])) ) {
    21232122      session_write_close(); //v2.0.2.02
    2124       return $subtotal;   
     2123                //error_log( print_r(  'Function vtprd_maybe_cart_item_subtotal, exit001,  $subtotal= ' .$subtotal , true ) );
     2124      return $subtotal;   
    21252125        }
    21262126      //v1.1.1 end
     
    21882188        remove_filter('woocommerce_cart_item_subtotal', array( &$this, 'vtprd_maybe_cart_item_subtotal' )); //v2.0.0 g solution                 
    21892189        session_write_close(); //v2.0.2.02
    2190         return $subtotal;       
     2190                        //error_log( print_r(  'Function vtprd_maybe_cart_item_subtotal, exit002,  $subtotal= ' .$subtotal , true ) );
     2191        return $subtotal;       
    21912192    }
    21922193
     
    22002201    //******
    22012202
    2202     //if ( $page_id == get_option ( "woocommerce_cart_page_id" ) ) { //v1.1.0.7
    2203     $cart_page = get_option ( "woocommerce_cart_page_id" );    //v1.1.0.7
    2204     if ( is_page($cart_page)) { //v1.1.0.7     
    2205       session_write_close(); //v2.0.2.02
    2206       return $subtotal;   
    2207     }
    2208         /*
    2209         //v2.0.3 begin
    2210         //once in a great while, this is all gone, and the crossouts don't work.
    2211         switch( TRUE ) {
    2212            
    2213            case ( (isset ($_SESSION['vtprd_orig_cart_price_with_taxation_'.$cart_item_key])) &&
    2214                    (sanitize_text_field($_SESSION['vtprd_orig_cart_price_with_taxation_'.$cart_item_key] > 0)) ) :
    2215                  $get_unit_price = false;
    2216               break;
    2217            
    2218            case ( (isset ($_SESSION['vtprd_orig_cart_price_'.$cart_item_key])) &&
    2219                    (sanitize_text_field($_SESSION['vtprd_orig_cart_price_'.$cart_item_key] > 0)) ) :
    2220                  $get_unit_price = false;
    2221               break;
     2203    //v2.0.3.2 begin -  removed
     2204    /*
     2205      $cart_page = get_option ( "woocommerce_cart_page_id" );    //v1.1.0.7
     2206      if ( is_page($cart_page)) { //v1.1.0.7     
     2207        session_write_close(); //v2.0.2.02
     2208                        //error_log( print_r(  'Function vtprd_maybe_cart_item_subtotal, exit003,  $subtotal= ' .$subtotal , true ) );
     2209      return $subtotal;   
     2210      }
     2211    */
     2212    //v2.0.3.2 end
     2213   
     2214      //*************
     2215      //v2.0.3.2 begin
     2216      //once in a great while, this is all gone, and the crossouts don't work.
     2217      switch ( TRUE ) {
     2218         
     2219         case ( (isset ($_SESSION['vtprd_orig_cart_price_with_taxation_'.$cart_item_key])) &&
     2220                 (sanitize_text_field($_SESSION['vtprd_orig_cart_price_with_taxation_'.$cart_item_key] > 0)) ) :
     2221
     2222                $oldprice_subtotal = wc_price( sanitize_text_field($_SESSION['vtprd_orig_cart_price_with_taxation_'.$cart_item_key] * $cart_item['quantity']) );
     2223               
     2224                $_SESSION['vtprd_orig_cart_price_subtotal_for_order_crossouts_'.$product_id] = $oldprice_subtotal; //CANNOT be accessed by Addon and Calculator products
     2225               
     2226                  //error_log( print_r(  'vtprd_oldprice_subtotal_with_taxation = ' .$oldprice_subtotal .'$product_id= ' .$product_id, true ) );
     2227                               
     2228                //v1.1.0.8 begin
     2229                // do not display duplicate price in crossout  (on checkout page, if discount coupon removed)
     2230                if ($oldprice_subtotal != $subtotal) {
     2231                    //error_log( print_r(  '<del> 003', true ) );
     2232                  $subtotal = '<del>' . $oldprice_subtotal  . '</del> &nbsp; <ins>' . $subtotal . '</ins>';
     2233                }
     2234               
     2235            break;
     2236         
     2237         case ( (isset ($_SESSION['vtprd_orig_cart_price_'.$cart_item_key])) &&
     2238                 (sanitize_text_field($_SESSION['vtprd_orig_cart_price_'.$cart_item_key] > 0)) ) :
    22222239             
    2223            default:
    2224                  $get_unit_price = true;
    2225               break;             
    2226                            
    2227         }
    2228         */
    2229 
    2230             /*
    2231                //v2.1.0 new
    2232               $oldprice =  vtprd_get_taxation_price_cart($vtprd_cart_item->product_id, $vtprd_cart_item->unit_price); //v2.1.0
    2233               $_SESSION['vtprd_orig_cart_price_with_taxation_'.$vtprd_cart_item->cart_item_key] = $oldprice;  //v2.1.0 used in subtotal crossout display   
     2240              $oldprice_subtotal = wc_price( sanitize_text_field($_SESSION['vtprd_orig_cart_price_'.$cart_item_key] * $cart_item['quantity']) );
    22342241             
    2235               error_log( print_r(  ' vtprd_orig_cart_price_ = ' .$vtprd_cart_item->unit_price. ' for item_key= ' .$vtprd_cart_item->cart_item_key , true ) );
    2236               error_log( print_r(  ' vtprd_orig_cart_price_with_taxation_ = ' .$oldprice. ' for item_key= ' .$vtprd_cart_item->cart_item_key , true ) );     
    2237 
    2238             */
    2239    
    2240   //error_log( print_r(  '$subtotal before the IF = ' .$subtotal, true ) );
    2241      
    2242       if (isset ($_SESSION['vtprd_orig_cart_price_with_taxation_'.$cart_item_key])) {
    2243 
    2244         $oldprice_subtotal = wc_price( sanitize_text_field($_SESSION['vtprd_orig_cart_price_with_taxation_'.$cart_item_key] * $cart_item['quantity']) );
    2245        
    2246         $_SESSION['vtprd_orig_cart_price_subtotal_for_order_crossouts_'.$product_id] = $oldprice_subtotal; //CANNOT be accessed by Addon and Calculator products
    2247        
    2248         //error_log( print_r(  'vtprd_oldprice_subtotal_with_taxation = ' .$oldprice_subtotal .'$product_id= ' .$product_id, true ) );
    2249                        
    2250         //v1.1.0.8 begin
    2251         // do not display duplicate price in crossout  (on checkout page, if discount coupon removed)
    2252         if ($oldprice_subtotal != $subtotal) {
    2253           //error_log( print_r(  '<del> 003', true ) );
    2254           $subtotal = '<del>' . $oldprice_subtotal  . '</del> &nbsp; <ins>' . $subtotal . '</ins>';
    2255         }
    2256       }
    2257       //v2.0.2.02 c - begin  ELSE STRUCTURE
    2258      // crossout when session variable not stored
    2259         else {
    2260        
    2261       //error_log( print_r(  '$subtotal after ELSE = ' .$subtotal, true ) );
    2262         if (isset($_SESSION['vtprd_orig_cart_price_'.$cart_item_key] ) ) {  //v2.0.3
    2263           $oldprice_subtotal = wc_price( sanitize_text_field($_SESSION['vtprd_orig_cart_price_'.$cart_item_key] * $cart_item['quantity']) );
    2264          
    2265           $_SESSION['vtprd_orig_cart_price_subtotal_for_order_crossouts_'.$product_id] = $oldprice_subtotal; //even though this may not have taxation, subtotal is stored here to be picked up later in existing logic.
    2266          
    2267           //error_log( print_r(  'vtprd_oldprice_subtotal_with_taxation = ' .$oldprice_subtotal .'$product_id= ' .$product_id, true ) );
     2242              $_SESSION['vtprd_orig_cart_price_subtotal_for_order_crossouts_'.$product_id] = $oldprice_subtotal; //even though this may not have taxation, subtotal is stored here to be picked up later in existing logic.
     2243             
     2244                //error_log( print_r(  'vtprd_oldprice_subtotal_with_taxation = ' .$oldprice_subtotal .'$product_id= ' .$product_id, true ) );
     2245                     
     2246              if ($oldprice_subtotal != $subtotal) {
    22682247                 
    2269           if ($oldprice_subtotal != $subtotal) {
    2270              
    2271             $subtotal = '<del>' . $oldprice_subtotal  . '</del> &nbsp; <ins>' . $subtotal . '</ins>';
    2272           //error_log( print_r(  'subtotal with crossout 002= ' .$subtotal, true ) );
    2273           }
    2274         }       
    2275      }
    2276      
    2277      //*****************************
    2278      //v2.0.3 begin
    2279      //*****************************
    2280      //the checkout crossout 'old' pricing was not showing the correct taxation setting... 
    2281      if ( (isset($_SESSION['vtprd_product_session_info_'.$product_id])) &&
    2282          (vtprd_sanitize_text_or_array_field($_SESSION['vtprd_product_session_info_'.$product_id]))  ) {    //v2.0.3 added line for sanitize_text 
    2283 
    2284          $vtprd_product_session_info = vtprd_sanitize_text_or_array_field($_SESSION['vtprd_product_session_info_'.$product_id]);
     2248                $subtotal = '<del>' . $oldprice_subtotal  . '</del> &nbsp; <ins>' . $subtotal . '</ins>';
     2249                //error_log( print_r(  'subtotal with crossout 002= ' .$subtotal, true ) );
     2250              }
     2251            break;
    22852252           
    2286             //error_log( var_export($vtprd_product_session_info, true ) );
    2287             //error_log( print_r(  ' ', true ) );
    2288            
    2289          if ( ($vtprd_product_session_info['product_discount_price_excl_tax_woo'] > 0) &&          // > 0 added to solve 0 oldprice issue, as session_info will occasionaly have 0 values
    2290               ($vtprd_product_session_info['product_discount_price_incl_tax_woo'] > 0) ) {            // > 0 added to solve 0 oldprice issue
    2291        
    2292            
    2293             //error_log( print_r(  ' ', true ) );
    2294             //error_log( print_r(  'setting the product_session_info, for $product_id= ' .$product_id, true ) );
    2295             //error_log( print_r(  '$vtprd_info product_session_info array=', true ) );     
    2296 
    2297            
    2298              if ( ( get_option( 'woocommerce_calc_taxes' ) == 'no' ) ||
    2299                   ( get_option('woocommerce_tax_display_cart')   == 'excl') ||
    2300                   ( vtprd_maybe_customer_tax_exempt() ) ) {     
    2301                 $_SESSION['vtprd_orig_cart_price_subtotal_for_order_crossouts_'.$product_id] =
    2302                        wc_price( $vtprd_product_session_info['product_discount_price_excl_tax_woo']  * $cart_item['quantity']);
    2303                //error_log( print_r(  'excluding taxes set', true ) );
    2304              } else {
    2305                 $_SESSION['vtprd_orig_cart_price_subtotal_for_order_crossouts_'.$product_id] =
    2306                        wc_price( $vtprd_product_session_info['product_discount_price_incl_tax_woo']  * $cart_item['quantity']);
    2307                //error_log( print_r(  'including taxes set', true ) );                               
    2308              }
    2309          }     
    2310      }   
    2311      //v2.0.3 end
    2312      //*****************************
     2253         default:
     2254               //create the session variable from $vtprd_cart values -
     2255               //loop through $vtprd_cart to find the correct item
     2256                foreach($vtprd_cart->cart_items as $vtprd_key => $vtprd_cart_item) {     
     2257                  if ($vtprd_cart_item->cart_item_key == $cart_item_key ) { //v1.1.1
     2258                    $_SESSION['vtprd_orig_cart_price_with_taxation_'.$cart_item_key] =  $vtprd_cart_item->product_orig_cart_unit_price;
     2259                    //$_SESSION['vtprd_orig_cart_price_'.$cart_item_key]               =  $vtprd_cart_item->product_id
     2260                    break;  //break out of foreach           
     2261                  }
     2262                }
     2263                //same as 1st case (above) from here on out
     2264                if ( (isset ($_SESSION['vtprd_orig_cart_price_with_taxation_'.$cart_item_key])) &&
     2265                     (sanitize_text_field($_SESSION['vtprd_orig_cart_price_with_taxation_'.$cart_item_key] > 0)) ) {
     2266                 
     2267                    $oldprice_subtotal = wc_price( sanitize_text_field($_SESSION['vtprd_orig_cart_price_with_taxation_'.$cart_item_key] * $cart_item['quantity']) );
     2268                   
     2269                    $_SESSION['vtprd_orig_cart_price_subtotal_for_order_crossouts_'.$product_id] = $oldprice_subtotal; //CANNOT be accessed by Addon and Calculator products
     2270                   
     2271                      //error_log( print_r(  'vtprd_oldprice_subtotal_with_taxation = ' .$oldprice_subtotal .'$product_id= ' .$product_id, true ) );
     2272                                   
     2273                    //v1.1.0.8 begin
     2274                    // do not display duplicate price in crossout  (on checkout page, if discount coupon removed)
     2275                    if ($oldprice_subtotal != $subtotal) {
     2276                        //error_log( print_r(  '<del> 003', true ) );
     2277                      $subtotal = '<del>' . $oldprice_subtotal  . '</del> &nbsp; <ins>' . $subtotal . '</ins>';
     2278                    }               
     2279                }                   
     2280            break;                         
     2281      }
     2282
     2283     //v2.0.3.2 end
     2284     //*************
    23132285     
    23142286     
    23152287     //$crossout = $_SESSION['vtprd_orig_cart_price_subtotal_for_order_crossouts_'.$product_id];
    2316      //error_log( print_r(  'vtprd_oldprice_subtotal_for_order_crossouts FINAL VALUE = ' .$crossout. ' $product_id= ' .$product_id , true ) );
     2288        //error_log( print_r(  'vtprd_oldprice_subtotal_for_order_crossouts FINAL VALUE = ' .$crossout. ' $product_id= ' .$product_id , true ) );
    23172289
    23182290
     
    23292301     
    23302302  }
    2331 
     2303 
     2304 
    23322305  //**************************************
    23332306    /*
     
    23652338    vtprd_set_transient_cart_data ( 'session_data_by_ip', $serialized_session, $vtprd_info['purchaser_ip_address'] );
    23662339   
    2367     //error_log( print_r(  'vtprd_set_session_transient_with_ip_key, ip= ' .$vtprd_info['purchaser_ip_address'], true ) );
     2340       //error_log( print_r(  'vtprd_set_session_transient_with_ip_key, ip= ' .$vtprd_info['purchaser_ip_address'], true ) );
    23682341   
    23692342    session_write_close(); //v2.0.2.02
     
    24772450    //v1.1.1 refactored
    24782451    //pick up the previously stored crossout info
     2452   
     2453
    24792454    if (isset($_SESSION['vtprd_orig_cart_price_subtotal_for_order_crossouts_'.$product_id]) ) {     
    24802455      $oldprice = wp_kses($_SESSION['vtprd_orig_cart_price_subtotal_for_order_crossouts_'.$product_id] ,$allowed_html ); //v2.0.3 - this field contains HTML, so uses wp_kses
     
    51485123    //  moved HERE so that abandoned carts are avoided in lifetime info
    51495124   
    5150     //test test test
    51515125    //global $vtprd_rules_set;
    51525126    //error_log( print_r(  'RULESET Just Before vtprd_save_lifetime_purchase_info, $log_id= ' .$log_id, true ) );
     
    54535427        $data_chain      = unserialize($data_chain);
    54545428     
    5455        //v2.0.2.0 begin
     5429       //v2.0.2.0 begin TEST
    54565430      /*     
    5457       //test test test
    54585431      if ($data_chain) {
    54595432        $data_chain_found = true;
     
    58335806       } //end if ($cart_id)
    58345807       
    5835        //test test test
    58365808       //vtprd_set_transient_cart_data ( 'customer_id_for_cart_id', 'key to key lookup' );  // UPDATES INFO TO CURRENT - track relationship between CURRENT Unique_id AND customer_id
    58375809
  • pricing-deals-for-woocommerce/trunk/woo-integration/vtprd-parent-functions.php

    r2791573 r2796280  
    1010      global $post, $wpdb, $woocommerce, $vtprd_cart, $vtprd_cart_item, $vtprd_setup_options, $vtprd_info;
    1111 
    12   //error_log( print_r(  ' ', true ) );   
    13   //error_log( print_r(  'BEGIN vtprd_load_vtprd_cart_for_processing', true ) );
     12   //error_log( print_r(  ' ', true ) );   
     13   //error_log( print_r(  'BEGIN vtprd_load_vtprd_cart_for_processing', true ) );
    1414
    1515     // from Woocommerce/templates/cart/mini-cart.php  and  Woocommerce/templates/checkout/review-order.php
     
    430430              $_SESSION['vtprd_orig_cart_price_with_taxation_'.$vtprd_cart_item->cart_item_key] = $oldprice;  //v2.1.0 used in subtotal crossout display   
    431431             
    432               //error_log( print_r(  ' vtprd_orig_cart_price_ = ' .$vtprd_cart_item->unit_price. ' for item_key= ' .$vtprd_cart_item->cart_item_key , true ) );
    433               //error_log( print_r(  ' vtprd_orig_cart_price_with_taxation_ = ' .$oldprice. ' for item_key= ' .$vtprd_cart_item->cart_item_key , true ) );         
     432               //error_log( print_r(  ' vtprd_orig_cart_price_ = ' .$vtprd_cart_item->unit_price. ' for item_key= ' .$vtprd_cart_item->cart_item_key , true ) );
     433               //error_log( print_r(  ' vtprd_orig_cart_price_with_taxation_ = ' .$oldprice. ' for item_key= ' .$vtprd_cart_item->cart_item_key , true ) );         
    434434
    435435             
     
    67526752        //v2.0.3 end
    67536753     
    6754         //test test
     6754
    67556755        //$transient_cart = $wpdb->get_row( "SELECT * FROM `" . VTPRD_TRANSIENT_CART_DATA . "` WHERE   `cart_id` = '" . $cart_id . "'  AND   `transient_data_type` = '" . $transient_data_type . "'  LIMIT 1", ARRAY_A );   
    67566756        //error_log( print_r(  'vtprd_set_transient_cart_data - transient_cart at SET', true ) );       
     
    68196819        ); 
    68206820        //v2.0.3 end
    6821         //test test
     6821
    68226822        //$transient_cart = $wpdb->get_row( "SELECT * FROM `" . VTPRD_TRANSIENT_CART_DATA . "` WHERE   `cart_id` = '" . $cart_id . "'  AND   `transient_data_type` = '" . $transient_data_type . "'  LIMIT 1", ARRAY_A );   
    68236823        //error_log( print_r(  'vtprd_set_unqiue_transient_customer_id_for_cart_id - transient_cart at SET - ', true ) );       
     
    76347634  } 
    76357635   
     7636  //************************* 
     7637  //v2.0.3.2 new function
     7638  //*************************
     7639  //from http://stackoverflow.com/questions/15699101/get-client-ip-address-using-php
     7640  function  vtprd_full_pro_upd_msg() {
     7641 
     7642      global $vtprd_license_options; 
     7643
     7644      //FULL message for rego screen
     7645      $message  =  '<strong>' . __('Pro Plugin  ** Update Required ** ' , 'vtprd') .'</strong>' ;
     7646      $message .=  "<span style='color:grey !important;'><em>&nbsp;&nbsp;&nbsp; (pro plugin will not discount until updated)</em></span>" ;
     7647     
     7648      $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . __('Your Pro Version = ' , 'vtprd') .$vtprd_license_options['pro_version'] .'&nbsp;&nbsp;<strong>' . __(' Required Pro Version = ' , 'vtprd') .VTPRD_MINIMUM_PRO_VERSION .'</strong>';
     7649     
     7650      //v2.0.0 begin     
     7651     
     7652      //(1)
     7653      $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;   <strong>1)   &nbsp;&nbsp;Log into the </strong>&nbsp; ';
     7654      $homeURL = 'https://www.varktech.com/your-account/your-login/';
     7655     
     7656      $message .=  '<a target="_blank" href="' .esc_url($homeURL). '">Varktech.com - Your Login</a> &nbsp; page';         
     7657     
     7658
     7659      //(2)
     7660      $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;   <strong>2)   &nbsp;&nbsp;Download the new PRO zip file version</strong>&nbsp; from ';
     7661      $homeURL = 'https://www.varktech.com/checkout/purchase-history/';
     7662                     
     7663      $message .=  'your &nbsp;&nbsp;  <a target="_blank" href="' .esc_url($homeURL). '">Varktech.com - Purchase History</a> &nbsp; page &nbsp;&nbsp;  ';           
     7664                 
     7665     
     7666      //(3)
     7667      $homeURL1 = VTPRD_ADMIN_URL.'plugins.php';
     7668      $homeURL2 = vtprd_strip_out_http($homeURL1);
     7669      $homeNAME = str_replace( '/wp-admin/plugins.php', '', $homeURL2  ?? '' );      //v2.0.3           
     7670     
     7671     
     7672     
     7673      $homeURL = VTPRD_ADMIN_URL.'plugin-install.php';
     7674      $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;  <strong>3)   &nbsp;&nbsp;Go to your &nbsp; </strong>  <a target="_blank" href="' .esc_url($homeURL1). '">' .esc_textarea($homeNAME). ' - Plugins Page</a> , ';
     7675      $message .=  '&nbsp; and use  &nbsp; <a target="_blank" href="' .esc_url($homeURL). '">Add New</a>';
     7676      $message .=  '<strong>&nbsp; to upload and activate the new zip file </strong>' ;
     7677             
     7678      $message .= '<span style="color:grey !important">';
     7679     
     7680      $message .=  '<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;&nbsp;In your website back end Plugins Page, &nbsp;&nbsp; delete the old version of the * Pro Plugin * as needed <em>(no settings will be lost)</em>. ';
     7681      $message .=  '<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;&nbsp;In your website back end ADD NEW Page,  &nbsp;&nbsp; UPload and Activate the Pro Plugin  &nbsp;&nbsp; <em>Using the new zip file downloaded from Varktech!</em> ';
     7682      $message .=  "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;&nbsp;Apple Mac Users Users: &nbsp;&nbsp;  Macs often unzip files during download.   &nbsp;&nbsp;  <em> If the folder is delivered unzipped, you'll need to rezip the folder.</em> ";   //v2.0.0a   
     7683      $message .=  '</strong>';
     7684     
     7685      $message .= '<br>&nbsp;';
     7686      $message .= '</span>';
     7687     
     7688      //$message .=  "<span style='color:grey !important;'><br><br><em>&nbsp;&nbsp;&nbsp; (This message displays when the Pro version is installed, regardless of whether it's active)</em></span>" ;
     7689     
     7690      $admin_notices = '<div id="message" class="error fade" style="background-color: #FFEBE8 !important;"> <p style="font-size: 18px; !important;">' . $message . ' </p></div>';   
     7691      return $admin_notices;
     7692  }
     7693   
     7694  //*************************
     7695  //v2.0.3.2 moved here
     7696  //*************************
     7697  //from http://stackoverflow.com/questions/15699101/get-client-ip-address-using-php
     7698  function  vtprd_strip_out_http($url) {
     7699      $url = str_replace( 'https://', '', $url   ?? '' ); //v2.0.0
     7700      $url = str_replace( 'http://', '', $url   ?? '' ); //v2.0.0
     7701      $url = rtrim($url, "/" ); //remove trailing slash
     7702      //$url = str_replace( 'www.', '', $url  ) ; //v1.1.8.2 strip out WWW
     7703      return $url;
     7704  }
     7705
    76367706 
    76377707   //*************************
Note: See TracChangeset for help on using the changeset viewer.