Add shipping.

@param \Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Shipping $shipping

@return Order
963988
public function addShipping(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Shipping $shipping)
    {
        $this->shippings[] = $shipping;

        return $this;
    }
5614
protected function hydrateShippingInfo(HpsShippingInfo $shipping)
    {
        return array(
            'ShippingAddress1'    => $shipping->address->address,
            'ShippingCity'        => $shipping->address->city,
            'ShippingCountryCode' => $shipping->countryCode,
            'ShippingFirstName'   => $shipping->firstName,
            'ShippingLastName'    => $shipping->lastName,
            'ShippingMiddleName'  => $shipping->middleName,
            'ShippingPhone'       => $shipping->phoneNumber,
            'ShippingPostalCode'  => $shipping->address->zip,
            'ShippingState'       => $shipping->address->state,
        );
    }
257421
function shipping($module = '') {
    global $PHP_SELF, $messageStack;

    if (defined('MODULE_SHIPPING_INSTALLED') && zen_not_null(MODULE_SHIPPING_INSTALLED)) {
      $this->modules = explode(';', MODULE_SHIPPING_INSTALLED);

      $include_modules = array();

      if ( (zen_not_null($module)) && is_array($module) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules)) ) {
        $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)));
      } else {
        reset($this->modules);
        while (list(, $value) = each($this->modules)) {
          $class = substr($value, 0, strrpos($value, '.'));
          $include_modules[] = array('class' => $class, 'file' => $value);
        }
      }

      for ($i=0, $n=sizeof($include_modules); $i<$n; $i++) {
        //          include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/shipping/' . $include_modules[$i]['file']);
        $lang_file = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/shipping/', $include_modules[$i]['file'], 'false');
        if (@file_exists($lang_file)) {
          include_once($lang_file);
        } else {
          if (IS_ADMIN_FLAG === false && is_object($messageStack)) {
            $messageStack->add('checkout_shipping', WARNING_COULD_NOT_LOCATE_LANG_FILE . $lang_file, 'caution');
          } else {
            $messageStack->add_session(WARNING_COULD_NOT_LOCATE_LANG_FILE . $lang_file, 'caution');
          }
        }
        $this->enabled = TRUE;
        $this->notify('NOTIFY_SHIPPING_MODULE_ENABLE', $include_modules[$i]['class']);
        if ($this->enabled)
        {
          include_once(DIR_WS_MODULES . 'shipping/' . $include_modules[$i]['file']);
          $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'];
        }
      }
    }
  }
1237909
public function addItem($value)
    {
        $this->_items[] = $value;
        if ($value->isShipping()) {
            $this->_shippingItems[] = $value;
        }
    }
863400
private function setShippingMethod($quote, $transaction)
    {
        if ($quote->isVirtual()) {
            return;
        }

        $shippingAddress = $quote->getShippingAddress();
        $shippingAddress->setCollectShippingRates(true);

        $shippingMethod = $transaction->order->cart->shipments[0]->reference;

        $shippingAddress->setShippingMethod($shippingMethod)->save();
    }
447889
public function createShipmentOrder() {
		switch($this->getMayor()) {
			case 1:
				$data = $this->createShipmentClass_v1();
				break;
			case 2:
			default:
				if($this->countShipmentOrders() < 1)
					$data = $this->createShipmentClass_v2_legacy();
				else
					$data = $this->createShipmentClass_v2();
		}

		$response = null;

		// Create Shipment
		try {
			$response = $this->sendCreateRequest($data);
		} catch(Exception $e) {
			$this->addError($e->getMessage());

			return false;
		}

		if(is_soap_fault($response)) {
			$this->addError($response->faultstring);

			return false;
		} else
			return new Response($this->getVersion(), $response);
	}
235263
public function setShippingDiscount($shippingDiscount)
    {
        NumericValidator::validate($shippingDiscount, "Shipping Discount");
        $shippingDiscount = Formatter::formatToPrice($shippingDiscount);
        $this->shippingDiscount = $shippingDiscount;
        return $this;
    }
330582
@Indexable(type = IndexableType.REINDEX)
	@Override
	public CommerceShipment addCommerceShipment(
		CommerceShipment commerceShipment) {
		commerceShipment.setNew(true);

		return commerceShipmentPersistence.update(commerceShipment);
	}
