Skip to content

Commit

Permalink
- Error with multiple different products
Browse files Browse the repository at this point in the history
  • Loading branch information
srexi committed Jun 18, 2020
1 parent 22ba331 commit 0382616
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions inc/plugins/rexshop.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function rexshop_info()
"website" => "https://shop.rexdigital.group",
"author" => "RexDigitalGroup",
"authorsite" => "https://rexdigital.group",
"version" => "1.0",
"version" => "1.01",
"guid" => "",
"compatibility" => "18*,16*"
);
Expand Down Expand Up @@ -216,13 +216,17 @@ function rexshop_payment_page()

$selectedProduct = null;
foreach ($products as $product) {
if (!isset($mybb->input[$product['sku']])) {
continue;
}

foreach ($product['prices'] as $price) {
if ($price['plan_id'] != $mybb->input['plan_id']) {
if ($price['plan_id'] != $mybb->input['plan_id'][$product['sku']]) {
continue;
}

$product['prices'] = array_values(array_filter($product['prices'], function ($price) use ($mybb) {
return $price['plan_id'] == $mybb->input['plan_id'];
$product['prices'] = array_values(array_filter($product['prices'], function ($price) use ($mybb, $product) {
return $price['plan_id'] == $mybb->input['plan_id'][$product['sku']];
}));

$selectedProduct = $product;
Expand Down Expand Up @@ -264,11 +268,11 @@ function rexshop_payment_page()
' . $product['description'] . '
</div>
<div align="right" style="margin-right: 100px;">
<select style="width: 120px;" name="plan_id">
<select style="width: 120px;" name="plan_id[' . $product["sku"] . ']">
' . $options . '
</select>
<input type="submit" name="item" value="Order" class="button" />
<button type="submit" name="' . $product["sku"] . '" class="button">Order</button>
</div>
</fieldset>';
}
Expand Down

0 comments on commit 0382616

Please sign in to comment.