release 0.267: front layout/basket fixes and product redirect hardening
This commit is contained in:
@@ -537,7 +537,7 @@ class Product implements \ArrayAccess
|
||||
global $mdb, $settings;
|
||||
|
||||
$cacheHandler = new \CacheHandler();
|
||||
$cacheKey = "\shop\Product::get_product_permutation_quantity_options:$product_id:$permutation";
|
||||
$cacheKey = "\shop\Product::get_product_permutation_quantity_options:v2:$product_id:$permutation";
|
||||
|
||||
$objectData = $cacheHandler -> get( $cacheKey );
|
||||
|
||||
@@ -546,10 +546,15 @@ class Product implements \ArrayAccess
|
||||
if ( $mdb -> count( 'pp_shop_products', [ 'AND' => [ 'parent_id' => $product_id, 'permutation_hash' => $permutation ] ] ) )
|
||||
{
|
||||
$result['quantity'] = $mdb -> get( 'pp_shop_products', 'quantity', [ 'AND' => [ 'parent_id' => $product_id, 'permutation_hash' => $permutation ] ] );
|
||||
$result['stock_0_buy'] = $mdb -> get( 'pp_shop_products', 'stock_0_buy', [ 'AND' => [ 'parent_id' => $product_id, 'permutation_hash' => $permutation ] ] );
|
||||
|
||||
if ( $result['quantity'] == null )
|
||||
{
|
||||
$result['quantity'] = $mdb -> get( 'pp_shop_products', 'quantity', [ 'id' => $product_id ] );
|
||||
$result['stock_0_buy'] = $mdb -> get( 'pp_shop_products', 'stock_0_buy', [ 'id' => $product_id] );
|
||||
|
||||
if ( $result['stock_0_buy'] == null )
|
||||
$result['stock_0_buy'] = $mdb -> get( 'pp_shop_products', 'stock_0_buy', [ 'id' => $product_id] );
|
||||
|
||||
$result['messages'] = $mdb -> get( 'pp_shop_products_langs', [ 'warehouse_message_zero', 'warehouse_message_nonzero' ], [ 'AND' => [ 'product_id' => $product_id, 'lang_id' => 'pl' ] ] );
|
||||
|
||||
if ( !$result['messages']['warehouse_message_zero'] )
|
||||
@@ -560,7 +565,6 @@ class Product implements \ArrayAccess
|
||||
}
|
||||
else
|
||||
{
|
||||
$result['stock_0_buy'] = $mdb -> get( 'pp_shop_products', 'stock_0_buy', [ 'AND' => [ 'parent_id' => $product_id, 'permutation_hash' => $permutation ] ] );
|
||||
$result['messages'] = $mdb -> get( 'pp_shop_products_langs', [ 'warehouse_message_zero', 'warehouse_message_nonzero' ], [ 'AND' => [ 'product_id' => $product_id, 'lang_id' => 'pl' ] ] );
|
||||
|
||||
if ( !$result['messages']['warehouse_message_zero'] )
|
||||
@@ -758,6 +762,13 @@ class Product implements \ArrayAccess
|
||||
return $mdb -> get( 'pp_shop_products', 'id', [ 'AND' => [ 'parent_id' => $parent_id, 'permutation_hash' => implode( '|', $attributes ) ] ] );
|
||||
}
|
||||
|
||||
// pobranie permutation_hash dla kombinacji produktu
|
||||
static public function get_product_permutation_hash( int $product_id )
|
||||
{
|
||||
global $mdb;
|
||||
return $mdb -> get( 'pp_shop_products', 'permutation_hash', [ 'id' => $product_id ] );
|
||||
}
|
||||
|
||||
// pobranie listy atrybutów z wybranymi wartościami
|
||||
static public function get_product_attributes( $products )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user