Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/Ecombricks/InventorySales/Model/Order/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/Ecombricks/InventorySales/Model/Order/SourceTrait.php
<?php
/**
 * Copyright © eComBricks. All rights reserved.
 * See LICENSE.txt for license details.
 */
namespace Ecombricks\InventorySales\Model\Order;

/**
 * Order source trait
 */
trait SourceTrait
{
    
    /**
     * Get source codes
     * 
     * @return array
     */
    public function getSourceCodes()
    {
        $sourceCodes = [];
        foreach ($this->getAllItems() as $item) {
            $sourceCode = $item->getSourceCode();
            if (empty($sourceCode)) {
                continue;
            }
            if (in_array($sourceCode, $sourceCodes)) {
                continue;
            }
            $sourceCodes[] = $sourceCode;
        }
        return $sourceCodes;
    }
    
    /**
     * Get source shipping method
     * 
     * @param string $sourceCode
     * @return string|null
     */
    public function getSourceShippingMethod($sourceCode)
    {
        return $this->getSourceAdditionalData($sourceCode, 'shipping_method');
    }
    
    /**
     * Set source shipping method
     * 
     * @param string $sourceCode
     * @param string $shippingMethod
     * @return $this
     */
    public function setSourceShippingMethod($sourceCode, $shippingMethod)
    {
        $this->setSourceAdditionalData($sourceCode, 'shipping_method', $shippingMethod);
        return $this;
    }
    
    /**
     * Get shipping method
     * 
     * @return array
     */
    public function inventoryGetShippingMethod()
    {
        $value = $this->getData('source_shipping_method');
        if (!is_array($value) || empty($value)) {
            return [];
        }
        return $this->filterSourceValues($value, true);
    }
    
    /**
     * Set shipping method
     * 
     * @param array $value
     * @return $this
     */
    public function inventorySetShippingMethod($value)
    {
        if (!is_array($value) || empty($value)) {
            $value = [];
        }
        $this->setData('source_shipping_method', $this->filterSourceValues($value, true));
        return $this;
    }
    
}

Spamworldpro Mini