Refactor payment confirmation template and fix status check

This commit is contained in:
2024-10-29 11:25:46 +01:00
parent 082feb6f2a
commit fbb0231089
25 changed files with 1595 additions and 1928 deletions

View File

@@ -622,53 +622,6 @@ class ShopProduct
return $result;
}
public static function permutation_quantity($id_product, $permutation)
{
global $mdb;
return $mdb -> get('pp_shop_products_stock', 'quantity', ['AND' => ['id_product' => $id_product, 'permutation' => $permutation]]);
}
public static function stock_save($id_product, $permutations_quantity)
{
global $mdb;
$mdb -> delete( 'pp_shop_products_stock', [ 'id_product' => $id_product ] );
if ( is_array( $permutations_quantity ) ) foreach ($permutations_quantity as $key => $val)
{
$permutations[] = $mdb -> get('pp_shop_products_stock', 'id', ['AND' => ['id_product' => $id_product, 'permutation' => $key]]);
$mdb -> delete('pp_shop_products_stock', ['AND' => ['id_product' => $id_product, 'id[!]' => $permutations]]);
}
if (\is_array($permutations_quantity))
{
foreach ($permutations_quantity as $key => $val)
{
if ($id = $mdb -> get('pp_shop_products_stock', 'id', ['AND' => ['id_product' => $id_product, 'permutation' => $key]]))
{
$mdb -> update('pp_shop_products_stock', [
'quantity' => $val,
], [
'id' => $id,
]);
\S::delete_dir('../temp/');
}
else
{
$mdb -> insert('pp_shop_products_stock', [
'id_product' => $id_product,
'permutation' => $key,
'quantity' => $val,
]);
\S::delete_dir('../temp/');
}
}
}
return true;
}
// product_unarchive
static public function product_unarchive( int $product_id )
{
@@ -1050,12 +1003,6 @@ class ShopProduct
\admin\factory\ShopProduct::update_product_combinations_prices( $product_id, $price_brutto, $vat, $price_brutto_promo );
//stan magazynowy
if ( $mdb -> count( 'pp_shop_products_stock', [ 'id_product' => $product_id ] ) )
$mdb -> update( 'pp_shop_products_stock', [ 'quantity' => $quantity ], [ 'id_product' => $product_id ] );
else
$mdb -> insert( 'pp_shop_products_stock', [ 'id_product' => $product_id, 'quantity' => $quantity ] );
foreach ( $name as $key => $val )
{
if ( $translation_id = $mdb -> get( 'pp_shop_products_langs', 'id', [ 'AND' => [ 'product_id' => $product_id, 'lang_id' => $key ] ] ) )