Plugin Directory

Changeset 930949


Ignore:
Timestamp:
06/12/2014 08:59:24 AM (12 years ago)
Author:
isikom
Message:

released version 0.7.3

Location:
woocommerce-sample
Files:
19 added
3 edited

Legend:

Unmodified
Added
Removed
  • woocommerce-sample/trunk/js/woocommerce-sample.js

    r886372 r930949  
    3030        }
    3131        return true;
     32        //alert("come la mettiamo?");
     33        //return false;
    3234    });
    3335});
  • woocommerce-sample/trunk/readme.txt

    r930112 r930949  
    44Requires at least: 3.5
    55Tested up to: 3.9.1
    6 Stable tag: 0.7.2
     6Stable tag: 0.7.3
    77License: GPLv2
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1313
    1414Plugin for Wordpress woocommerce that allow add to cart sample item of a certain products
     15
     16Compatibility with plugins:
     17
     18* Min/Max Quantities
     19* Measurement Price Calculator
    1520
    1621= GET INVOLVED =
     
    5661== Changelog ==
    5762
     63= 0.7.12 - 12/06/2014 =
     64* added button CSS filter to add custom style
     65* fix button for products with a variation
     66* added filter for Measurement Price Calculator plugin
     67
    5868= 0.7.2 - 11/06/2014 =
    5969* added meta info to the sample item ordered
  • woocommerce-sample/trunk/woocommerce-sample.php

    r930112 r930949  
    66 * Author: Michele Menciassi
    77 * Author URI: https://plus.google.com/+MicheleMenciassi
    8  * Version: 0.7.2
     8 * Version: 0.7.3
    99 * License: GPLv2 or later
    1010 */
     
    6060                add_filter('wc_min_max_quantity_group_of_quantity', array($this, 'group_of_quantity'), 10, 4 );         
    6161            }
     62
     63            // filter for Measurement Price Calculator plugin override overriding
     64            if (in_array('woocommerce-measurement-price-calculator/woocommerce-measurement-price-calculator.php', apply_filters('active_plugins', get_option('active_plugins')))) {
     65                add_filter('wc_measurement_price_calculator_add_to_cart_validation', array($this, 'measurement_price_calculator_add_to_cart_validation'), 10, 4 );
     66            }
     67
     68        }
     69
     70        function measurement_price_calculator_add_to_cart_validation ($valid, $product_id, $quantity, $measurements){
     71            global $woocommerce;
     72            $validation = $valid;
     73            if (get_post_meta($product_id, 'sample_enamble') && $_REQUEST['sample']){
     74                $woocommerce->session->set( 'wc_notices', null );
     75                $validation = true;
     76            }
     77            return $validation;
    6278        }
    6379
     
    347363                <form action="<?php echo esc_url( $product->add_to_cart_url() ); ?>" class="cart sample" method="post" enctype='multipart/form-data'>
    348364                <?php do_action('woocommerce_before_add_sample_to_cart_button'); ?>
    349                     <div class="single_variation_wrap" style="">             
    350                     <button type="submit" class="single_add_to_cart_button button alt single_add_sample_to_cart_button"><?php echo  __( 'Add Sample to cart', 'woosample' ); ?></button>
     365                    <div class="single_variation_wrap" style="">
     366                    <?php $btnclass = apply_filters('sample_button_class', "single_add_to_cart_button button alt single_add_sample_to_cart_button btn btn-default"); ?>
     367                    <button type="submit" class="<?php echo $btnclass; ?>"><?php echo  __( 'Add Sample to cart', 'woosample' ); ?></button>
    351368                    <input type="hidden" name="sample" id="sample" value="true"/>
     369                    <input type="hidden" name="add-to-cart" id="sample_add_to_cart" value="<?php echo $product->id; ?>">
    352370                    </div>
    353371                <?php do_action('woocommerce_after_add_sample_to_cart_button'); ?>
Note: See TracChangeset for help on using the changeset viewer.