Plugin Directory

Changeset 2891776


Ignore:
Timestamp:
04/01/2023 10:26:45 AM (3 years ago)
Author:
sitepack
Message:

Plugin update released

Location:
sitepack-connect
Files:
5 edited
13 copied

Legend:

Unmodified
Added
Removed
  • sitepack-connect/trunk/class.sitepack-connect.php

    r2891775 r2891776  
    44{
    55
    6     private static ?SitePackConnect $instance = null;
    7 
    8     public static function getInstance(): SitePackConnect
     6    public static function init()
    97    {
    10         if (!isset(self::$instance)) {
    11             self::$instance = new SitePackConnect();
    12 
    13             self::$instance->init();
    14         }
    15 
    16         return self::$instance;
    178    }
    189
    19     public static function init()
     10    public function fetchLiveStock(string $importSource, string $ean)
    2011    {
    21 
    22     }
    23 
    24     public function fetchLiveStock(string $importSource, string $ean): array
    25     {
    26 
    27 
    2812    }
    2913
  • sitepack-connect/trunk/models/class.sitepack-category.php

    r2891775 r2891776  
    7676    }
    7777
    78     /**
    79      * @return string
    80      */
    81     public function getCategoryMain(): string
    82     {
    83         return $this->categoryMain;
    84     }
    85 
    86     /**
    87      * @return string
    88      */
    89     public function getCategorySub(): string
    90     {
    91         return $this->categorySub;
    92     }
    93 
    94     /**
    95      * @return string
    96      */
    97     public function getCategorySubSub(): string
    98     {
    99         return $this->categorySubSub;
    100     }
    101 
    10278    public function jsonSerialize(): array
    10379    {
  • sitepack-connect/trunk/readme.txt

    r2891775 r2891776  
    44Requires at least: 5.0
    55Tested up to: 6.1.1
    6 Stable tag: 1.1.0
     6Stable tag: 1.0.2
    77License: GPLv2 or later
    88
     
    2121
    2222== Changelog ==
    23 
    24 = 1.1.0 =
    25 
    26 Release date: 2023-04-03
    27 
    28 #### Enhancements
    29 
    30 * You can use the spGetProductStockInformation(int $productId) method to get the live stock information of a product and their related stock locations
    31 
    32 #### Bugfixes
    33 
    34 * Stock implementation call bugfix in REST API
    3523
    3624= 1.0.2 =
  • sitepack-connect/trunk/services/class.sitepack-woocommerce.php

    r2891775 r2891776  
    7272        $product->set_stock_quantity(0);
    7373        $product->set_stock_status('outofstock');
    74         if ((bool)$data['hasStock'] === true || (int)$data['inStock'] >= 1) {
     74        if ($data['hasStock'] === true) {
    7575            $product->set_stock_status('instock');
    7676
     
    7979            }
    8080
    81             $product->set_stock_quantity((int)$data['inStock'] + (int)$data['stockSupplier']);
     81            $product->set_stock_quantity($data['inStock'] + $data['stockSupplier']);
    8282
    8383            if ($product->get_stock_quantity() < 1) {
  • sitepack-connect/trunk/sitepack-connect.php

    r2891775 r2891776  
    88Plugin URI: https://sitepack.nl/integraties
    99Description: Connect your eCommerce store with external APIs, using SitePack Connect. Import products with stock information and export orders to your favorite third party software.
    10 Version: 1.1.0
     10Version: 1.0.2
    1111Author: SitePack B.V.
    1212Author URI: https://sitepack.nl
     
    4949    }
    5050}
    51 
    52 if (!function_exists('spGetProductStockInformation')) {
    53     /**
    54      * Fetch the live stock information
    55      *
    56      * @param int $productId
    57      * @return array
    58      */
    59     function spGetProductStockInformation(int $productId): array
    60     {
    61         $connect = SitePackConnect::getInstance();
    62 
    63         $product = new WC_Product_Simple($productId);
    64         var_dump($product->read_meta_data());
    65         exit;
    66 
    67         return $connect->fetchLiveStock('w', 'ewf');
    68     }
    69 }
    70 
    71 add_action('init', 'fetchStock');
    72 
    73 function fetchstock()
    74 {
    75 //    spGetProductStockInformation(42);
    76 }
    77 
Note: See TracChangeset for help on using the changeset viewer.