Ejemplo n.º 1
0
 public function vtwpr_get_product_catalog_price_do_convert($price, $product_id = null, $variation = null)
 {
     global $post, $vtwpr_info;
     vtwpr_debug_options();
     //v1.0.3
     //mwntest
     //echo '001a in price_do_convert' .'<br>';
     $product_id_passed_into_function = $product_id;
     //if we are processing a variation, always get and pass the PARENT ID
     if ($post->ID > ' ') {
         $product_id = $post->ID;
     }
     if (get_post_field('post_parent', $product_id)) {
         $product_id = get_post_field('post_parent', $product_id);
     }
     vtwpr_get_product_session_info($product_id, $price);
     //were we passed a Variation ID to start with??
     if ($product_id_passed_into_function != $product_id && $product_id_passed_into_function > ' ') {
         //mwntest
         //echo '001a above recompute_discount price' .'<br>';
         vtwpr_recompute_discount_price($product_id_passed_into_function, $price);
     }
     if ($vtwpr_info['product_session_info']['product_yousave_total_amt'] > 0) {
         //v1.0.3  replaced 'product_discount_price' with 'product_yousave_total_amt' to pick up a FREE discount
         return $vtwpr_info['product_session_info']['product_discount_price'];
     } else {
         return $price;
     }
 }
Ejemplo n.º 2
0
 public function vtwpr_controller_init()
 {
     global $vtwpr_setup_options;
     //$product->get_rating_count() odd error at checkout... woocommerce/templates/single-product-reviews.php on line 20
     //  (Fatal error: Call to a member function get_rating_count() on a non-object)
     global $product;
     //Split off for AJAX add-to-cart, etc for Class resources.  Loads for is_Admin and true INIT loads are kept here.
     //require_once ( VTWPR_DIRNAME . '/core/vtwpr-load-execution-resources.php' );
     load_plugin_textdomain('vtwpr', null, dirname(plugin_basename(__FILE__)) . '/languages');
     require_once VTWPR_DIRNAME . '/core/vtwpr-backbone.php';
     require_once VTWPR_DIRNAME . '/core/vtwpr-rules-classes.php';
     require_once VTWPR_DIRNAME . '/admin/vtwpr-rules-ui-framework.php';
     require_once VTWPR_DIRNAME . '/woo-integration/vtwpr-parent-functions.php';
     require_once VTWPR_DIRNAME . '/woo-integration/vtwpr-parent-theme-functions.php';
     require_once VTWPR_DIRNAME . '/woo-integration/vtwpr-parent-cart-validation.php';
     require_once VTWPR_DIRNAME . '/woo-integration/vtwpr-parent-definitions.php';
     require_once VTWPR_DIRNAME . '/core/vtwpr-cart-classes.php';
     //************
     //changed for AJAX add-to-cart, removed the is_admin around these resources => didn't work, for whatever reason...
     if (defined('VTWPR_PRO_DIRNAME')) {
         require_once VTWPR_PRO_DIRNAME . '/core/vtwpr-apply-rules.php';
         //    require_once  ( VTWPR_PRO_DIRNAME . '/woo-integration/vtwpr-lifetime-functions.php' );
     } else {
         require_once VTWPR_DIRNAME . '/core/vtwpr-apply-rules.php';
     }
     $vtwpr_setup_options = get_option('vtwpr_setup_options');
     //put the setup_options into the global namespace
     vtwpr_debug_options();
     //v1.0.5
     /*  **********************************
             Set GMT time zone for Store 
         Since Web Host can be on a different
         continent, with a different *Day* and Time,
         than the actual store.  Needed for Begin/end date processing
         **********************************  */
     vtwpr_set_selected_timezone();
     if (is_admin()) {
         add_filter('plugin_action_links_' . VTWPR_PLUGIN_SLUG, array($this, 'vtwpr_custom_action_links'));
         require_once VTWPR_DIRNAME . '/admin/vtwpr-setup-options.php';
         require_once VTWPR_DIRNAME . '/admin/vtwpr-rules-ui.php';
         if (defined('VTWPR_PRO_DIRNAME')) {
             require_once VTWPR_PRO_DIRNAME . '/admin/vtwpr-rules-update.php';
             //          require_once ( VTWPR_PRO_DIRNAME . '/woo-integration/vtwpr-lifetime-functions.php' );
         } else {
             require_once VTWPR_DIRNAME . '/admin/vtwpr-rules-update.php';
         }
         require_once VTWPR_DIRNAME . '/admin/vtwpr-show-help-functions.php';
         require_once VTWPR_DIRNAME . '/admin/vtwpr-checkbox-classes.php';
         require_once VTWPR_DIRNAME . '/admin/vtwpr-rules-delete.php';
         $this->vtwpr_admin_init();
         //always check if the manually created coupon codes are there - if not create them.
         // vtwpr_woo_maybe_create_coupon_types();
         //v1.0.3 begin
         if (defined('VTWPR_PRO_DIRNAME') && version_compare(VTWPR_PRO_VERSION, VTWPR_MINIMUM_PRO_VERSION) < 0) {
             //'<0' = 1st value is lower
             add_action('admin_notices', array(&$this, 'vtwpr_admin_notice_version_mismatch'));
         }
         //v1.0.3 begin
     } else {
         //  add_action( "wp_enqueue_scripts", array(&$this, 'vtwpr_enqueue_frontend_scripts'), 1 );    //priority 1 to run 1st, so front-end-css can be overridden by another file with a dependancy
     }
     if (is_admin()) {
         /*
         //LIFETIME logid cleanup...
         //  LogID logic from wpsc-admin/init.php
         if(defined('VTWPR_PRO_DIRNAME')) {
           switch( true ) {
             case ( isset( $_REQUEST['wpsc_admin_action2'] ) && ($_REQUEST['wpsc_admin_action2'] == 'purchlog_bulk_modify') )  :
                    vtwpr_maybe_lifetime_log_bulk_modify();
                break; 
             case ( isset( $_REQUEST['wpsc_admin_action'] ) && ($_REQUEST['wpsc_admin_action'] == 'delete_purchlog') ) :
                    vtwpr_maybe_lifetime_log_roll_out_cntl();
                break;                                             
           } 
             
           if (version_compare(VTWPR_PRO_VERSION, VTWPR_MINIMUM_PRO_VERSION) < 0) {    //'<0' = 1st value is lower  
             add_action( 'admin_notices',array(&$this, 'vtwpr_admin_notice_version_mismatch') );            
           }          
         }
         
         //****************************************
         //INSIST that coupons be enabled in woo, in order for this plugin to work!!
         //****************************************
         $coupons_enabled = get_option( 'woocommerce_enable_coupons' ) == 'no' ? false : true;
         if (!$coupons_enabled) {  
           add_action( 'admin_notices',array(&$this, 'vtwpr_admin_notice_coupon_enable_required') );            
         }  
         */
     }
     return;
 }