Add Product Seven

@param Basket $basket
@return Basket
337072
private function addProductSeven(Basket $basket)
    {
        $seven = $this->products->seven();

        $basket->add($seven->sku, $seven->name, $seven->price, function ($product) use ($seven) {
            $product->quantity($seven->quantity);
            $product->discount($seven->discount);
            $product->delivery($seven->delivery);
        });

        return $basket;
    }
1299662
public function addProduct(\Sulu\Bundle\ProductBundle\Entity\ProductInterface $products)
    {
        $this->products[] = $products;

        return $this;
    }
443627
public function setBasket(Basket $basket = null)
    {
        if ($this->basket) {
            $this->basket->setOrder(null);
        }

        $this->basket = $basket;

        if ($basket) {
            $basket->setOrder($this);
        }

        return $this;
    }
1115091
public function addBasketItemParams()
    {
        $basket = $this->getBasket();
        $lang = $this->getLang();
        $request = $this->getPayPalRequest();

        $pos = 0;
        foreach ($basket->getContents() as $basketItem) {
            $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", \OxidEsales\Eshop\Core\Str::getStr()->html_entity_decode($basketItem->getTitle()));
            $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basketItem->getUnitPrice()->getPrice()));
            $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", (int) $basketItem->getAmount());
            $request->setParameter("L_PAYMENTREQUEST_0_ITEMURL{$pos}", $basketItem->getLink());

            $basketProduct = $basketItem->getArticle();
            $request->setParameter("L_PAYMENTREQUEST_0_NUMBER{$pos}", $basketProduct->oxarticles__oxartnum->value);

            $pos++;
        }

        //adding payment costs as product
        if ($basket->getPayPalPaymentCosts() > 0) {
            $paymentTitle = $lang->translateString("OEPAYPAL_SURCHARGE") . " " . $lang->translateString("OEPAYPAL_TYPE_OF_PAYMENT");
            $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $paymentTitle);
            $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalPaymentCosts()));
            $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1);

            $pos++;
        }

        //adding wrapping as product
        if ($basket->getPayPalWrappingCosts() > 0) {
            $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $lang->translateString("OEPAYPAL_GIFTWRAPPER"));
            $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalWrappingCosts()));
            $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1);

            $pos++;
        }

        //adding greeting card as product
        if ($basket->getPayPalGiftCardCosts() > 0) {
            $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $lang->translateString("OEPAYPAL_GREETING_CARD"));
            $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalGiftCardCosts()));
            $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1);

            $pos++;
        }
    }
197658
public function add($a, $b)
    {
        return bcadd($this->bcNormalize($a), $this->bcNormalize($b));
    }
514876
public function addItem(ProductPurchase $item)
    {
        $item->setTransaction($this);
        $this->items->add($item);

        return $this;
    }
1222076
public function generate(Basket $basket)
    {
        $total = new Money(0, $basket->currency());

        foreach ($basket->products() as $product) {
            $total = $total->add($this->reconciler->discount($product));
        }

        if ($discount = $basket->discount) {
            $total = $this->calculateTotalWithDiscount($basket, $discount);
        }

        return $total;
    }
452976
public static function markBasketPaid(Basket $basket)
    {
        $basket->Status = Basket::STATUS_COMPLETED;
        $basket->save();
        $session = SuperCMSSession::singleton();
        $session->basketId = 0;
        $session->storeSession();
    }
1285502
public function add(Money $money)
    {
        $sum = $this->getAmount() + $money->getAmount();
        $this->setWhole($sum);
        $this->setFraction($sum);
        return $this;
    }
1256953
public function meta(Basket $basket)
    {
        $meta = [];

        foreach ($this->metadata as $item) {
            $meta[$item->name()] = $item->generate($basket);
        }

        return $meta;
    }
1110025
public function addProduct(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Product\Product $product)
    {
        $this->products[] = $product;

        return $this;
    }
185647
public function renderFinalReviewBasketElementAction(BasketElementInterface $basketElement, BasketInterface $basket)
    {
        $action = sprintf('%s:renderFinalReviewBasketElement', $basketElement->getProductProvider()->getBaseControllerName());

        $response = $this->forward($action, [
            'basketElement' => $basketElement,
            'basket' => $basket,
        ]);

        if ($this->get('kernel')->isDebug()) {
            $response->setContent(sprintf("\n<!-- [Sonata] Product code: %s, id: %s, action: %s -->\n%s\n<!-- [Sonata] end product -->\n",
                $basketElement->getProductCode(),
                $basketElement->getProductId(),
                $action,
                $response->getContent()
            ));
        }

        return $response;
    }
665837
public function createBasketAction(Request $request)
    {
        $name = $request->get('name');

        if (trim(strip_tags($name)) === '') {
            return $this->getBadRequestAction($request, 'Missing basket name parameter');
        }

        $Basket = new Basket();
        $Basket->setUser($this->getAuthenticatedUser());
        $Basket->setName($name);

        /** @var EntityManager $em */
        $em = $this->app['orm.em'];
        $em->persist($Basket);
        $em->flush();

        return Result::create($request, ["basket" => $this->listBasket($Basket)])->createResponse();
    }