1316772
public function loadOrderShippingMethod(
        CartInterface $cart,
        OrderInterface $order
    ) {
        $shippingMethodId = $cart->getShippingMethod();

        if (empty($shippingMethodId)) {
            return $this;
        }

        $shippingMethod = $this
            ->shippingWrapper
            ->getOneById($cart, $shippingMethodId);

        if ($shippingMethod instanceof ShippingMethod) {
            $order->setShippingAmount($shippingMethod->getPrice());
            $order->setShippingMethod($shippingMethod);
        }
    }
817355
private function prepareShipping()
    {
        $shipping = array();
        if(!empty($this->_detailsTransactionByCode->getShipping())){
            $shipping = array(
                'addres' => array(
                    'street'    => $this->_detailsTransactionByCode->getShipping()->getAddress()->getStreet(),
                    'number'    => $this->_detailsTransactionByCode->getShipping()->getAddress()->getNumber(),
                    'complement' => $this->_detailsTransactionByCode->getShipping()->getAddress()->getComplement(),
                    'district'  => $this->_detailsTransactionByCode->getShipping()->getAddress()->getDistrict(),
                    'postalCode' => $this->_detailsTransactionByCode->getShipping()->getAddress()->getPostalCode(),
                    'city'      => $this->_detailsTransactionByCode->getShipping()->getAddress()->getCity(),
                    'state'     => $this->_detailsTransactionByCode->getShipping()->getAddress()->getState(),
                    'country'   => $this->_detailsTransactionByCode->getShipping()->getAddress()->getCountry()
                ),
                'type' => $this->_detailsTransactionByCode->getShipping()->getType()->getType(),
                'cost' => $this->_detailsTransactionByCode->getShipping()->getCost()->getCost()
            );
        }
        return $shipping;
    }
811870
private function setShippingAddress($quote, $transaction)
    {
        $address = @$transaction->order->cart->shipments[0]->shipping_address;
        if ($address) {
            $this->setAddress($quote->getShippingAddress(), $address);
        }
    }
331263
private function createShippingItemEntity($data)
    {
        // check if necessary item data is set
        if (array_key_exists('item', $data) && array_key_exists('id', $data['item'])) {
            $itemId = $data['item']['id'];
            $item = $this->itemManager->findEntityById($itemId);
            if (!$item) {
                throw new ShippingDependencyNotFoundException('SuluSalesCoreBundle:Items', $itemId);
            }

            $shippingItem = new ShippingItemEntity();
            $shippingItem->setItem($item);
            $this->em->persist($shippingItem);
        } else {
            throw new MissingShippingAttributeException('ShippingItems.item.id');
        }

        return $shippingItem;
    }
995322
public function setShippingOptions($options)
    {
        if(!is_array($options)) {
            $options = array($options);
        }
        $this->_shippingOptions = $options;

        return $this;
    }
329316
public function addComment(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Comment\Comment $comment)
    {
        $this->comments[] = $comment;

        return $this;
    }
289104
public function add($method)
    {
        if (is_array($method)) {
            $this->collection[] = new DeliveryMethod($method);
        } elseif (is_object($method) && $method instanceof DeliveryMethod) {
            $this->collection[] = $method;
        }

        return $this;
    }
594788
function setShippingMethod() {
    global $total_count, $total_weight;
    // ensure that cart contents is calculated properly for weight and value
    if (!isset($total_weight)) $total_weight = $_SESSION['cart']->show_weight();
    if (!isset($total_count)) $total_count = $_SESSION['cart']->count_contents();
    // set the shipping method if one is not already set
    // defaults to the cheapest shipping method
    if ( !$_SESSION['shipping'] || ( $_SESSION['shipping'] && ($_SESSION['shipping'] == false) && (zen_count_shipping_modules() > 1) ) ) {
      require_once(DIR_WS_CLASSES . 'http_client.php');
      require_once(DIR_WS_CLASSES . 'shipping.php');
      $shipping_Obj = new shipping;

      // generate the quotes
      $shipping_Obj->quote();

      // set the cheapest one
      $_SESSION['shipping'] = $shipping_Obj->cheapest();
    }
  }
750634
public function addOrderBy($sort, $order = null)
    {
        return $this->add('orderBy', $sort . ' ' . (! $order ? 'ASC' : $order), true);
    }