From e867a957842a6905a5c6ab745abcc2796c1a05f6 Mon Sep 17 00:00:00 2001 From: TheCoreDev Date: Tue, 11 May 2021 11:32:25 +0200 Subject: [PATCH] =?UTF-8?q?On=20envoie=20=C3=A0=20l'API=20beds24=20le=20pr?= =?UTF-8?q?ix=20de=20la=20chambre?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++ local/modules/Beds24/Beds24/Beds24Request.php | 19 ++++++++++++ .../modules/Beds24/Loop/RoomAvailability.php | 2 +- .../default/ajax/product-search-results.html | 2 +- templates/frontOffice/am/product.html | 29 ++++++++++--------- 5 files changed, 39 insertions(+), 16 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..29768831 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/web/cache/ +/web/assets/ +/log/ diff --git a/local/modules/Beds24/Beds24/Beds24Request.php b/local/modules/Beds24/Beds24/Beds24Request.php index f0270d0d..29c470e5 100644 --- a/local/modules/Beds24/Beds24/Beds24Request.php +++ b/local/modules/Beds24/Beds24/Beds24Request.php @@ -115,6 +115,19 @@ class Beds24Request $lastNight = $booking->getEndDate(); $lastNight->sub(new \DateInterval("P1D")); + $price = $booking->getOrder()->getTotalAmount(); + $taxe = $booking->getOrderProduct()->getOrderProductTaxes()->getFirst(); + $tva = $taxe->getAmount(); + + $invoiceArray = array(); + $invoiceArray['description'] = "Location"; + $invoiceArray['status'] = "Paid"; + $invoiceArray['qty'] = 1; + $invoiceArray['price'] = $price; + $invoiceArray['vatRate'] = 20; + $invoiceArray['type'] = 1; + $invoiceArray['invoiceId'] = ""; + $requestParameters = [ "roomId" => $booking->getRoomId(), "roomQty" => 1, @@ -134,6 +147,12 @@ class Beds24Request "guestPostcode"=> $address->getZipcode(), "guestCountry"=> $address->getCountry()->setLocale($locale)->getTitle(), + "price" => $price, + "deposit" => 0, + "tax" => $tva, + "commission" => 0, + "invoice" => $invoiceArray + // "notifyGuest" => true, // "notifyHost" => true ]; diff --git a/local/modules/Beds24/Loop/RoomAvailability.php b/local/modules/Beds24/Loop/RoomAvailability.php index 85c5ac3f..c52b2a56 100644 --- a/local/modules/Beds24/Loop/RoomAvailability.php +++ b/local/modules/Beds24/Loop/RoomAvailability.php @@ -139,7 +139,7 @@ class RoomAvailability extends BaseLoop implements ArraySearchLoopInterface } } - // print_r($result); + //print_r($result); return $result; } diff --git a/local/modules/Beds24/templates/frontOffice/default/ajax/product-search-results.html b/local/modules/Beds24/templates/frontOffice/default/ajax/product-search-results.html index 3d47e524..ec12b122 100644 --- a/local/modules/Beds24/templates/frontOffice/default/ajax/product-search-results.html +++ b/local/modules/Beds24/templates/frontOffice/default/ajax/product-search-results.html @@ -15,4 +15,4 @@ "available": false, "error": "{$error}" } -{/elseloop} +{/elseloop} \ No newline at end of file diff --git a/templates/frontOffice/am/product.html b/templates/frontOffice/am/product.html index 71ff56d8..992e5c07 100644 --- a/templates/frontOffice/am/product.html +++ b/templates/frontOffice/am/product.html @@ -160,20 +160,21 @@ {$available = false} {* Si le bien est dispo aux dates mémorisées on prend le prix indiqué *} - {loop type="beds24.availability" name="disponibilite" product_id=$product_id use_saved_search_criteria=true} - {$available = true} - - - {intl l="Special Price:"} {format_money number=$PRICE symbol={currency attr="symbol"}} + {ifloop rel='disponibilite'} + {loop type="beds24.availability" name="disponibilite" product_id=$product_id use_saved_search_criteria=true} + {$available = true} + + + {intl l="Special Price:"} {format_money number=$PRICE symbol={currency attr="symbol"}} + - - {if $PRICE neq $PRICE_REMISE} - Prix remisé : {format_money number=$PRICE_REMISE symbol={currency attr="symbol"}} - - Remise : -{$REMISE}% - - Nb jours : {$NB_JOURS} jour(s) - {/if} - {/loop} - + {if $PRICE neq $PRICE_REMISE} + Prix remisé : {format_money number=$PRICE_REMISE symbol={currency attr="symbol"}} + - Remise : -{$REMISE}% + - Nb jours : {$NB_JOURS} jour(s) + {/if} + {/loop} + {/ifloop} {elseloop rel='disponibilite'} {* Pas de dispo avec les paramètres mémorisés récupérer le prix mini *} {loop type="beds24.description" name="description" product_id=$product_id} @@ -188,7 +189,7 @@ {else} {$available = true} - {* List of condition : NewCondition, DamagedCondition, UsedCondition, RefurbishedCondition *} + {* List of condition : NewCondition, DamagedCondition, UsedCondition, RefurbishedCondition *} {* List of currency : The currency used to describe the product price, in three-letter ISO format. *}