579698
public function addProductAction(Product $product, $quantity, Request $request)
    {
        // Find OrderCollection
        $orderCollection = $this->getCurrentCart();

        $quantity = array_key_exists('quantity', $_POST) ? (int) $_POST['quantity'] : $quantity;

        try
        {
            if ('-' == $request->get('remove'))
            {
                $quantity = -1 * $quantity;
            }

            // Add Product to OrderCollection
            $lineItem = $orderCollection->addProduct($product, $quantity);

            // Persisting cascades to Order and OrderCollection
            $em = $this->getDoctrine()->getEntityManager();
            $em->persist($lineItem);
            $em->flush();

            if ($quantity > 0) {
                $notice = 'Added '.$quantity.' '
                    .$product->getUnitForNumber($quantity).' of '
                    .$product->getName().' to your cart';
            } else {
                $quantity = abs($quantity);
                $notice = 'Removed '.$quantity.' '
                    .$product->getUnitForNumber($quantity).' of '
                    .$product->getName().' from your cart';
            }

            // Set flash message
            $this->get('session')->getFlashBag()->add('notice', $notice);

            // Save the OrderCollection to the session
            $this->getRequest()->getSession()->set('cart_id', $orderCollection->getId());
        }
        catch (\Exception $e)
        {
            // could not add Product to cart
        }

        $last_route = $request->get('referer');

        if (in_array($last_route, array('_welcome')))
        {
            return $this->redirect($this->generateUrl($last_route));
        }

        return $this->redirect($this->generateUrl('Profile_product_show', array(
            'product_slug' => $product->getSlug(),
            'slug'         => $product->getSeller()->getSlug(),
        )));
    }
767761
protected function createSubscriptions( \Aimeos\MShop\Order\Item\Base\Iface $basket )
	{
		$manager = \Aimeos\MShop::create( $this->getContext(), 'subscription' );

		foreach( $basket->getProducts() as $orderProduct )
		{
			if( ( $interval = $orderProduct->getAttribute( 'interval', 'config' ) ) !== null )
			{
				$item = $manager->createItem()->setInterval( $interval )
					->setOrderProductId( $orderProduct->getId() )
					->setOrderBaseId( $basket->getId() );

				if( ( $end = $orderProduct->getAttribute( 'intervalend', 'custom' ) ) !== null
					|| ( $end = $orderProduct->getAttribute( 'intervalend', 'config' ) ) !== null
					|| ( $end = $orderProduct->getAttribute( 'intervalend', 'hidden' ) ) !== null
				) {
					$item = $item->setDateEnd( $end );
				}

				$manager->saveItem( $item, false );
			}
		}
	}
212555
private function listBasket(Basket $basket)
    {
        $ret = [
            'basket_id' => $basket->getId(),
            'owner' => $this->listUser($basket->getUser()),
            'created_on' => $basket->getCreated()->format(DATE_ATOM),
            'description' => (string) $basket->getDescription(),
            'name' => $basket->getName(),
            'pusher_usr_id'     => $basket->getPusher() ? $basket->getPusher()->getId() : null,
            'pusher'            => $basket->getPusher() ? $this->listUser($basket->getPusher()) : null,
            'updated_on'        => $basket->getUpdated()->format(DATE_ATOM),
            'unread'            => !$basket->isRead(),
            'validation_basket' => !!$basket->getValidation(),
        ];

        if ($basket->getValidation()) {
            $users = array_map(function (ValidationParticipant $participant) {
                $user = $participant->getUser();

                return [
                    'usr_id' => $user->getId(),
                    'usr_name' => $user->getDisplayName(),
                    'confirmed' => $participant->getIsConfirmed(),
                    'can_agree' => $participant->getCanAgree(),
                    'can_see_others' => $participant->getCanSeeOthers(),
                    'readonly' => $user->getId() != $this->getAuthenticatedUser()->getId(),
                    'user' => $this->listUser($user),
                ];
            }, iterator_to_array($basket->getValidation()->getParticipants()));

            $expires_on_atom = NullableDateTime::format($basket->getValidation()->getExpires());

            $ret = array_merge([
                'validation_users'          => $users,
                'expires_on'                => $expires_on_atom,
                'validation_infos'          => $basket->getValidation()
                    ->getValidationString($this->app, $this->getAuthenticatedUser()),
                'validation_confirmed'      => $basket->getValidation()
                    ->getParticipant($this->getAuthenticatedUser())
                    ->getIsConfirmed(),
                'validation_initiator'      => $basket->getValidation()
                    ->isInitiator($this->getAuthenticatedUser()),
                'validation_initiator_user' => $this->listUser($basket->getValidation()->getInitiator()),
            ], $ret);
        }

        return $ret;
    }
462126
private function addProductOne(Basket $basket)
    {
        $one = $this->products->one();

        $basket->add($one->sku, $one->name, $one->price, function ($product) use ($one) {
            $product->category($one->category);
        });

        return $basket;
    }