Plugin Directory

Changeset 2566078


Ignore:
Timestamp:
07/16/2021 08:49:58 PM (5 years ago)
Author:
RapidDev
Message:

Update 1.3.0 - bugfixes

Location:
wc-poczta
Files:
35 added
7 edited

Legend:

Unmodified
Added
Removed
  • wc-poczta/trunk/code/components/EasyPack.php

    r2565920 r2566078  
    164164    $totalWeight = (float) $this->getCartWeight($package);
    165165
    166     if ($weightLimit > 1 && $totalWeight > $weightLimit) {
     166    if ($weightLimit > 0 && $totalWeight > $weightLimit) {
    167167      return; //Permitted weight exceeded
    168168    }
  • wc-poczta/trunk/code/components/Poczta.php

    r2565920 r2566078  
    6464      'options' => [
    6565        'poczta' => __('Poczta', Bootstrap::DOMAIN),
     66        'automat_placowka' => __('Post Office Pickup machine', Bootstrap::DOMAIN),
     67        'automat_pocztowy' => __('Post Pickup machine', Bootstrap::DOMAIN),
     68        'skrzynka_pocztowa' => __('Post mailbox', Bootstrap::DOMAIN),
     69        'zabka' => __('Żabka store', Bootstrap::DOMAIN),
     70        'ruch' => __('Ruch store', Bootstrap::DOMAIN),
    6671        'orlen' => __('Orlen petrol stations', Bootstrap::DOMAIN),
    67         'automat_pocztowy' => __('Post Pickup machine', Bootstrap::DOMAIN),
    68         'ruch' => __('Ruch store', Bootstrap::DOMAIN),
    69         'zabka' => __('Żabka store', Bootstrap::DOMAIN),
     72        'biedronka' => __('Biedronka store', Bootstrap::DOMAIN),
    7073        'freshmarket' => __('Freshmarket store', Bootstrap::DOMAIN),
    7174        'automat_biedronka' => __('Biedronka store Pickup machine', Bootstrap::DOMAIN),
    7275        'automat_carrefour' => __('Carrefour store Pickup machine', Bootstrap::DOMAIN),
    73         'automat_placowka' => __('Post Office Pickup machine', Bootstrap::DOMAIN),
    7476        'automat_spolem' => __('Społem store Pickup machine', Bootstrap::DOMAIN),
    75         'skrzynka_pocztowa' => __('Post mailbox', Bootstrap::DOMAIN),
    7677        'automat_lewiatan' => __('Lewiatan store Pickup machine', Bootstrap::DOMAIN),
    7778        'lewiatan' => __('Lewiatan store', Bootstrap::DOMAIN),
    7879        'abc' => __('ABC store', Bootstrap::DOMAIN),
    7980        'delikatesy_centrum' => __('Deli Center store', Bootstrap::DOMAIN),
    80         'biedronka' => __('Biedronka store', Bootstrap::DOMAIN),
    8181        'kaufland' => __('Kaufland store', Bootstrap::DOMAIN),
    8282      ]
     
    113113    $totalWeight = (float) $this->getCartWeight($package);
    114114
    115     if ($weightLimit > 1 && $totalWeight > $weightLimit) {
     115    if ($weightLimit > 0 && $totalWeight > $weightLimit) {
    116116      return; //Permitted weight exceeded
    117117    }
  • wc-poczta/trunk/code/core/Actions.php

    r2565920 r2566078  
    1313
    1414use WP_Post;
     15use WC_Order;
    1516
    1617final class Actions
     
    5455    add_action('woocommerce_checkout_process', [$this, 'customFieldsValidation']);
    5556    add_action('woocommerce_checkout_update_order_meta', [$this, 'customFieldsSave']);
    56     add_action('woocommerce_order_details_after_customer_details', [$this, 'customDetails'], 1, 1);
     57    add_action('woocommerce_after_order_details', [$this, 'customDetails'], 1, 1);
     58    add_filter('woocommerce_email_order_meta', [$this, 'emailDetails'], 10, 3);
    5759
    5860    add_action('add_meta_boxes', function () {
     
    196198    $containerSuf = '</td></tr>';
    197199
    198     if('Storefront' == $theme->Name) {
     200    if ('Storefront' == $theme->Name) {
    199201      $containerPre = '<tr class="wc-poczta wc-poczta-select-point"><th colspan="2">';
    200202      $containerSuf = '</th></tr>';
     
    273275   * @param Automattic\WooCommerce\Admin\Overrides\Order $order
    274276   */
    275   public function customDetails($order): void
     277  public function customDetails(WC_Order $order): void
    276278  {
    277279    $orderId = $order->get_id();
     
    283285
    284286    $this->bootstrap->getPluginView('customer', ['id' => $orderId, 'wcpId' => $wcpId, 'order' => $order, 'weight' => $this->getTotalWeight($order)]);
     287  }
     288
     289  public function emailDetails($order, $sentToAdmin, $plainText)
     290  {
     291    $orderId = $order->get_id();
     292    $wpcId = get_post_meta($orderId, '_wcpoczta_id', true);
     293
     294    if (empty($wpcId)) {
     295      return;
     296    }
     297
     298    $weight = $this->getTotalWeight($order);
     299    $html = '';
     300
     301    if ($plainText === false) {
     302      $html .= '<h2>' . __('Delivery to the pickup point', Bootstrap::DOMAIN) . '</h2>';
     303
     304      $html .= '<p><strong>' . __('Pickup point', Bootstrap::DOMAIN) . ':</strong> ' . get_post_meta($orderId, '_wcpoczta_name', true);
     305      $html .= '<br><strong>' . __('Phone', Bootstrap::DOMAIN) . ':</strong> ' . $order->get_billing_phone();
     306      $html .= '<br><strong>' . __('Weight', Bootstrap::DOMAIN) . ':</strong> ' . ($weight > 0 ? $weight . ' ' . get_option('woocommerce_weight_unit') : __('Unknown', Bootstrap::DOMAIN));
     307      $html .= '</p>';
     308
     309      $html .= '<p><strong>' . __('Pickup point address', Bootstrap::DOMAIN) . ':</strong>';
     310      $html .= '<br>' . get_post_meta($orderId, '_wcpoczta_address', true);
     311      $html .= '<br>' . get_post_meta($orderId, '_wcpoczta_zipcode', true);
     312      $html .= '<br>' . get_post_meta($orderId, '_wcpoczta_city', true);
     313      $html .= '</p>';
     314    } else {
     315      $html .= __('Delivery to the pickup point', Bootstrap::DOMAIN) . PHP_EOL;
     316      $html .= __('Pickup point', Bootstrap::DOMAIN) . ' - ' . get_post_meta($orderId, '_wcpoczta_name', true) . PHP_EOL . PHP_EOL;
     317
     318      $html .= __('Pickup point address', Bootstrap::DOMAIN) . ':' . PHP_EOL;
     319      $html .= get_post_meta($orderId, '_wcpoczta_address', true) . PHP_EOL;
     320      $html .= get_post_meta($orderId, '_wcpoczta_zipcode', true) . PHP_EOL;
     321      $html .= get_post_meta($orderId, '_wcpoczta_city', true);
     322    }
     323
     324    echo $html;
    285325  }
    286326
     
    364404    foreach ($order->get_items() as $productId => $product) {
    365405      $quantity = $product->get_quantity();
    366      
     406
    367407      $product = $product->get_product();
    368408      $productWeight = $product->get_weight();
  • wc-poczta/trunk/code/core/ShippingMethod.php

    r2565920 r2566078  
    1212namespace WCPoczta\Code\Core;
    1313
    14 use \WC_Shipping_Method;
     14use WC_Shipping_Method;
    1515use WCPoczta\Code\Core\Bootstrap;
    1616
  • wc-poczta/trunk/readme.txt

    r2565920 r2566078  
    66Tested up to: 5.8.0
    77Requires PHP: 7.4.1
    8 Stable tag: wc-poczta
     8Stable tag: trunk
    99License: GPL-3.0
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.txt
     
    3535= Contribute =
    3636
    37 WC Poczta is developed and supported by RapidDev, the creators of other WordPress solutions that are appreciated by te community. Did you find a new solution, bug fix or have a suggestion? Be sure to let us know!
     37WC Poczta is developed and supported by RapidDev, the creators of other WordPress solutions that are appreciated by te community. Did you find a bug or have a suggestion? Be sure to let us know!
    3838
    3939== Frequently asked questions ==
     
    7777= Minimum Requirements =
    7878
    79 * PHP version 7.4.6 or greater (PHP 8.0.8 or greater is recommended)
     79* PHP version 7.4.1 or greater (PHP 8.0.8 or greater is recommended)
    8080* WordPress version 5.0.0 or greater (WordPress 5.7.2 or greater is recommended)
    8181* WooCommerce version 5.0.0 or greater (WooCommerce 5.5.1 or greater is recommended)
     
    102102== Changelog ==
    103103
     104= 1.3.0 =
     1051. Fixing the weight limit
     1062. Correct the display of pickup point in order summary
     1073. Email fields added
     108
    104109= 1.2.0 =
    1051101. Everything is new
     
    125130== Upgrade Notice ==
    126131
     132= 1.3.0 =
     133Fixing the weight limit and add custom e-mail fields.
     134
    127135= 1.2.0 =
    128136The new version of the plug is not compatible with the old one. Be careful while updating.
  • wc-poczta/trunk/wc-poczta.php

    r2565920 r2566078  
    1717 * License: GPL-3.0
    1818 * License URI: https://www.gnu.org/licenses/gpl-3.0.txt
    19  * Version: 1.2.0
     19 * Version: 1.3.0
    2020 * Text Domain: wc_poczta
    2121 * Domain Path: /languages
     
    4040  require_once $pluginPath . 'code/core/' . 'ShippingRegistrar.php';
    4141
    42   \WCPoczta\Code\Core\Bootstrap::init($pluginPath, plugin_dir_url(__FILE__), '1.2.1697');
     42  \WCPoczta\Code\Core\Bootstrap::init($pluginPath, plugin_dir_url(__FILE__), '1.3.156');
    4343} else {
    4444  add_action('admin_notices', function () {
Note: See TracChangeset for help on using the changeset viewer.