Plugin Directory

Changeset 3425031


Ignore:
Timestamp:
12/22/2025 04:53:47 AM (3 months ago)
Author:
mlmsoft
Message:

Version 3.15.11

Location:
mlm-soft-integration/trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • mlm-soft-integration/trunk/CHANGELOG.md

    r3417136 r3425031  
    22
    33## Changelog ##
     4
     5## 2025-12-17 - version 3.15.11
     6* Check the result of the `cancelOrder` function before proceeding. [EWalletCouponModule.php]
     7
     8## 2025-12-15 - version 3.15.10
     9* New feature: Added the ability to use product variations.
     10* Added `ProductTrait` class. [ProductTrait.php]
     11* Added `MLMSoftWCProductVariation` class. [MLMSoftWCProductVariation.php]
     12* Added `MLMSoftProductInterface` class. [MLMSoftProductInterface.php]
     13* Updated `MLMSoftWCProduct` class. [MLMSoftWCProduct.php]
     14* Updated `MLMSoftWCOrder` class. [MLMSoftWCOrder.php]
    415
    516## 2025-12-10 - version 3.15.9
  • mlm-soft-integration/trunk/integrations/woocommerce/models/order/MLMSoftWCOrder.php

    r3390122 r3425031  
    33namespace MLMSoft\integrations\woocommerce\models\order;
    44
     5use Automattic\WooCommerce\Enums\ProductType;
    56use MLMSoft\core\MLMSoftPlugin;
    67use MLMSoft\core\models\user\MLMSoftLocalUser;
     
    89use MLMSoft\core\models\user\MLMSoftRemoteUser;
    910use MLMSoft\integrations\woocommerce\models\product\MLMSoftWCProduct;
     11use MLMSoft\integrations\woocommerce\models\product\MLMSoftWCProductVariation;
    1012use MLMSoft\integrations\woocommerce\WCIntegration;
    1113use MLMSoft\integrations\woocommerce\WCIntegrationOptions;
     
    9193        }
    9294        $mlmsoftPlugin = MLMSoftPlugin::getInstance();
     95        /** @disregard */
    9396        $mlmsoftPlugin->api3->createDocument($documentName, $payload);
    9497    }
     
    143146        $documentPayload = apply_filters_ref_array(self::VOLUMES_DOCUMENT_PAYLOAD_FILTER, [$documentPayload, $this]);
    144147
     148        /** @disregard */
    145149        $mlmsoftPlugin->api3->createDocument($documentName, $documentPayload);
    146150
     
    262266        foreach ($orderItems as $orderItem) {
    263267            $orderItemData = $orderItem->get_data();
    264             /** @var MLMSoftWCProduct $product */
    265             $product = new MLMSoftWCProduct(wc_get_product($orderItemData['product_id']));
     268
     269            /**
     270             * Usage product variations.
     271             *
     272             * @since 3.15.10
     273             */
     274            if ( (int) $orderItemData['variation_id'] > 0 ) {
     275                /** @var MLMSoftWCProductVariation $product */
     276                $product = new MLMSoftWCProductVariation( wc_get_product_object(ProductType::VARIATION, $orderItemData['variation_id']) );
     277            } else {
     278                /** @var MLMSoftWCProduct $product */
     279                $product = new MLMSoftWCProduct(wc_get_product($orderItemData['product_id']));
     280            }
     281           
    266282            $quantity = $orderItem->get_quantity();
    267283            $price = $product->get_price(null);
     
    462478            //
    463479            foreach( $this->get_items('line_item') as $orderItem ) {
    464                 /** @disregard */
    465                 $product = new MLMSoftWCProduct($orderItem->get_product_id());
     480                $orderItemData = $orderItem->get_data();
     481
     482                /**
     483                 * Usage product variations.
     484                 *
     485                 * @since 3.15.10
     486                 */
     487                if ( (int) $orderItemData['variation_id'] > 0 ) {
     488                    /** @var MLMSoftWCProductVariation $product */
     489                    $product = new MLMSoftWCProductVariation( wc_get_product_object(ProductType::VARIATION, $orderItemData['variation_id']) );
     490                } else {
     491                    /** @var MLMSoftWCProduct $product */
     492                    $product = new MLMSoftWCProduct(wc_get_product($orderItemData['product_id']));
     493                }
     494
    466495                $volumeSum += (float) $product->getVolume($alias) * $orderItem->get_quantity();
    467496            }           
  • mlm-soft-integration/trunk/integrations/woocommerce/models/product/MLMSoftWCProduct.php

    r2973671 r3425031  
    33namespace MLMSoft\integrations\woocommerce\models\product;
    44
     5// Exit if accessed directly
     6if ( ! defined( 'ABSPATH' ) ) {
     7    exit;
     8}
     9
     10use WC_Product;
     11use MLMSoft\traits\ProductTrait;
    512use MLMSoft\integrations\woocommerce\WCIntegration;
    6 use MLMSoft\integrations\woocommerce\WCIntegrationOptions;
    7 use WC_Product;
     13use MLMSoft\integrations\woocommerce\interfaces\MLMSoftProductInterface;
    814
    9 class MLMSoftWCProduct extends WC_Product
     15/**
     16 * @since 3.15.10
     17 */
     18class MLMSoftWCProduct extends WC_Product implements MLMSoftProductInterface
    1019{
    11     public function getVolumes()
     20    use ProductTrait;
     21
     22    /**
     23     * Constructor.
     24     */
     25    public function __construct( $product = 0 )
    1226    {
    13         $productVolumeFields = WCIntegrationOptions::getInstance()->volumeProductFields;
    14         $result = [];
    15 
    16         foreach ($productVolumeFields as $field) {
    17             $propertyAlias = $field['volumeProperty'];
    18             $value = $this->getVolume($propertyAlias);
    19             $result[$propertyAlias] = $value;
     27        parent::__construct( $product );
     28        if ( $product instanceof WC_Product ) {
     29            $this->originType = $product->get_type();
    2030        }
    21 
    22         return $result;
    2331    }
    24 
     32   
    2533    public function getVolume($alias)
    2634    {
  • mlm-soft-integration/trunk/integrations/woocommerce/paymentGateways/eWallet/modules/EWalletCouponModule.php

    r3417136 r3425031  
    128128                 *
    129129                 * @since 3.11.0
     130                 * @since 3.15.10 Check the result of the `cancelOrder` function before proceeding.
    130131                 */
    131                 $this->cancelOrder($code);
    132                 return;
     132                if ( $this->cancelOrder($code) ) {
     133                    return;
     134                }
    133135            }
    134136
  • mlm-soft-integration/trunk/mlm-soft-integration.php

    r3417136 r3425031  
    44Plugin Name: MLM Soft Integration
    55Description: WP integration with mlm-soft.com cloud platform
    6 Version: 3.15.9
     6Version: 3.15.11
    77Author: MLM Soft Ltd.
    88Author URI: https://mlm-soft.com
Note: See TracChangeset for help on using the changeset viewer.