Set Invoice Line product
by product number
@param  mixed $invoiceLineHandle
@param  integer $product
@return boolean
430435
public function product($invoiceLineHandle, $product)
    {
        $products = new Product($this->client_raw);
        $productHandle = $products->getHandle($product);

        $this->client
            ->CurrentInvoiceLine_SetProduct(
                array(
                    'currentInvoiceLineHandle' => $invoiceLineHandle,
                    'valueHandle' => $productHandle
                )
            );

        return true;
    }
1182378
protected function prepareProductItem(array &$product, array $options)
    {
        $this->setItemProductInComparison($product, $this->product_compare);
        $this->setItemPriceCalculated($product, $this->product);
        $this->setItemProductInWishlist($product, $this->wishlist);
        $this->setItemPriceFormatted($product, $this->price, $this->current_currency);
        $this->setItemProductBundle($product, $this->product, $this->image);
        $this->setItemRenderedProduct($product, $options);
    }
585743
public function update(int $invoice, array $data)
    {
        $response = $this->httpPut('/3/invoices/'.$invoice, ['Invoice' => $data]);

        if (!$this->hydrator) {
            return $response;
        }

        // Use any valid status code here
        if (200 !== $response->getStatusCode()) {
            $this->handleErrors($response);
        }

        return $this->hydrator->hydrate($response, Model::class);
    }
474104
public function setServiceInvoiceTax(\Core\Entity\InvoiceTax $service_invoice_tax = null) {
        $this->service_invoice_tax = $service_invoice_tax;

        return $this;
    }
1167033
public function setProduct($product)
    {
        $this->id = $product->getId();
        $this->sku = $product->getSku();
        $this->name = $product->getName();

        $this->status = $this->statusFactory->create()
            ->getOptionText($product->getStatus());

        $options = $this->visibilityFactory->create()
            ->getOptionArray();
        $this->visibility = (string)$options[$product->getVisibility()];

        $this->getMinPrices($product);

        $this->url = $this->urlFinder->fetchFor($product);

        $this->imagePath = $this->mediaConfigFactory->create()
            ->getMediaUrl($product->getSmallImage());

        $this->stock = (float)number_format($this->getStockQty($product), 2, '.', '');

        $shortDescription = $product->getShortDescription();
        //limit short description
        if ($this->stringUtils->strlen($shortDescription) > \Dotdigitalgroup\Email\Helper\Data::DM_FIELD_LIMIT) {
            $shortDescription = mb_substr($shortDescription, 0, \Dotdigitalgroup\Email\Helper\Data::DM_FIELD_LIMIT);
        }

        $this->shortDescription = $shortDescription;

        //category data
        $count = 0;
        $categoryCollection = $product->getCategoryCollection()
            ->addNameToResult();
        foreach ($categoryCollection as $cat) {
            $this->categories[$count]['Id'] = $cat->getId();
            $this->categories[$count]['Name'] = $cat->getName();
            ++$count;
        }

        //website data
        $count = 0;
        $websiteIds = $product->getWebsiteIds();
        foreach ($websiteIds as $websiteId) {
            $website = $this->storeManager->getWebsite(
                $websiteId
            );
            $this->websites[$count]['Id'] = $website->getId();
            $this->websites[$count]['Name'] = $website->getName();
            ++$count;
        }

        $this->processProductOptions($product);

        unset(
            $this->itemFactory,
            $this->mediaConfigFactory,
            $this->visibilityFactory,
            $this->statusFactory,
            $this->helper,
            $this->storeManager
        );

        return $this;
    }
166625
public function setProductId($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->product_id !== $v) {
            $this->product_id = $v;
            $this->modifiedColumns[DealerProductVersionTableMap::PRODUCT_ID] = true;
        }


        return $this;
    }
197914
public function setPrice($product)
    {
        $this->price = (float)number_format($product->getFinalPrice(), 2, '.', '');
        $total = $this->price * $this->qty;

        $this->totalValueOfProduct = (float)number_format($total, 2, '.', '');

        return $this;
    }
590801
private static function updatePaymentStatus($invoice)
    {
        if (! $invoice->payment || $invoice->getStatus() === 'payed') {
            return $invoice;
        }
        $receipt = $invoice->get_payment();
        Bank_Service::update($receipt);
        if ($invoice->get_payment()->isPayed()){
            $invoice->setStatus('payed');
            $invoice->update();
        }
        return $invoice;
    }
465054
public function setOrderInvoice(\HarvestCloud\CoreBundle\Entity\Invoice\OrderInvoice $invoice = null)
    {
        $this->orderInvoice = $invoice;

        return $this;
    }
30600
public function sendPurchaseNotification($invoice)
    {
        $templateName = 'PaymentBundle:Email:sale.notification.admin.html.twig';

        if($invoice->getTransaction()->getItems()->first()->getProduct() instanceof Product){
            $product = $invoice->getTransaction()->getItems()->first()->getProduct();
        }
        
        $sellerEmails = array();
        if($invoice->getTransaction()->getItems()->first()->getProduct()->getActor() instanceof Actor){
            $sellerEmails[] = $invoice->getTransaction()->getItems()->first()->getProduct()->getActor()->getEmail();
        } 
            
        $context = array(
            'order_number'    => $invoice->getTransaction()->getTransactionKey(),
            'invoice_date'      => $invoice->getCreated(),
            'user_email'        => $invoice->getTransaction()->getActor()->getEmail(),
            'seller_email'        => implode(',', $sellerEmails),
            'order_details_url' => $this->router->generate('payment_checkout_showinvoice', array('number' => $invoice->getInvoiceNumber()), UrlGeneratorInterface::ABSOLUTE_URL),
        );

        $this->sendMessage($templateName, $context, $this->twigGlobal->getParameter('admin_email'), $this->twigGlobal->getParameter('admin_email'));
    }
