Plugin Directory

Changeset 2139157


Ignore:
Timestamp:
08/13/2019 10:36:09 PM (7 years ago)
Author:
subscribility
Message:

Release 2.9.5

Location:
subscribility
Files:
12 edited
17 copied

Legend:

Unmodified
Added
Removed
  • subscribility/tags/2.9.5/includes/admin/controllers/class-wp99234-admin-settings-data-collection.php

    r2069102 r2139157  
    9595          'id'       => 'wp99234_product_sync',
    9696          'css'      => 'min-width:550px;',
    97           'default'  => '',
     97          'default'  => 'both',
    9898          'type'     => 'select',
    9999          'desc_tip' => true,
  • subscribility/tags/2.9.5/includes/admin/controllers/class-wp99234-admin.php

    r2048715 r2139157  
    4646        add_action('woocommerce_product_options_general_product_data', array($this,'show_pack_prices'));
    4747        add_action('woocommerce_product_options_general_product_data', array($this,'show_member_prices'));
     48
     49        /* Customize Product Tags Labels */
     50        add_filter( 'woocommerce_taxonomy_args_product_tag', array($this, 'custom_wc_taxonomy_args_product_tag') );
    4851       
    4952        $this->admin_notices();
     
    632635      echo '</div>';
    633636    }
     637
     638    /**
     639     * Display custom message for product tag
     640     */
     641    function custom_wc_taxonomy_args_product_tag( $args ) {
     642        // Get the Products data synchronisation option
     643        $wp99234_product_sync_option = get_option('wp99234_product_sync', 'both');
     644
     645        $tag_notice = 'You can remove Troly tags from the list below, however, these tags will still be present in Troly.';
     646
     647        if (in_array($wp99234_product_sync_option, array('both', 'push'))) {
     648            $tag_notice = 'You will not be able to remove Troly tags from the list below without disabling them in Troly first.';
     649        }
     650        $args['label'] = __( 'Product Tags', 'woocommerce' );
     651        $args['labels'] = array(
     652            'separate_items_with_commas' => __( "<p>$tag_notice</p><i>Separate tags with commas</i>", 'woocommerce' ),
     653        );
     654
     655        return $args;
     656    }
    634657}
    635658
  • subscribility/tags/2.9.5/includes/frontend/controllers/class-wp99234-products.php

    r2068621 r2139157  
    88    define( 'WP99234_TAG_VISIBLE'     , 105 );
    99    define( 'WP99234_TAG_OUT_OF_STOCK', 108 );
     10    define( 'WP99234_VARIETY_VIRTUAL', 'virtual' );
    1011
    1112/**
     
    445446
    446447     // Array format: (WP attribute name => SUBS attribute name)
    447     function product_meta_map(){
    448 
     448    function product_meta_map()
     449    {
    449450        return array(
    450451            'subs_id'      => 'id',
     
    453454            'foods'        => 'foods',
    454455            'cellar_until' => 'cellar_until',
    455             //'price'        => 'price',
    456456            'price_case'   => 'price_case',
    457457            'price_6pk'    => 'price_6pk',
     
    473473            '_te_divider'  => 'te_divider',
    474474            '_split_ols'   => 'split_ols',
    475             //'product_prices'  => 'product_prices',
    476             //'_subproducts' => 'subproducts',
    477             '_variety'      => 'variety',
     475            '_variety'      => 'variety', // default to 'wine'
    478476            'is_composite'  => 'is_composite' // Used to indicate if pack or not
    479477        );
    480 
    481478    }
    482479
     
    570567        update_post_meta( $product_id, '_regular_price' , $price             );
    571568        update_post_meta( $product_id, '_is_split'      , $product->is_split );
     569
     570        // Set Product as Virtual
     571        // see: https://wordpress.stackexchange.com/questions/137501/how-to-add-product-in-woocommerce-with-php-code
     572        if ( $product->variety === WP99234_VARIETY_VIRTUAL ) {
     573            update_post_meta( $product_id, '_virtual', 'yes');
     574        }
    572575
    573576        /**
     
    776779
    777780            foreach( $product->tags as $tag ){
     781                $product_biz_attributes = get_option('product_biz_attributes', array());
     782
     783                // create slug for the current tag
     784                $slug = sanitize_title($tag->name);
     785
     786                // check and set unique attribute
     787                $is_attribute = array_search($slug, $product_biz_attributes);
     788                if ( !$is_attribute ) {
     789                    $new_tag[$slug] = (array)$tag;
     790                    $product_biz_attributes = array_merge($product_biz_attributes, $new_tag);
     791
     792                    // Save Troly tag ids as option
     793                    update_option('product_biz_attributes', $product_biz_attributes, true);
     794                }
    778795
    779796                $term = get_term_by( 'name', $tag->name, $this->tag_taxonomy_name );
     
    10751092        if( $update ){
    10761093            // Get the Products data synchronisation option
    1077             $wp99234_product_sync_option = get_option('wp99234_product_sync');
     1094            $wp99234_product_sync_option = get_option('wp99234_product_sync', 'both');
    10781095
    10791096            // Only export to `both` and `push` synchronisation
     
    11361153        );
    11371154
     1155        /**
     1156         * Add Product business attribute
     1157         */
     1158        $post_tags = get_the_terms( $product_id, 'product_tag' );
     1159        $product_biz_attributes = get_option('product_biz_attributes', array());
     1160
     1161        if (!empty($post_tags)) {
     1162            $product_biz_tag_ids = array();
     1163            $product_biz_tags = array();
     1164
     1165            foreach ($post_tags as $tag) {
     1166                $slug = sanitize_title($tag->name);
     1167                $this_tag = $product_biz_attributes[$slug];
     1168                $product_biz_tag_ids[] = $this_tag['id'];
     1169                $product_biz_tags[] = $this_tag;
     1170            }
     1171
     1172            $data['tag_ids'] = $product_biz_tag_ids;
     1173            $data['tags'] = $product_biz_tags;
     1174        }
    11381175
    11391176        /**
  • subscribility/tags/2.9.5/includes/frontend/controllers/class-wp99234-wc-filter.php

    r2128705 r2139157  
    484484        $customer_data = array(
    485485            'customer' => array(
    486             'fname' => $order->get_billing_first_name(),
    487             'lname' => $order->get_billing_last_name(),
    488             'email' => $order->get_billing_email(),
    489             'phone' => $order->get_billing_phone(),
    490             'company_name' => $order->get_billing_company(),
    491             'delivery_address' => $order->get_billing_address_1(),
    492             'delivery_suburb' => $order->get_billing_city(),
    493             'delivery_postcode' => $order->get_billing_postcode(),
    494             'delivery_state' => $order->get_billing_state(),
    495             'delivery_country' => WC()->countries->countries[ $order->get_billing_country() ],
    496             'notify_shipments' => '@|mail'
    497           )
     486                'fname' => $order->get_billing_first_name(),
     487                'lname' => $order->get_billing_last_name(),
     488                'email' => $order->get_billing_email(),
     489                'phone' => $order->get_billing_phone(),
     490                'company_name' => $order->get_billing_company(),
     491                'delivery_address' => $order->get_billing_address_1(),
     492                'delivery_suburb' => $order->get_billing_city(),
     493                'delivery_postcode' => $order->get_billing_postcode(),
     494                'delivery_state' => $order->get_billing_state(),
     495                'delivery_country' => WC()->countries->countries[ $order->get_billing_country() ],
     496                'notify_shipments' => '@|mail'
     497              )
    498498        );
    499499       
     
    550550      $shipping = array_values($order->get_shipping_methods());
    551551      $shipping_method = $shipping ? explode(":", $shipping[0]->get_method_id())[0] : null;
     552      // $shipping_cost = $shipping ? explode(":", $shipping[0]->get_total())[0] : null;
    552553
    553554      if($shipping_method == 'local_pickup'){
     
    581582          )
    582583        );
    583       }     
     584
     585        if ($shipping_method == 'free_shipping') {
     586            $order_data['shipments']['shipping_fee_override'] = 0;
     587        }
     588      }
    584589       
    585590      $message .= '\nGetting orderlines for the order';   
     
    603608   
    604609      $message .= '\nExporting order to Troly';
    605    
    606610     
    607611        // If we were editing an order
  • subscribility/tags/2.9.5/includes/frontend/views/newsletter_form.php

    r2068621 r2139157  
    2525
    2626    <div class="woocommerce">
    27         <?php if ( !is_admin() ) { wc_print_notices(); } ?>
     27        <?php if ( !is_admin() ) { if ( function_exists('wc_print_notices') ) { wc_print_notices(); } } ?>
    2828    </div>
    2929
  • subscribility/tags/2.9.5/includes/frontend/views/registration_form.php

    r2102935 r2139157  
    4646        border:1px solid #000;
    4747        float:left;
    48         background-color: #F9F9F9;
     48
     49        /* Make text readable inverse background */
     50        background-color: transparent;
     51        box-shadow: inset 0 0 5px #888888;
     52
    4953        padding:20px;
    5054        margin-bottom:4%;
     
    5256        width: 100%;
    5357        position: relative;
     58    }
     59
     60    /* Emphasize input fields to inverse background */
     61    .wp99234-input_field_text, #subs_birthday,
     62    .wp99234-input_field_password,
     63    .wp99234-input_field_textfield,
     64    .wp99234-section.cc_details input[type="text"],
     65    .wp99234-section.cc_details input[type="tel"] {
     66        border-bottom: 1px solid gray;
    5467    }
    5568   
     
    178191 
    179192    <div class="woocommerce wp99234_registration_notices">
    180         <?php if ( !is_admin() ) { wc_print_notices(); } ?>
     193        <?php if ( !is_admin() ) { if ( function_exists('wc_print_notices') ) { wc_print_notices(); } } ?>
    181194    </div>
    182195
  • subscribility/tags/2.9.5/readme.txt

    r2128705 r2139157  
    7070
    7171## Changelog
     72###Version 2.9.5
     73- Make Club box options readable even in inverse background/theme color
     74- Set as Virtual product if set in Troly
     75
    7276###Version 2.9.4
    7377- Fixed Syncing User's account to Troly after Placing Order
  • subscribility/tags/2.9.5/wp99234.php

    r2128705 r2139157  
    44 * Plugin URI: https://wordpress.org/plugins/subscribility/
    55 * Description: Manage and fulfil your sales of wine, beers and other crafted beverages, through clubs and other direct-to-consumer sales channels.
    6  * Version: 2.9.4
     6 * Version: 2.9.5
    77 * Author: Troly
    88 * Author URI: https://troly.io
  • subscribility/trunk/includes/admin/controllers/class-wp99234-admin-settings-data-collection.php

    r2069102 r2139157  
    9595          'id'       => 'wp99234_product_sync',
    9696          'css'      => 'min-width:550px;',
    97           'default'  => '',
     97          'default'  => 'both',
    9898          'type'     => 'select',
    9999          'desc_tip' => true,
  • subscribility/trunk/includes/admin/controllers/class-wp99234-admin.php

    r2048715 r2139157  
    4646        add_action('woocommerce_product_options_general_product_data', array($this,'show_pack_prices'));
    4747        add_action('woocommerce_product_options_general_product_data', array($this,'show_member_prices'));
     48
     49        /* Customize Product Tags Labels */
     50        add_filter( 'woocommerce_taxonomy_args_product_tag', array($this, 'custom_wc_taxonomy_args_product_tag') );
    4851       
    4952        $this->admin_notices();
     
    632635      echo '</div>';
    633636    }
     637
     638    /**
     639     * Display custom message for product tag
     640     */
     641    function custom_wc_taxonomy_args_product_tag( $args ) {
     642        // Get the Products data synchronisation option
     643        $wp99234_product_sync_option = get_option('wp99234_product_sync', 'both');
     644
     645        $tag_notice = 'You can remove Troly tags from the list below, however, these tags will still be present in Troly.';
     646
     647        if (in_array($wp99234_product_sync_option, array('both', 'push'))) {
     648            $tag_notice = 'You will not be able to remove Troly tags from the list below without disabling them in Troly first.';
     649        }
     650        $args['label'] = __( 'Product Tags', 'woocommerce' );
     651        $args['labels'] = array(
     652            'separate_items_with_commas' => __( "<p>$tag_notice</p><i>Separate tags with commas</i>", 'woocommerce' ),
     653        );
     654
     655        return $args;
     656    }
    634657}
    635658
  • subscribility/trunk/includes/frontend/controllers/class-wp99234-products.php

    r2068621 r2139157  
    88    define( 'WP99234_TAG_VISIBLE'     , 105 );
    99    define( 'WP99234_TAG_OUT_OF_STOCK', 108 );
     10    define( 'WP99234_VARIETY_VIRTUAL', 'virtual' );
    1011
    1112/**
     
    445446
    446447     // Array format: (WP attribute name => SUBS attribute name)
    447     function product_meta_map(){
    448 
     448    function product_meta_map()
     449    {
    449450        return array(
    450451            'subs_id'      => 'id',
     
    453454            'foods'        => 'foods',
    454455            'cellar_until' => 'cellar_until',
    455             //'price'        => 'price',
    456456            'price_case'   => 'price_case',
    457457            'price_6pk'    => 'price_6pk',
     
    473473            '_te_divider'  => 'te_divider',
    474474            '_split_ols'   => 'split_ols',
    475             //'product_prices'  => 'product_prices',
    476             //'_subproducts' => 'subproducts',
    477             '_variety'      => 'variety',
     475            '_variety'      => 'variety', // default to 'wine'
    478476            'is_composite'  => 'is_composite' // Used to indicate if pack or not
    479477        );
    480 
    481478    }
    482479
     
    570567        update_post_meta( $product_id, '_regular_price' , $price             );
    571568        update_post_meta( $product_id, '_is_split'      , $product->is_split );
     569
     570        // Set Product as Virtual
     571        // see: https://wordpress.stackexchange.com/questions/137501/how-to-add-product-in-woocommerce-with-php-code
     572        if ( $product->variety === WP99234_VARIETY_VIRTUAL ) {
     573            update_post_meta( $product_id, '_virtual', 'yes');
     574        }
    572575
    573576        /**
     
    776779
    777780            foreach( $product->tags as $tag ){
     781                $product_biz_attributes = get_option('product_biz_attributes', array());
     782
     783                // create slug for the current tag
     784                $slug = sanitize_title($tag->name);
     785
     786                // check and set unique attribute
     787                $is_attribute = array_search($slug, $product_biz_attributes);
     788                if ( !$is_attribute ) {
     789                    $new_tag[$slug] = (array)$tag;
     790                    $product_biz_attributes = array_merge($product_biz_attributes, $new_tag);
     791
     792                    // Save Troly tag ids as option
     793                    update_option('product_biz_attributes', $product_biz_attributes, true);
     794                }
    778795
    779796                $term = get_term_by( 'name', $tag->name, $this->tag_taxonomy_name );
     
    10751092        if( $update ){
    10761093            // Get the Products data synchronisation option
    1077             $wp99234_product_sync_option = get_option('wp99234_product_sync');
     1094            $wp99234_product_sync_option = get_option('wp99234_product_sync', 'both');
    10781095
    10791096            // Only export to `both` and `push` synchronisation
     
    11361153        );
    11371154
     1155        /**
     1156         * Add Product business attribute
     1157         */
     1158        $post_tags = get_the_terms( $product_id, 'product_tag' );
     1159        $product_biz_attributes = get_option('product_biz_attributes', array());
     1160
     1161        if (!empty($post_tags)) {
     1162            $product_biz_tag_ids = array();
     1163            $product_biz_tags = array();
     1164
     1165            foreach ($post_tags as $tag) {
     1166                $slug = sanitize_title($tag->name);
     1167                $this_tag = $product_biz_attributes[$slug];
     1168                $product_biz_tag_ids[] = $this_tag['id'];
     1169                $product_biz_tags[] = $this_tag;
     1170            }
     1171
     1172            $data['tag_ids'] = $product_biz_tag_ids;
     1173            $data['tags'] = $product_biz_tags;
     1174        }
    11381175
    11391176        /**
  • subscribility/trunk/includes/frontend/controllers/class-wp99234-wc-filter.php

    r2128705 r2139157  
    484484        $customer_data = array(
    485485            'customer' => array(
    486             'fname' => $order->get_billing_first_name(),
    487             'lname' => $order->get_billing_last_name(),
    488             'email' => $order->get_billing_email(),
    489             'phone' => $order->get_billing_phone(),
    490             'company_name' => $order->get_billing_company(),
    491             'delivery_address' => $order->get_billing_address_1(),
    492             'delivery_suburb' => $order->get_billing_city(),
    493             'delivery_postcode' => $order->get_billing_postcode(),
    494             'delivery_state' => $order->get_billing_state(),
    495             'delivery_country' => WC()->countries->countries[ $order->get_billing_country() ],
    496             'notify_shipments' => '@|mail'
    497           )
     486                'fname' => $order->get_billing_first_name(),
     487                'lname' => $order->get_billing_last_name(),
     488                'email' => $order->get_billing_email(),
     489                'phone' => $order->get_billing_phone(),
     490                'company_name' => $order->get_billing_company(),
     491                'delivery_address' => $order->get_billing_address_1(),
     492                'delivery_suburb' => $order->get_billing_city(),
     493                'delivery_postcode' => $order->get_billing_postcode(),
     494                'delivery_state' => $order->get_billing_state(),
     495                'delivery_country' => WC()->countries->countries[ $order->get_billing_country() ],
     496                'notify_shipments' => '@|mail'
     497              )
    498498        );
    499499       
     
    550550      $shipping = array_values($order->get_shipping_methods());
    551551      $shipping_method = $shipping ? explode(":", $shipping[0]->get_method_id())[0] : null;
     552      // $shipping_cost = $shipping ? explode(":", $shipping[0]->get_total())[0] : null;
    552553
    553554      if($shipping_method == 'local_pickup'){
     
    581582          )
    582583        );
    583       }     
     584
     585        if ($shipping_method == 'free_shipping') {
     586            $order_data['shipments']['shipping_fee_override'] = 0;
     587        }
     588      }
    584589       
    585590      $message .= '\nGetting orderlines for the order';   
     
    603608   
    604609      $message .= '\nExporting order to Troly';
    605    
    606610     
    607611        // If we were editing an order
  • subscribility/trunk/includes/frontend/views/newsletter_form.php

    r2068621 r2139157  
    2525
    2626    <div class="woocommerce">
    27         <?php if ( !is_admin() ) { wc_print_notices(); } ?>
     27        <?php if ( !is_admin() ) { if ( function_exists('wc_print_notices') ) { wc_print_notices(); } } ?>
    2828    </div>
    2929
  • subscribility/trunk/includes/frontend/views/registration_form.php

    r2102935 r2139157  
    4646        border:1px solid #000;
    4747        float:left;
    48         background-color: #F9F9F9;
     48
     49        /* Make text readable inverse background */
     50        background-color: transparent;
     51        box-shadow: inset 0 0 5px #888888;
     52
    4953        padding:20px;
    5054        margin-bottom:4%;
     
    5256        width: 100%;
    5357        position: relative;
     58    }
     59
     60    /* Emphasize input fields to inverse background */
     61    .wp99234-input_field_text, #subs_birthday,
     62    .wp99234-input_field_password,
     63    .wp99234-input_field_textfield,
     64    .wp99234-section.cc_details input[type="text"],
     65    .wp99234-section.cc_details input[type="tel"] {
     66        border-bottom: 1px solid gray;
    5467    }
    5568   
     
    178191 
    179192    <div class="woocommerce wp99234_registration_notices">
    180         <?php if ( !is_admin() ) { wc_print_notices(); } ?>
     193        <?php if ( !is_admin() ) { if ( function_exists('wc_print_notices') ) { wc_print_notices(); } } ?>
    181194    </div>
    182195
  • subscribility/trunk/readme.txt

    r2128705 r2139157  
    7070
    7171## Changelog
     72###Version 2.9.5
     73- Make Club box options readable even in inverse background/theme color
     74- Set as Virtual product if set in Troly
     75
    7276###Version 2.9.4
    7377- Fixed Syncing User's account to Troly after Placing Order
  • subscribility/trunk/wp99234.php

    r2128705 r2139157  
    44 * Plugin URI: https://wordpress.org/plugins/subscribility/
    55 * Description: Manage and fulfil your sales of wine, beers and other crafted beverages, through clubs and other direct-to-consumer sales channels.
    6  * Version: 2.9.4
     6 * Version: 2.9.5
    77 * Author: Troly
    88 * Author URI: https://troly.io
Note: See TracChangeset for help on using the changeset viewer.