Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ptibogxiv committed Oct 1, 2023
1 parent 109abcf commit 02d6d25
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions functions/data-request.php
Original file line number Diff line number Diff line change
Expand Up @@ -804,8 +804,8 @@ function dolicart_request() {
}
$price = doliProductPrice($product, $qty, false, true);
$result = doliaddtocart($product, $mstock, $qty, $price, isset($_POST['product-add-timestamp_start'])?trim($_POST['product-add-timestamp_start']):null, isset($_POST['product-add-timestamp_end'])?trim($_POST['product-add-timestamp_end']):null);
if (doliRequiredRelatedProducts($product->id, false)) {
doliRequiredRelatedProducts($product->id, true);
if (!empty(doliRequiredRelatedProducts($product->id, false))) {
$result2 = doliRequiredRelatedProducts($product->id, true);
}
$response = [
'message' => dolialert('success', $result['message']),
Expand Down
9 changes: 7 additions & 2 deletions functions/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ function doliRequiredRelatedProducts($id, $valid = false) {
if (empty($valid)) {
return true;
} else {
foreach ( $relatedproducts as $product ) {
//$related = apply_filters( 'doliproductlist', $product);
foreach ( $relatedproducts as $product ) {
$qty = $product->qty;
$product = callDoliApi("GET", "/products/".$product->id."?includestockdata=1&includesubproducts=true&includetrans=true", null, dolidelay('product', true));
$mstock = doliProductStock($product, false, true);
$price = doliProductPrice($product, $qty, false, true);
$related = doliaddtocart($product, $mstock, $qty, $price, null, null);
}
return $related;
}
} else {
return false;
Expand Down

0 comments on commit 02d6d25

Please sign in to comment.