1140434
public function getLineItemForProduct(Product $product)
    {
        foreach ($this->getLineItems() as $lineItem)
        {
            if ($lineItem->getProduct()->getId() == $product->getId())
            {
                return $lineItem;
            }
        }

        return $this->createLineItemForProduct($product);
    }
909668
public function copyAction(Product $product)
    {


        $productCopy = new Product();
        $copyName = $this->get('translator')->trans('Copy of') . " " . $product->getName();
        $productCopy->setName($copyName);

        $productCopy->setCostPrice($product->getCostPrice());
        $productCopy->setDescription($product->getDescription()??$copyName);
        $productCopy->setCode($product->getCode());
        $productCopy->setImage($product->getImage());
        $productCopy->setPlace($product->getPlace());
        $productCopy->setSalePrice($product->getSalePrice());
        $productCopy->setSupplier($product->getSupplier());
        $productCopy->setWarehouse($product->getWarehouse());

        // boleans
        $productCopy->setEnabled($product->getEnabled());
        $productCopy->setForSale($product->getForSale());
        $productCopy->setCompositionOnDemand($product->isCompositionOnDemand());
        $productCopy->setPack($product->isPack());
        $productCopy->setManualPackPricing($product->isManualPackPricing());
        $productCopy->setRawMaterial($product->getRawMaterial());

        $em = $this->getDoctrine()->getManager();
        $em->persist($productCopy);

        // relations

        /* @var ProductRawMaterial $rawMaterial */
        foreach ($product->getRawMaterials() as $rawMaterial) {
            $rawMaterialCopy = new ProductRawMaterial();
            $rawMaterialCopy->setRawMaterial($rawMaterial->getRawMaterial());
            $rawMaterialCopy->setProduct($productCopy);
            $rawMaterialCopy->setMeasureUnit($rawMaterial->getMeasureUnit());
            $rawMaterialCopy->setQuantity($rawMaterial->getQuantity());

            $em->persist($rawMaterialCopy);

            $productCopy->addRawMaterial($rawMaterialCopy);

        }

        /* @var ProductCategory $category */
        foreach ($product->getCategories() as $category) {
            $productCopy->addCategory($category);
        }

        /* @var ProductCustomField $customField */
        foreach ($product->getCustomFields() as $customField) {
            $customFieldCopy = new ProductCustomField();
            $customFieldCopy->setProduct($productCopy);
            $customFieldCopy->setSettingField($customField->getSettingField());
            $customFieldCopy->setValue($customField->getValue());

            $em->persist($customFieldCopy);

            $productCopy->addCustomField($customFieldCopy);
        }

        $em->flush();


        return $this->redirect($this->generateUrl('product_show', array("id" => $productCopy->getId())));
    }
1102725
public function setLineItem(\HarvestCloud\CoreBundle\Entity\OrderLineItem $lineItem)
    {
        $this->lineItem = $lineItem;
        $lineItem->setStockTransaction($this);
    }
1155051
public function transformFromOrder(OrderInterface $order, InvoiceInterface $invoice)
    {
        $event = new OrderTransformEvent($order);
        $this->eventDispatcher->dispatch(TransformerEvents::PRE_ORDER_TO_INVOICE_TRANSFORM, $event);

        $invoice->setName($order->getBillingName());
        $invoice->setAddress1($order->getBillingAddress1());
        $invoice->setAddress2($order->getBillingAddress2());
        $invoice->setAddress3($order->getBillingAddress3());
        $invoice->setCity($order->getBillingCity());
        $invoice->setCountry($order->getBillingCountryCode());
        $invoice->setPostcode($order->getBillingPostcode());

        $invoice->setEmail($order->getBillingEmail());
        $invoice->setFax($order->getBillingFax());
        $invoice->setMobile($order->getBillingMobile());
        $invoice->setPhone($order->getBillingPhone());
        $invoice->setReference($order->getReference());

        $invoice->setCurrency($order->getCurrency());
        $invoice->setCustomer($order->getCustomer());
        $invoice->setTotalExcl($order->getTotalExcl());
        $invoice->setTotalInc($order->getTotalInc());

        $invoice->setPaymentMethod($order->getPaymentMethod());

        $invoice->setLocale($order->getLocale());

        foreach ($order->getOrderElements() as $orderElement) {
            $invoiceElement = $this->createInvoiceElementFromOrderElement($orderElement);
            $invoiceElement->setInvoice($invoice);
            $invoice->addInvoiceElement($invoiceElement);
        }

        if ($order->getDeliveryCost() > 0) {
            $this->addDelivery($invoice, $order);
        }

        $invoice->setStatus(InvoiceInterface::STATUS_OPEN);

        $event = new InvoiceTransformEvent($invoice);
        $this->eventDispatcher->dispatch(TransformerEvents::POST_ORDER_TO_INVOICE_TRANSFORM, $event);
    }
303125
public function removeInvoice(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Invoice\Invoice $invoice)
    {
        return $this->invoices->removeElement($invoice);
    }
250699
public function setProduct(\Magento\Catalog\Model\Product $product)
    {
        $this->setProductName($product->getName());
        $this->setProductSku($product->getSku());

        return $this;
    }
700591
public function setProduct(\Amulen\ShopBundle\Entity\Product $product = null)
    {
        $this->product = $product;

        return $this;
    }