diff --git a/functions/data-request.php b/functions/data-request.php index 943af81d..ae9cc233 100644 --- a/functions/data-request.php +++ b/functions/data-request.php @@ -819,7 +819,7 @@ function dolicart_request() { ]; //if ($qty != $result['newqty']) { $response['modal'] = doliModalTemplate('CartInfos', __( 'Cart', 'doliconnect'), __( 'This item is not available in this quantity!', 'doliconnect'), ' '.__( 'Finalize the order', 'doliconnect').'', 'modal-lg'); } - if (doliCheckModules('relatedproducts') && doliCheckRelatedProducts($product->id)) { $response['modal'] = doliModalTemplate('CartInfos', __( 'Related products', 'doliconnect'), doliRelatedProducts($product->id), '', 'modal-lg', null, 'p-0'); } + if (doliCheckModules('relatedproducts') && doliCheckRelatedProducts($product->id)) { $response['modal'] = doliModalTemplate('CartInfos', __( 'Related products', 'doliconnect'), doliRelatedProducts($product->id, true), '', 'modal-lg', null, 'p-0'); } wp_send_json_success($response); die(); } elseif (isset($_POST['modify']) && ($_POST['modify'] == "wish" || $_POST['modify'] == "unwish")) { diff --git a/functions/product.php b/functions/product.php index 66720bdc..954d0c9f 100644 --- a/functions/product.php +++ b/functions/product.php @@ -40,7 +40,7 @@ function doliCheckRelatedProducts($id) { } } -function doliRelatedProducts($fk_parent_line) { +function doliRelatedProducts($fk_parent_line, $refresh = false) { $request = "/relatedproducts/".$fk_parent_line; $relatedproducts = callDoliApi("GET", $request, null, dolidelay('product', esc_attr(isset($_GET["refresh"]) ? $_GET["refresh"] : null))); if ( !isset( $relatedproducts->error ) && $relatedproducts != null ) { @@ -668,7 +668,7 @@ function doliconnect_supplier($product, $refresh = false){ } // list of products filter -function doliproductlist($product, $fk_parent_line = null) { +function doliproductlist($product, $refresh = false, $fk_parent_line = null) { global $current_user; $wish = 0; @@ -724,7 +724,7 @@ function doliproductlist($product, $fk_parent_line = null) { $list .= ""; return $list; } -add_filter( 'doliproductlist', 'doliproductlist', 10, 2); +add_filter( 'doliproductlist', 'doliproductlist', 10, 3); // list of products filter function doliproductcard($product, $attributes) {