Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ptibogxiv committed Sep 27, 2023
1 parent 1f5c6fc commit 247aff5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion functions/data-request.php
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ function dolicart_request() {
];

if ($qty != $result['newqty']) { $response['modal'] = doliModalTemplate('CartInfos', __( 'Cart', 'doliconnect'), __( 'This item is not available in this quantity!', 'doliconnect'), '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">'.__( "Continue shopping", "doliconnect").'</button> <a class="btn btn-primary" role="button" href="'.esc_url(doliconnecturl('dolicart')).'" >'.__( 'Finalize the order', 'doliconnect').'</a>', 'modal-lg'); }
elseif (doliCheckRelatedProducts($product->id)) { $response['modal'] = doliModalTemplate('CartInfos', __( 'Related products', 'doliconnect'), 'to do', '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">'.__( "Close", "doliconnect").'</button>', 'modal-lg'); }
elseif (doliCheckRelatedProducts($product->id)) { $response['modal'] = doliModalTemplate('CartInfos', __( 'Related products', 'doliconnect'), doliRelatedProducts($product->id), '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">'.__( "Close", "doliconnect").'</button>', 'modal-lg'); }
wp_send_json_success($response);
die();
} elseif (isset($_POST['modify']) && ($_POST['modify'] == "wish" || $_POST['modify'] == "unwish")) {
Expand Down
14 changes: 14 additions & 0 deletions functions/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ function doliCheckRelatedProducts($id) {
}
}

function doliRelatedProducts($id) {
$request = "/relatedproducts/".$id;
$relatedproducts = callDoliApi("GET", $request, null, dolidelay('product', esc_attr(isset($_GET["refresh"]) ? $_GET["refresh"] : null)));
if ( !isset( $relatedproducts->error ) && $relatedproducts != null ) {
$related = null;
foreach ( $relatedproducts as $product ) {
$related .= apply_filters( 'doliproductlist', $product->id);
}
return $related;
} else {
return false;
}
}

function doliprice($object = null, $mode = "ttc", $currency = null) {
global $current_user;
if ( is_object($object) ) {
Expand Down

0 comments on commit 247aff5

Please sign in to comment.