PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.0
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.0
1.7.0 1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 All 50 releases
← All changes | app/Models/Order.php +41 -0 1.6.5 → 1.7.0 View file →
@@ -1134,8 +1134,49 @@
1134 1134 {
1135 1135 return add_query_arg(['download' => 1], $this->getReceiptViewUrl());
1136 1136 }
1137 1137
1138 + /**
1139 + * The public "review your order" page for this order.
1140 + *
1141 + * Same shape as the receipt URL, and the same credential: the order uuid.
1142 + * That is what lets the link work in an email to a guest-checkout buyer,
1143 + * who has no account to log into — see
1144 + * ProductReviewService::resolveOrderGrant().
1145 + *
1146 + * @return string
1147 + */
1148 + public function getOrderReviewUrl()
1149 + {
1150 + return static::reviewUrlForHash((string) $this->uuid);
1151 + }
1152 +
1153 + /**
1154 + * The order-review URL for an order hash, without loading the order —
1155 + * the email parsers already hold the hash.
1156 + *
1157 + * @param string $orderHash
1158 + * @return string
1159 + */
1160 + public static function reviewUrlForHash($orderHash)
1161 + {
1162 + // The store's chosen page wins when it has one: it carries the theme's
1163 + // header, footer and styling, which the query route deliberately does
1164 + // not. getOrderReviewPage() returns home_url() when nothing is picked,
1165 + // which is exactly when the route should answer instead.
1166 + $storeSettings = new \FluentCart\Api\StoreSettings();
1167 + $pageUrl = $storeSettings->getOrderReviewPage();
1168 +
1169 + if ($pageUrl && $pageUrl !== home_url()) {
1170 + return add_query_arg(['order_hash' => $orderHash], $pageUrl);
1171 + }
1172 +
1173 + return add_query_arg([
1174 + 'fluent-cart' => 'order-review',
1175 + 'order_hash' => $orderHash,
1176 + ], home_url());
1177 + }
1178 +
1138 1179 public function addLog($title, $description = '', $type = 'info', $by = '')
1139 1180 {
1140 1181
1141 1182 fluent_cart_add_log(