関数
Cart::inCartCheckComboSet( array $postdata )
パラメータ パラメータ
- $postdata
(配列) (必須)
ファイル: src/API/Cart.php
public static function inCartCheckComboSet($postdata) {
global $usces;
/**
* Check stock and item options for the combo-set item itself
*
* Note that at this point we haven't checked options or stock for group items so there may be a case
* where the following `$usces->incart_check()` exits before we can construct group item error messages.
*
* However, by default, Welcart will use JavaScript to check that all required options are selected
* for the item. Therefore, `$usces->incart_check()` will only exit with an error if there
* is no stock. If there is no stock then it doesn't matter whether group items are valid
* since the item can't be purchased anyways which is why we make the call here.
*/
$usces->incart_check(); // will exit to the item page if any checks fail
// back up the $_POST object
$backuppost = $_POST;
foreach ($postdata as $post) {
// overwrite $_POST since `$usces->incart_check()` takes no parameters...
$_POST = array_merge($_POST, $post);
// Check stock, options, etc for each item.
$usces->incart_check(); // exits to the cart page if any checks fail
}
// restore the $_POST object
$_POST = $backuppost;
}