| @@ 337-359 (lines=23) @@ | ||
| 334 | * |
|
| 335 | * @return boolean |
|
| 336 | */ |
|
| 337 | public function addProductToBasket($credentials, $shop_id, $product_id, $product_variation_id, $quantity = 1, $text = '', $product_detail_id = 0) |
|
| 338 | { |
|
| 339 | if (is_object($return = $this->checkCredentials($credentials))) { |
|
| 340 | return $return; |
|
| 341 | } |
|
| 342 | ||
| 343 | $this->_factoryWebshop($shop_id); |
|
| 344 | ||
| 345 | if (!is_numeric($product_id)) { |
|
| 346 | require_once 'XML/RPC2/Exception.php'; |
|
| 347 | throw new XML_RPC2_FaultException('product id must be an integer', -5); |
|
| 348 | } |
|
| 349 | ||
| 350 | $product_id = $this->processRequestData(intval($product_id)); |
|
| 351 | $product_variation_id = $this->processRequestData(intval($product_variation_id)); |
|
| 352 | $quantity = $this->processRequestData(intval($quantity)); |
|
| 353 | $text = $this->processRequestData($text); |
|
| 354 | $product_detail_id = $this->processRequestData(intval($product_detail_id)); |
|
| 355 | ||
| 356 | return $this->prepareResponseData( |
|
| 357 | $this->webshop->getBasket()->add($product_id, $product_variation_id, $quantity, $text, $product_detail_id) |
|
| 358 | ); |
|
| 359 | } |
|
| 360 | ||
| 361 | /** |
|
| 362 | * Change the quantity of one product in basket |
|
| @@ 586-608 (lines=23) @@ | ||
| 583 | * |
|
| 584 | * @return boolean |
|
| 585 | */ |
|
| 586 | public function addProductToBasket($credentials, $shop_id, $product_id, $product_variation_id, $quantity = 1, $text = '', $product_detail_id = 0) |
|
| 587 | { |
|
| 588 | if (is_object($return = $this->checkCredentials($credentials))) { |
|
| 589 | return $return; |
|
| 590 | } |
|
| 591 | ||
| 592 | $this->_factoryWebshop($shop_id); |
|
| 593 | ||
| 594 | if (!is_numeric($product_id)) { |
|
| 595 | require_once 'XML/RPC2/Exception.php'; |
|
| 596 | throw new XML_RPC2_FaultException('product id must be an integer', -5); |
|
| 597 | } |
|
| 598 | ||
| 599 | $product_id = $this->processRequestData(intval($product_id)); |
|
| 600 | $product_variation_id = $this->processRequestData(intval($product_variation_id)); |
|
| 601 | $quantity = $this->processRequestData(intval($quantity)); |
|
| 602 | $text = $this->processRequestData($text); |
|
| 603 | $product_detail_id = $this->processRequestData(intval($product_detail_id)); |
|
| 604 | ||
| 605 | return $this->prepareResponseData( |
|
| 606 | $this->webshop->getBasket()->add($product_id, $product_variation_id, $quantity, $text, $product_detail_id) |
|
| 607 | ); |
|
| 608 | } |
|
| 609 | ||
| 610 | /** |
|
| 611 | * Change the quantity of one product in basket |
|
| @@ 750-772 (lines=23) @@ | ||
| 747 | * |
|
| 748 | * @return boolean |
|
| 749 | */ |
|
| 750 | public function addProductToBasket($credentials, $shop_id, $product_id, $product_variation_id, $quantity = 1, $text = '', $product_detail_id = 0) |
|
| 751 | { |
|
| 752 | if (is_object($return = $this->checkCredentials($credentials))) { |
|
| 753 | return $return; |
|
| 754 | } |
|
| 755 | ||
| 756 | $this->_factoryWebshop($shop_id); |
|
| 757 | ||
| 758 | if (!is_numeric($product_id)) { |
|
| 759 | require_once 'XML/RPC2/Exception.php'; |
|
| 760 | throw new XML_RPC2_FaultException('product id must be an integer', -5); |
|
| 761 | } |
|
| 762 | ||
| 763 | $product_id = $this->processRequestData(intval($product_id)); |
|
| 764 | $product_variation_id = $this->processRequestData(intval($product_variation_id)); |
|
| 765 | $quantity = $this->processRequestData(intval($quantity)); |
|
| 766 | $text = $this->processRequestData($text); |
|
| 767 | $product_detail_id = $this->processRequestData(intval($product_detail_id)); |
|
| 768 | ||
| 769 | return $this->prepareResponseData( |
|
| 770 | $this->webshop->getBasket()->add($product_id, $product_variation_id, $quantity, $text, $product_detail_id) |
|
| 771 | ); |
|
| 772 | } |
|
| 773 | ||
| 774 | /** |
|
| 775 | * Change the quantity of one product in basket |
|