release 0.267: front layout/basket fixes and product redirect hardening

This commit is contained in:
2026-02-14 00:56:09 +01:00
parent 40e777afe6
commit 7574785d68
17 changed files with 251 additions and 607 deletions

View File

@@ -23,7 +23,27 @@ class Basket implements \ArrayAccess
foreach ( $basket as $key => $val )
{
$quantity_options = \shop\Product::get_product_permutation_quantity_options( $val['parent_id'] ? $val['parent_id'] : $val['product-id'], $val['attributes'][0] );
$permutation = null;
if ( isset( $val['parent_id'] ) and (int)$val['parent_id'] and isset( $val['product-id'] ) )
$permutation = \shop\Product::get_product_permutation_hash( (int)$val['product-id'] );
if ( !$permutation and isset( $val['attributes'] ) and is_array( $val['attributes'] ) and count( $val['attributes'] ) )
$permutation = implode( '|', $val['attributes'] );
$quantity_options = \shop\Product::get_product_permutation_quantity_options(
$val['parent_id'] ? $val['parent_id'] : $val['product-id'],
$permutation
);
if (
(int)$basket[ $key ][ 'quantity' ] < 1
and ( (int)$quantity_options['quantity'] > 0 or (int)$quantity_options['stock_0_buy'] === 1 )
)
{
$basket[ $key ][ 'quantity' ] = 1;
$result = true;
}
if ( ( $val[ 'quantity' ] > $quantity_options['quantity'] ) and !$quantity_options['stock_0_buy'] )
{