Adds a product to the shopping cart
776304
public Completable addProduct(Product product) {
    List<Product> updatedShoppingCart = new ArrayList<>();
    updatedShoppingCart.addAll(itemsInShoppingCart.getValue());
    updatedShoppingCart.add(product);
    itemsInShoppingCart.onNext(updatedShoppingCart);
    return Completable.complete();
  }
744450
def shop(self, index):
        
        return UserShopFront(self.usr, item.owner, item.id, str(item.price))
396995
def admin_add
      return if !user_is_allowed('products', 'add')
      
      resp = Caboose::StdClass.new(
        :error => nil,
        :redirect => nil
      )
      
      title = params[:title]
      
      if title.length == 0
        resp.error = "The title cannot be empty."
      else
        p = Product.new(:title => title)
        p.save
        resp.redirect = "/admin/products/#{p.id}/general"
      end
      render :json => resp    
    end
849146
def add(self, name, session, pict_url=None, parent_cid=None, sort_order=None):
        ''''''
        request = TOPRequest('taobao.sellercats.list.add')
        request['name'] = name
        if pict_url!=None: request['pict_url'] = pict_url
        if parent_cid!=None: request['parent_cid'] = parent_cid
        if sort_order!=None: request['sort_order'] = sort_order
        self.create(self.execute(request, session)['seller_cat'])
        return self
299615
private function addRecommendedProducts(
        &$productsToDisplayCounter,
        $limit,
        $maxPerChild,
        $recommendedProducts,
        &$productsToDisplay,
        &$product
    ) {
        $i = 0;

        foreach ($recommendedProducts as $product) {
            //check if still exists
            if ($product->getId() && $productsToDisplayCounter < $limit
                && $i <= $maxPerChild
                && $product->isSaleable()
                && !$product->getParentId()
            ) {
                //we have a product to display
                $productsToDisplay[$product->getId()] = $product;
                $i++;
                $productsToDisplayCounter++;
            }
        }
    }
524989
private function createCartItem($id, $name, $qty, $price, array $options)
    {
        if ($id instanceof Buyable) {
            $cartItem = CartItem::fromBuyable($id, $qty ?: []);
            $cartItem->setQuantity($name ?: 1);
            $cartItem->associate($id);
        } elseif (is_array($id)) {
            $cartItem = CartItem::fromArray($id);
            $cartItem->setQuantity($id['qty']);
        } else {
            $cartItem = CartItem::fromAttributes($id, $name, $price, $options);
            $cartItem->setQuantity($qty);
        }

        $cartItem->setTaxRate(config('cart.tax'));

        return $cartItem;
    }
1103303
public function addProductSaleElementAction()
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) {
            return $response;
        }

        $event = new ProductSaleElementCreateEvent(
            $this->getExistingObject(),
            $this->getRequest()->get('combination_attributes', array()),
            $this->getCurrentEditionCurrency()->getId()
        );

        try {
            $this->dispatch(TheliaEvents::PRODUCT_ADD_PRODUCT_SALE_ELEMENT, $event);
        } catch (\Exception $ex) {
            // Any error
            return $this->errorPage($ex);
        }

        return $this->redirectToEditionTemplate();
    }
803316
def do_add_item(self, args):
        """"""
        if args.food:
            add_item = args.food
        elif args.sport:
            add_item = args.sport
        elif args.other:
            add_item = args.other
        else:
            add_item = 'no items'

        self.poutput("You added {}".format(add_item))
913728
def add_to_cart_link(item)
      link_to(mongoid_cart.add_item_path(item: {type: item.class.to_s, id: item._id}), {class: "btn btn-default"}) do
        (tag :i, class: 'fa fa-cart-plus').concat('Add to cart')
      end
    end
502372
public function moveItemsTo(Cart $cart){

        \DB::transaction(function () use(&$cart){
            $current_items = $cart->items()->pluck('product_id');
            $items_to_move = $this->items()->whereNotIn('product_id', $current_items->toArray())->get();
            if($items_to_move->count() === 0){
                return;
            }
            $this->items()->whereNotIn('product_id', $current_items->toArray())->update([
                'cart_id' => $cart->id
            ]);
            foreach($items_to_move as $item) {
                $this->item_count -= $item->quantity;
                $this->total_price -= $item->getPrice();
                $cart->item_count += $item->quantity;
                $cart->total_price += $item->getPrice();
            }
            $this->relations = [];
            $cart->relations = [];
            $this->save();
            $cart->save();
        });
        return $cart;
    }
585645
function addItem($access_name, $text, $url) {
        Map::instance()
           ->add(
               $access_name, $text, $url
           );
        return $this;
    }
529679
public function save()
    {
        Session::clear("Checkout.PostageID");
        
        // Extend our save operation
        $this->extend("onBeforeSave");

        // Save cart items
        Session::set(
            "Checkout.ShoppingCart.Items",
            serialize($this->items)
        );

        // Save cart discounts
        Session::set(
            "Checkout.ShoppingCart.Discount",
            serialize($this->discount)
        );

        // Update available postage
        if ($data = Session::get("Form.Form_PostageForm.data")) {
            $country = $data["Country"];
            $code = $data["ZipCode"];
            $this->setAvailablePostage($country, $code);
        }
    }
370107
public function addItem($product, $quantity, $detail, $price)
    {
        $item = new stdClass();
        $item->product = $product;
        $item->quantity = $quantity;
        $item->detail = $detail;
        $item->price = $this->convertAmount($price);

        $this->data->items[] = $item;

        return $this;
    }
352136
def add(self, quote_id, coupon_code, store_view=None):
        
        return bool(
            self.call('cart_coupon.add', [quote_id, coupon_code, store_view])
        )
444845
public function pushCart() {
    $cart = $this->cart;

    if (!$cart) {
      return;
    }

    // Cart exists, derive update array and update cookie.
    $this->setCookie('acm_cart_id', $cart->id());
    $update = $cart->getCart();
    $cart_event = $this->eventDispatcher->dispatch(Events::PUSH_CART, new CartPushEvent($update));
    $cart_response = (object) $this->apiWrapper->updateCart($cart->id(), $cart_event->getRawCart());

    if (empty($cart_response)) {
      return;
    }

    return $cart;
  }
206407
public function addDiscArt()
    {
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();
        $articleIds = $this->_getActionIds('oxarticles.oxid');
        $discountListId = $config->getRequestParameter('synchoxid');

        // adding
        if ($config->getRequestParameter('all')) {
            $articleTable = $this->_getViewName('oxarticles');
            $articleIds = $this->_getAll(parent::_addFilter("select $articleTable.oxid " . $this->_getQuery()));
        }
        if ($discountListId && $discountListId != self::NEW_DISCOUNT_LIST_ID && is_array($articleIds)) {
            foreach ($articleIds as $articleId) {
                $this->addArticleToDiscount($discountListId, $articleId);
            }
        }
    }
227535
public function CartForm()
    {
        $fields = new FieldList();

        $actions = new FieldList(
            FormAction::create('doUpdate', _t('Checkout.UpdateCart', 'Update Cart'))
                ->addExtraClass('btn')
                ->addExtraClass('btn-blue btn-info')
        );

        $form = Form::create($this, "CartForm", $fields, $actions)
            ->addExtraClass("forms")
            ->setTemplate("ShoppingCartForm");

        $this->extend("updateCartForm", $form);

        return $form;
    }