$discountRate = 0.0; if (isset($_POST['discountRate'])) { $discountEnabled = isset($_POST['discountEnabled']) ? 1 : 0; $discountRate = $_POST['discountRate']; } $cmp = new \Pasteque\Product($_POST['reference'], $_POST['label'], $_POST['realsell'], $catId, null, $dispOrder, $taxCatId, $visible, $scaled, $_POST['priceBuy'], null, $_POST['barcode'], $img !== null, $discountEnabled, $discountRate); $cmp->groups = parseSubgroups($_POST['subgroupData'], $products); if (\Pasteque\CompositionsService::create($cmp, $img, null)) { $message = \i18n("Changes saved", PLUGIN_NAME); } else { $error = \i18n("Unable to save changes", PLUGIN_NAME); } } } if (isset($_GET['productId'])) { $composition = \Pasteque\CompositionsService::get($_GET['productId']); $taxCat = \Pasteque\TaxesService::get($composition->taxCatId); $tax = $taxCat->getCurrentTax(); $vatprice = $composition->priceSell * (1 + $tax->rate); $price = sprintf("%.2f", $composition->priceSell); } else { $vatprice = ""; $price = ""; $composition = NULL; } ?> <h1><?php \pi18n('Composition edit', PLUGIN_NAME); ?> </h1>