Dodanie obsługi dodatkowych danych producenta oraz informacji o bezpieczeństwie w klasach ShopProducer i ShopProduct
This commit is contained in:
@@ -15,7 +15,7 @@ class ShopProducer
|
|||||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania producenta wystąpił błąd. Proszę spróbować ponownie.' ];
|
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania producenta wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||||
$values = json_decode( \S::get( 'values' ), true );
|
$values = json_decode( \S::get( 'values' ), true );
|
||||||
|
|
||||||
if ( $producer_id = \admin\factory\ShopProducer::save( $values['id'], $values['name'], $values['status'] == 'on' ? 1 : 0, $values['img'], $values['description'], $values['meta_title'] ) )
|
if ( $producer_id = \admin\factory\ShopProducer::save( $values['id'], $values['name'], $values['status'] == 'on' ? 1 : 0, $values['img'], $values['description'], $values['data'], $values['meta_title'] ) )
|
||||||
$response = [ 'status' => 'ok', 'msg' => 'Producent został zapisany.', 'id' => $producer_id ];
|
$response = [ 'status' => 'ok', 'msg' => 'Producent został zapisany.', 'id' => $producer_id ];
|
||||||
|
|
||||||
echo json_encode( $response );
|
echo json_encode( $response );
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ class ShopProduct
|
|||||||
$values['id'], $values['name'], $values['short_description'], $values['description'], $values['status'], $values['meta_description'], $values['meta_keywords'], $values['seo_link'],
|
$values['id'], $values['name'], $values['short_description'], $values['description'], $values['status'], $values['meta_description'], $values['meta_keywords'], $values['seo_link'],
|
||||||
$values['copy_from'], $values['categories'], $values['price_netto'], $values['price_brutto'], $values['vat'], $values['promoted'], $values['warehouse_message_zero'], $values['warehouse_message_nonzero'], $values['tab_name_1'],
|
$values['copy_from'], $values['categories'], $values['price_netto'], $values['price_brutto'], $values['vat'], $values['promoted'], $values['warehouse_message_zero'], $values['warehouse_message_nonzero'], $values['tab_name_1'],
|
||||||
$values['tab_description_1'], $values['tab_name_2'], $values['tab_description_2'], $values['layout_id'], $values['products_related'], (int) $values['set'], $values['price_netto_promo'], $values['price_brutto_promo'],
|
$values['tab_description_1'], $values['tab_name_2'], $values['tab_description_2'], $values['layout_id'], $values['products_related'], (int) $values['set'], $values['price_netto_promo'], $values['price_brutto_promo'],
|
||||||
$values['new_to_date'], $values['stock_0_buy'], $values['wp'], $values['custom_label_0'], $values['custom_label_1'], $values['custom_label_2'], $values['custom_label_3'], $values['custom_label_4'], $values['additional_message'], (int)$values['quantity'], $values['additional_message_text'], $values['additional_message_required'] == 'on' ? 1 : 0, $values['canonical'], $values['meta_title'], $values['producer_id'], $values['sku'], $values['ean'], $values['product_unit'], $values['weight'], $values['xml_name'], $values['custom_field_name'], $values['custom_field_required']
|
$values['new_to_date'], $values['stock_0_buy'], $values['wp'], $values['custom_label_0'], $values['custom_label_1'], $values['custom_label_2'], $values['custom_label_3'], $values['custom_label_4'], $values['additional_message'], (int)$values['quantity'], $values['additional_message_text'], $values['additional_message_required'] == 'on' ? 1 : 0, $values['canonical'], $values['meta_title'], $values['producer_id'], $values['sku'], $values['ean'], $values['product_unit'], $values['weight'], $values['xml_name'], $values['custom_field_name'], $values['custom_field_required'], $values['security_information']
|
||||||
) ) {
|
) ) {
|
||||||
$response = [ 'status' => 'ok', 'msg' => 'Produkt został zapisany.', 'id' => $id ];
|
$response = [ 'status' => 'ok', 'msg' => 'Produkt został zapisany.', 'id' => $id ];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ class Languages
|
|||||||
global $mdb;
|
global $mdb;
|
||||||
return $mdb -> delete( 'pp_langs_translations', [ 'id' => $translation_id ] );
|
return $mdb -> delete( 'pp_langs_translations', [ 'id' => $translation_id ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function translation_save( $translation_id, $text, $languages )
|
public static function translation_save( $translation_id, $text, $languages )
|
||||||
{
|
{
|
||||||
global $mdb;
|
global $mdb;
|
||||||
|
|
||||||
if ( $translation_id )
|
if ( $translation_id )
|
||||||
{
|
{
|
||||||
$mdb -> update( 'pp_langs_translations', [ 'text' => $text ], [ 'id' => $translation_id ] );
|
$mdb -> update( 'pp_langs_translations', [ 'text' => $text ], [ 'id' => $translation_id ] );
|
||||||
@@ -38,13 +38,13 @@ class Languages
|
|||||||
return $translation_id;
|
return $translation_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function translation_details( $translation_id )
|
public static function translation_details( $translation_id )
|
||||||
{
|
{
|
||||||
global $mdb;
|
global $mdb;
|
||||||
return $mdb -> get( 'pp_langs_translations', '*', [ 'id' => $translation_id ] );
|
return $mdb -> get( 'pp_langs_translations', '*', [ 'id' => $translation_id ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function language_delete( $language_id )
|
public static function language_delete( $language_id )
|
||||||
{
|
{
|
||||||
global $mdb;
|
global $mdb;
|
||||||
@@ -127,10 +127,15 @@ class Languages
|
|||||||
return $mdb -> get( 'pp_langs', '*', [ 'id' => $language_id ] );
|
return $mdb -> get( 'pp_langs', '*', [ 'id' => $language_id ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function languages_list()
|
public static function languages_list( $only_active = false )
|
||||||
{
|
{
|
||||||
global $mdb;
|
global $mdb;
|
||||||
return $mdb -> select( 'pp_langs', '*', [ 'ORDER' => [ 'o' => 'ASC' ] ] );
|
|
||||||
|
$where = [];
|
||||||
|
if ( $only_active )
|
||||||
|
$where['status'] = 1;
|
||||||
|
|
||||||
|
return $mdb -> select( 'pp_langs', '*', array_merge( [ 'ORDER' => [ 'o' => 'ASC' ] ], $where ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -14,28 +14,30 @@ class ShopProducer
|
|||||||
return $mdb -> delete( 'pp_shop_producer', [ 'id' => $producer_id ] );
|
return $mdb -> delete( 'pp_shop_producer', [ 'id' => $producer_id ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function save( $producer_id, $name, int $status, $img, $description, $meta_title )
|
static public function save( $producer_id, $name, int $status, $img, $description, $data, $meta_title )
|
||||||
{
|
{
|
||||||
global $mdb;
|
global $mdb;
|
||||||
|
|
||||||
if ( !$producer_id )
|
if ( !$producer_id )
|
||||||
{
|
{
|
||||||
$mdb -> insert( 'pp_shop_producer', [
|
$mdb -> insert( 'pp_shop_producer', [
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
'img' => $img
|
'img' => $img
|
||||||
] );
|
] );
|
||||||
|
|
||||||
$id = $mdb -> id();
|
$id = $mdb -> id();
|
||||||
|
|
||||||
foreach ( $description as $key => $val )
|
$langs = \admin\factory\Languages::languages_list( true );
|
||||||
|
foreach ( $langs as $lg )
|
||||||
{
|
{
|
||||||
$mdb -> insert( 'pp_shop_producer_lang', [
|
$mdb -> insert( 'pp_shop_producer_lang', [
|
||||||
'producer_id' => $id,
|
'producer_id' => $id,
|
||||||
'lang_id' => $key,
|
'lang_id' => $lg['id'],
|
||||||
'description' => $val,
|
'description' => $description[ $lg['id'] ] ?? null,
|
||||||
'meta_title' => $meta_title[$key]
|
'data' => $data[ $lg['id'] ] ?? null,
|
||||||
] );
|
'meta_title' => $meta_title[ $lg['id'] ] ?? null
|
||||||
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
\S::htacces();
|
\S::htacces();
|
||||||
@@ -46,29 +48,36 @@ class ShopProducer
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mdb -> update( 'pp_shop_producer', [
|
$mdb -> update( 'pp_shop_producer', [
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
'img' => $img
|
'img' => $img
|
||||||
], [
|
], [
|
||||||
'id' => (int) $producer_id
|
'id' => (int) $producer_id
|
||||||
] );
|
] );
|
||||||
|
|
||||||
foreach ( $description as $key => $val )
|
$langs = \admin\factory\Languages::languages_list( true );
|
||||||
|
foreach ( $langs as $lg )
|
||||||
{
|
{
|
||||||
if ( $translation_id = $mdb -> get( 'pp_shop_producer_lang', 'id', [ 'AND' => [ 'producer_id' => $producer_id, 'lang_id' => $key ] ] ) )
|
if ( $translation_id = $mdb -> get( 'pp_shop_producer_lang', 'id', [ 'AND' => [ 'producer_id' => $producer_id, 'lang_id' => $lg['id'] ] ] ) )
|
||||||
|
{
|
||||||
$mdb -> update( 'pp_shop_producer_lang', [
|
$mdb -> update( 'pp_shop_producer_lang', [
|
||||||
'description' => $val,
|
'description' => $description[ $lg['id'] ] ?? null,
|
||||||
'meta_title' => $meta_title[$key]
|
'meta_title' => $meta_title[ $lg['id'] ] ?? null,
|
||||||
|
'data' => $data[ $lg['id'] ] ?? null
|
||||||
], [
|
], [
|
||||||
'id' => $translation_id
|
'id' => $translation_id
|
||||||
] );
|
] );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
$mdb -> insert( 'pp_shop_producer_lang', [
|
$mdb -> insert( 'pp_shop_producer_lang', [
|
||||||
'producer_id' => $producer_id,
|
'producer_id' => $producer_id,
|
||||||
'lang_id' => $key,
|
'lang_id' => $lg['id'],
|
||||||
'description' => $val,
|
'description' => $description[ $lg['id'] ] ?? null,
|
||||||
'meta_title' => $meta_title[$key]
|
'data' => $data[ $lg['id'] ] ?? null,
|
||||||
|
'meta_title' => $meta_title[ $lg['id'] ] ?? null
|
||||||
] );
|
] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
\S::htacces();
|
\S::htacces();
|
||||||
|
|||||||
@@ -761,7 +761,7 @@ class ShopProduct
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function save(
|
public static function save(
|
||||||
$product_id, $name, $short_description, $description, $status, $meta_description, $meta_keywords, $seo_link, $copy_from, $categories, $price_netto, $price_brutto, $vat, $promoted, $warehouse_message_zero, $warehouse_message_nonzero, $tab_name_1, $tab_description_1, $tab_name_2, $tab_description_2, $layout_id, $products_related, int $set_id, $price_netto_promo, $price_brutto_promo, $new_to_date, $stock_0_buy, $wp, $custom_label_0, $custom_label_1, $custom_label_2, $custom_label_3, $custom_label_4, $additional_message, int $quantity, $additional_message_text, int $additional_message_required, $canonical, $meta_title, $producer_id, $sku, $ean, $product_unit, $weight, $xml_name, $custom_field_name, $custom_field_required
|
$product_id, $name, $short_description, $description, $status, $meta_description, $meta_keywords, $seo_link, $copy_from, $categories, $price_netto, $price_brutto, $vat, $promoted, $warehouse_message_zero, $warehouse_message_nonzero, $tab_name_1, $tab_description_1, $tab_name_2, $tab_description_2, $layout_id, $products_related, int $set_id, $price_netto_promo, $price_brutto_promo, $new_to_date, $stock_0_buy, $wp, $custom_label_0, $custom_label_1, $custom_label_2, $custom_label_3, $custom_label_4, $additional_message, int $quantity, $additional_message_text, int $additional_message_required, $canonical, $meta_title, $producer_id, $sku, $ean, $product_unit, $weight, $xml_name, $custom_field_name, $custom_field_required, $security_information
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
global $mdb, $user;
|
global $mdb, $user;
|
||||||
@@ -804,27 +804,29 @@ class ShopProduct
|
|||||||
|
|
||||||
if ( $id )
|
if ( $id )
|
||||||
{
|
{
|
||||||
foreach ( $name as $key => $val )
|
$langs = \admin\factory\Languages::languages_list( true );
|
||||||
|
foreach ( $langs as $lg )
|
||||||
{
|
{
|
||||||
$mdb -> insert( 'pp_shop_products_langs', [
|
$mdb -> insert( 'pp_shop_products_langs', [
|
||||||
'product_id' => (int) $id,
|
'product_id' => (int) $id,
|
||||||
'lang_id' => $key,
|
'lang_id' => $lg['id'],
|
||||||
'name' => '' !== $name[$key] ? $name[$key] : null,
|
'name' => $name[$lg['id']] ? $name[$lg['id']] : null,
|
||||||
'short_description' => '' !== $short_description[$key] ? $short_description[$key] : null,
|
'short_description' => $short_description[$lg['id']] ? $short_description[$lg['id']] : null,
|
||||||
'description' => '' !== $description[$key] ? $description[$key] : null,
|
'description' => $description[$lg['id']] ? $description[$lg['id']] : null,
|
||||||
'meta_description' => '' !== $meta_description[$key] ? $meta_description[$key] : null,
|
'meta_description' => $meta_description[$lg['id']] ? $meta_description[$lg['id']] : null,
|
||||||
'meta_keywords' => '' !== $meta_keywords[$key] ? $meta_keywords[$key] : null,
|
'meta_keywords' => $meta_keywords[$lg['id']] ? $meta_keywords[$lg['id']] : null,
|
||||||
'seo_link' => '' !== \S::seo($seo_link[$key]) ? \S::seo($seo_link[$key]) : null,
|
'seo_link' => $seo_link[$lg['id']] ? \S::seo($seo_link[$lg['id']]) : null,
|
||||||
'copy_from' => '' !== $copy_from[$key] ? $copy_from[$key] : null,
|
'copy_from' => $copy_from[$lg['id']] ? $copy_from[$lg['id']] : null,
|
||||||
'warehouse_message_zero' => '' !== $warehouse_message_zero[$key] ? $warehouse_message_zero[$key] : null,
|
'warehouse_message_zero' => $warehouse_message_zero[$lg['id']] ? $warehouse_message_zero[$lg['id']] : null,
|
||||||
'warehouse_message_nonzero' => '' !== $warehouse_message_nonzero[$key] ? $warehouse_message_nonzero[$key] : null,
|
'warehouse_message_nonzero' => $warehouse_message_nonzero[$lg['id']] ? $warehouse_message_nonzero[$lg['id']] : null,
|
||||||
'tab_name_1' => '' !== $tab_name_1[$key] ? $tab_name_1[$key] : null,
|
'tab_name_1' => $tab_name_1[$lg['id']] ? $tab_name_1[$lg['id']] : null,
|
||||||
'tab_description_1' => '' !== $tab_description_1[$key] ? $tab_description_1[$key] : null,
|
'tab_description_1' => $tab_description_1[$lg['id']] ? $tab_description_1[$lg['id']] : null,
|
||||||
'tab_name_2' => '' !== $tab_name_2[$key] ? $tab_name_2[$key] : null,
|
'tab_name_2' => $tab_name_2[$lg['id']] ? $tab_name_2[$lg['id']] : null,
|
||||||
'tab_description_2' => '' !== $tab_description_2[$key] ? $tab_description_2[$key] : null,
|
'tab_description_2' => $tab_description_2[$lg['id']] ? $tab_description_2[$lg['id']] : null,
|
||||||
'canonical' => '' !== $canonical[$key] ? $canonical[$key] : null,
|
'canonical' => $canonical[$lg['id']] ? $canonical[$lg['id']] : null,
|
||||||
'meta_title' => '' !== $meta_title[$key] ? $meta_title[$key] : null,
|
'meta_title' => $meta_title[$lg['id']] ? $meta_title[$lg['id']] : null,
|
||||||
'xml_name' => '' !== $xml_name[$key] ? $xml_name[$key] : null,
|
'xml_name' => $xml_name[$lg['id']] ? $xml_name[$lg['id']] : null,
|
||||||
|
'security_information' => $security_information[$lg['id']] ? $security_information[$lg['id']] : null,
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1007,51 +1009,52 @@ class ShopProduct
|
|||||||
|
|
||||||
\admin\factory\ShopProduct::update_product_combinations_prices( $product_id, $price_brutto, $vat, $price_brutto_promo );
|
\admin\factory\ShopProduct::update_product_combinations_prices( $product_id, $price_brutto, $vat, $price_brutto_promo );
|
||||||
|
|
||||||
foreach ( $name as $key => $val )
|
$langs = \admin\factory\Languages::languages_list( true );
|
||||||
|
foreach ( $langs as $lg )
|
||||||
{
|
{
|
||||||
if ( $translation_id = $mdb -> get( 'pp_shop_products_langs', 'id', [ 'AND' => [ 'product_id' => $product_id, 'lang_id' => $key ] ] ) )
|
if ( $translation_id = $mdb -> get( 'pp_shop_products_langs', 'id', [ 'AND' => [ 'product_id' => $product_id, 'lang_id' => $lg['id'] ] ] ) )
|
||||||
{
|
{
|
||||||
$current_seo_link = $mdb -> get( 'pp_shop_products_langs', 'seo_link', [ 'id' => $translation_id ] );
|
$current_seo_link = $mdb -> get( 'pp_shop_products_langs', 'seo_link', [ 'id' => $translation_id ] );
|
||||||
|
|
||||||
if ( $seo_link[$key] )
|
if ( $seo_link[$lg['id']] )
|
||||||
$new_seo_link = \S::seo( $seo_link[$key] );
|
$new_seo_link = \S::seo( $seo_link[$lg['id']] );
|
||||||
else
|
else
|
||||||
$new_seo_link = \S::seo( 'p-' . $product_id . '-' . $name[$key] );
|
$new_seo_link = \S::seo( 'p-' . $product_id . '-' . $name[$lg['id']] );
|
||||||
|
|
||||||
if ( $new_seo_link !== $current_seo_link and $current_seo_link != '' )
|
if ( $new_seo_link !== $current_seo_link and $current_seo_link != '' )
|
||||||
{
|
{
|
||||||
if ( !$mdb -> count( 'pp_redirects', [ 'from' => $current_seo_link, 'to' => $new_seo_link, 'lang_id' => $key, 'product_id' => $product_id ] ) )
|
if ( !$mdb -> count( 'pp_redirects', [ 'from' => $current_seo_link, 'to' => $new_seo_link, 'lang_id' => $lg['id'], 'product_id' => $product_id ] ) )
|
||||||
{
|
{
|
||||||
if ( $mdb -> count( 'pp_redirects', [ 'from' => $new_seo_link, 'to' => $current_seo_link, 'lang_id' => $key, 'product_id' => $product_id ] ) )
|
if ( $mdb -> count( 'pp_redirects', [ 'from' => $new_seo_link, 'to' => $current_seo_link, 'lang_id' => $lg['id'], 'product_id' => $product_id ] ) )
|
||||||
$mdb -> delete( 'pp_redirects', [ 'from' => $new_seo_link, 'to' => $current_seo_link, 'lang_id' => $key, 'product_id' => $product_id ] );
|
$mdb -> delete( 'pp_redirects', [ 'from' => $new_seo_link, 'to' => $current_seo_link, 'lang_id' => $lg['id'], 'product_id' => $product_id ] );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( \S::canAddRedirect( $current_seo_link, $new_seo_link ) )
|
if ( \S::canAddRedirect( $current_seo_link, $new_seo_link ) )
|
||||||
$mdb -> insert( 'pp_redirects', [ 'from' => $current_seo_link, 'to' => $new_seo_link, 'lang_id' => $key, 'product_id' => $product_id ] );
|
$mdb -> insert( 'pp_redirects', [ 'from' => $current_seo_link, 'to' => $new_seo_link, 'lang_id' => $lg['id'], 'product_id' => $product_id ] );
|
||||||
else
|
else
|
||||||
$mdb -> delete( 'pp_redirects', [ 'product_id' => $product_id, 'lang_id' => $key ] );
|
$mdb -> delete( 'pp_redirects', [ 'product_id' => $product_id, 'lang_id' => $lg['id'] ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$mdb -> update( 'pp_shop_products_langs', [
|
$mdb -> update( 'pp_shop_products_langs', [
|
||||||
'lang_id' => $key,
|
'name' => $name[$lg['id']] ? $name[$lg['id']] : null,
|
||||||
'name' => '' !== $name[$key] ? $name[$key] : null,
|
'short_description' => $short_description[$lg['id']] ? $short_description[$lg['id']] : null,
|
||||||
'short_description' => '' !== $short_description[$key] ? $short_description[$key] : null,
|
'description' => $description[$lg['id']] ? $description[$lg['id']] : null,
|
||||||
'description' => '' !== $description[$key] ? $description[$key] : null,
|
'meta_description' => $meta_description[$lg['id']] ? $meta_description[$lg['id']] : null,
|
||||||
'meta_description' => '' !== $meta_description[$key] ? $meta_description[$key] : null,
|
'meta_keywords' => $meta_keywords[$lg['id']] ? $meta_keywords[$lg['id']] : null,
|
||||||
'meta_keywords' => '' !== $meta_keywords[$key] ? $meta_keywords[$key] : null,
|
'seo_link' => $seo_link[$lg['id']] ? \S::seo($seo_link[$lg['id']]) : null,
|
||||||
'seo_link' => \S::seo( $seo_link[$key] ) != '' ? \S::seo( $seo_link[$key] ) : \S::seo( 'p-' . $product_id . '-' . $name[$key] ),
|
'copy_from' => $copy_from[$lg['id']] ? $copy_from[$lg['id']] : null,
|
||||||
'copy_from' => '' !== $copy_from[$key] ? $copy_from[$key] : null,
|
'warehouse_message_zero' => $warehouse_message_zero[$lg['id']] ? $warehouse_message_zero[$lg['id']] : null,
|
||||||
'warehouse_message_zero' => '' !== $warehouse_message_zero[$key] ? $warehouse_message_zero[$key] : null,
|
'warehouse_message_nonzero' => $warehouse_message_nonzero[$lg['id']] ? $warehouse_message_nonzero[$lg['id']] : null,
|
||||||
'warehouse_message_nonzero' => '' !== $warehouse_message_nonzero[$key] ? $warehouse_message_nonzero[$key] : null,
|
'tab_name_1' => $tab_name_1[$lg['id']] ? $tab_name_1[$lg['id']] : null,
|
||||||
'tab_name_1' => '' !== $tab_name_1[$key] ? $tab_name_1[$key] : null,
|
'tab_description_1' => $tab_description_1[$lg['id']] ? $tab_description_1[$lg['id']] : null,
|
||||||
'tab_description_1' => '' !== $tab_description_1[$key] ? $tab_description_1[$key] : null,
|
'tab_name_2' => $tab_name_2[$lg['id']] ? $tab_name_2[$lg['id']] : null,
|
||||||
'tab_name_2' => '' !== $tab_name_2[$key] ? $tab_name_2[$key] : null,
|
'tab_description_2' => $tab_description_2[$lg['id']] ? $tab_description_2[$lg['id']] : null,
|
||||||
'tab_description_2' => '' !== $tab_description_2[$key] ? $tab_description_2[$key] : null,
|
'canonical' => $canonical[$lg['id']] ? $canonical[$lg['id']] : null,
|
||||||
'canonical' => '' !== $canonical[$key] ? $canonical[$key] : null,
|
'meta_title' => $meta_title[$lg['id']] ? $meta_title[$lg['id']] : null,
|
||||||
'meta_title' => '' !== $meta_title[$key] ? $meta_title[$key] : null,
|
'xml_name' => $xml_name[$lg['id']] ? $xml_name[$lg['id']] : null,
|
||||||
'xml_name' => '' !== $xml_name[$key] ? $xml_name[$key] : null,
|
'security_information' => $security_information[$lg['id']] ? $security_information[$lg['id']] : null,
|
||||||
], [
|
], [
|
||||||
'id' => $translation_id
|
'id' => $translation_id
|
||||||
] );
|
] );
|
||||||
@@ -1059,24 +1062,25 @@ class ShopProduct
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mdb -> insert( 'pp_shop_products_langs', [
|
$mdb -> insert( 'pp_shop_products_langs', [
|
||||||
'product_id' => (int)$product_id,
|
'product_id' => (int) $product_id,
|
||||||
'lang_id' => $key,
|
'lang_id' => $lg['id'],
|
||||||
'name' => '' !== $name[$key] ? $name[$key] : null,
|
'name' => $name[$lg['id']] ? $name[$lg['id']] : null,
|
||||||
'short_description' => '' !== $short_description[$key] ? $short_description[$key] : null,
|
'short_description' => $short_description[$lg['id']] ? $short_description[$lg['id']] : null,
|
||||||
'description' => '' !== $description[$key] ? $description[$key] : null,
|
'description' => $description[$lg['id']] ? $description[$lg['id']] : null,
|
||||||
'meta_description' => '' !== $meta_description[$key] ? $meta_description[$key] : null,
|
'meta_description' => $meta_description[$lg['id']] ? $meta_description[$lg['id']] : null,
|
||||||
'meta_keywords' => '' !== $meta_keywords[$key] ? $meta_keywords[$key] : null,
|
'meta_keywords' => $meta_keywords[$lg['id']] ? $meta_keywords[$lg['id']] : null,
|
||||||
'seo_link' => '' !== \S::seo($seo_link[$key]) ? \S::seo($seo_link[$key]) : null,
|
'seo_link' => $seo_link[$lg['id']] ? \S::seo($seo_link[$lg['id']]) : null,
|
||||||
'copy_from' => '' !== $copy_from[$key] ? $copy_from[$key] : null,
|
'copy_from' => $copy_from[$lg['id']] ? $copy_from[$lg['id']] : null,
|
||||||
'warehouse_message_zero' => '' !== $warehouse_message_zero[$key] ? $warehouse_message_zero[$key] : null,
|
'warehouse_message_zero' => $warehouse_message_zero[$lg['id']] ? $warehouse_message_zero[$lg['id']] : null,
|
||||||
'warehouse_message_nonzero' => '' !== $warehouse_message_nonzero[$key] ? $warehouse_message_nonzero[$key] : null,
|
'warehouse_message_nonzero' => $warehouse_message_nonzero[$lg['id']] ? $warehouse_message_nonzero[$lg['id']] : null,
|
||||||
'tab_name_1' => '' !== $tab_name_1[$key] ? $tab_name_1[$key] : null,
|
'tab_name_1' => $tab_name_1[$lg['id']] ? $tab_name_1[$lg['id']] : null,
|
||||||
'tab_description_1' => '' !== $tab_description_1[$key] ? $tab_description_1[$key] : null,
|
'tab_description_1' => $tab_description_1[$lg['id']] ? $tab_description_1[$lg['id']] : null,
|
||||||
'tab_name_2' => '' !== $tab_name_2[$key] ? $tab_name_2[$key] : null,
|
'tab_name_2' => $tab_name_2[$lg['id']] ? $tab_name_2[$lg['id']] : null,
|
||||||
'tab_description_2' => '' !== $tab_description_2[$key] ? $tab_description_2[$key] : null,
|
'tab_description_2' => $tab_description_2[$lg['id']] ? $tab_description_2[$lg['id']] : null,
|
||||||
'canonical' => '' !== $canonical[$key] ? $canonical[$key] : null,
|
'canonical' => $canonical[$lg['id']] ? $canonical[$lg['id']] : null,
|
||||||
'meta_title' => '' !== $meta_title[$key] ? $meta_title[$key] : null,
|
'meta_title' => $meta_title[$lg['id']] ? $meta_title[$lg['id']] : null,
|
||||||
'xml_name' => '' !== $xml_name[$key] ? $xml_name[$key] : null,
|
'xml_name' => $xml_name[$lg['id']] ? $xml_name[$lg['id']] : null,
|
||||||
|
'security_information' => $security_information[$lg['id']] ? $security_information[$lg['id']] : null,
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class Producer implements \ArrayAccess
|
|||||||
foreach ( $rows as $row )
|
foreach ( $rows as $row )
|
||||||
{
|
{
|
||||||
$languages[ $row['lang_id'] ]['description'] = $row['description'];
|
$languages[ $row['lang_id'] ]['description'] = $row['description'];
|
||||||
|
$languages[ $row['lang_id'] ]['data'] = $row['data'];
|
||||||
$languages[ $row['lang_id'] ]['meta_title'] = $row['meta_title'];
|
$languages[ $row['lang_id'] ]['meta_title'] = $row['meta_title'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,13 @@ class Product implements \ArrayAccess
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this -> producer = $mdb -> get( 'pp_shop_producer', '*', [ 'id' => (int) $this -> producer_id ] );
|
$producer = $mdb -> get( 'pp_shop_producer', '*', [ 'id' => (int) $this -> producer_id ] );
|
||||||
|
$producer_languages = $mdb -> get( 'pp_shop_producer_lang', '*', [ 'AND' => [ 'producer_id' => (int) $this -> producer_id, 'lang_id' => $lang_id ] ] );
|
||||||
|
$producer['description'] = $producer_languages['description'];
|
||||||
|
$producer['data'] = $producer_languages['data'];
|
||||||
|
$producer['meta_title'] = $producer_languages['meta_title'];
|
||||||
|
|
||||||
|
$this -> producer = $producer;
|
||||||
|
|
||||||
if ( $permutation_hash )
|
if ( $permutation_hash )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<? if ( is_array( $this -> custom_fields ) ): foreach ( $this -> custom_fields as $custom_field ):?>
|
<? if ( is_array( $this -> custom_fields ) ): foreach ( $this -> custom_fields as $custom_field ):?>
|
||||||
<div class="custom-field">
|
<div class="custom-field">
|
||||||
<div class="_name">
|
<div class="_name">
|
||||||
<?= $custom_field['name'];?>:
|
<?= $custom_field['name'];?><? if ( !empty( $custom_field['is_required'] ) ): ?>*<? endif; ?>:
|
||||||
</div>
|
</div>
|
||||||
<div class="_input">
|
<div class="_input">
|
||||||
<input type="text" class="form-control" name="custom_field[<?= $custom_field['id_additional_field'];?>]" field_name="<?= $custom_field['name'];?>" value="" <? if ( !empty( $custom_field['is_required'] ) ): ?>required<? endif; ?>>
|
<input type="text" class="form-control" name="custom_field[<?= $custom_field['id_additional_field'];?>]" field_name="<?= $custom_field['name'];?>" value="" <? if ( !empty( $custom_field['is_required'] ) ): ?>required<? endif; ?>>
|
||||||
|
|||||||
@@ -145,6 +145,7 @@
|
|||||||
<li class="tab-link" id="tab-link-1" tab="1"><?= $this -> product -> language['tab_name_1'];?></li>
|
<li class="tab-link" id="tab-link-1" tab="1"><?= $this -> product -> language['tab_name_1'];?></li>
|
||||||
<? endif;?>
|
<? endif;?>
|
||||||
<li class="tab-link" id="tab-link-2" tab="2"><?= ucfirst( \S::lang( 'opinie' ) );?></li>
|
<li class="tab-link" id="tab-link-2" tab="2"><?= ucfirst( \S::lang( 'opinie' ) );?></li>
|
||||||
|
<li class="tab-link" id="tab-link-3" tab="3">Bezpieczeństwo</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="tab-0" class="tab-content">
|
<div id="tab-0" class="tab-content">
|
||||||
<div class="tab-title"><?= \S::lang( 'opis-produktu' );?></div>
|
<div class="tab-title"><?= \S::lang( 'opis-produktu' );?></div>
|
||||||
@@ -188,6 +189,16 @@
|
|||||||
})(window);
|
})(window);
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="tab-3" class="tab-content">
|
||||||
|
<? if ( $this -> product['producer']['data'] ):?>
|
||||||
|
<div class="tab-title">Producent</div>
|
||||||
|
<?= $this -> product['producer']['data'];?>
|
||||||
|
<? endif;?>
|
||||||
|
<? if ( $this -> product['language']['security_information'] ):?>
|
||||||
|
<div class="tab-title">Informacje o bezpieczeństwie</div>
|
||||||
|
<?= $this -> product['language']['security_information'];?>
|
||||||
|
<? endif;?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-lg-4">
|
<div class="col-12 col-lg-4">
|
||||||
<? if ( $this -> product -> language['tab_name_2'] ):?>
|
<? if ( $this -> product -> language['tab_name_2'] ):?>
|
||||||
|
|||||||
@@ -152,7 +152,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- //* bottom left -->
|
<!-- //* bottom left -->
|
||||||
<? if ($this -> product -> language['description'] or $this -> product -> language['tab_description_1'] or $this -> product -> language['tab_description_2'] ) : ?>
|
<? if ( $this -> product -> language['description'] or $this -> product -> language['tab_description_1'] or $this -> product -> language['tab_description_2'] or $this -> product['producer'] ):?>
|
||||||
<div id="description" class="product_info__desc">
|
<div id="description" class="product_info__desc">
|
||||||
<div class="description_accordion">
|
<div class="description_accordion">
|
||||||
|
|
||||||
@@ -173,11 +173,29 @@
|
|||||||
<? endif;?>
|
<? endif;?>
|
||||||
|
|
||||||
<? if ( $this -> product -> language['tab_name_2'] ):?>
|
<? if ( $this -> product -> language['tab_name_2'] ):?>
|
||||||
<!-- accordion 3 -->
|
<!-- accordion 3 -->
|
||||||
<div class="accordion_tile">
|
<div class="accordion_tile">
|
||||||
<div class="accordion_title"><p><?= $this -> product -> language['tab_name_2'];?></p></div>
|
<div class="accordion_title"><p><?= $this -> product -> language['tab_name_2'];?></p></div>
|
||||||
<div class="accordion_data"><?= $this -> product -> language['tab_description_2'];?></div>
|
<div class="accordion_data" style="display: none;"><?= $this -> product -> language['tab_description_2'];?></div>
|
||||||
</div>
|
</div>
|
||||||
|
<? endif;?>
|
||||||
|
|
||||||
|
<? if ( $this -> product['producer']['data'] or $this -> product['language']['security_information'] ):?>
|
||||||
|
<!-- accordion 4 -->
|
||||||
|
<div class="accordion_tile">
|
||||||
|
<div class="accordion_title"><p>Bezpieczeństwo</p></div>
|
||||||
|
<div class="accordion_data" style="display: none;">
|
||||||
|
<? if ( $this -> product['producer']['data'] ):?>
|
||||||
|
<p><strong>Producent</strong></p>
|
||||||
|
<?= $this -> product['producer']['data'];?>
|
||||||
|
<? endif;?>
|
||||||
|
<br>
|
||||||
|
<? if ( $this -> product['language']['security_information'] ):?>
|
||||||
|
<p><strong>Informacje o bezpieczeństwie</strong></p>
|
||||||
|
<?= $this -> product['language']['security_information'];?>
|
||||||
|
<? endif;?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<? endif;?>
|
<? endif;?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user