Dodanie obsługi punktów Orlen w zamówieniach oraz poprawa logiki i formatowania w różnych plikach

This commit is contained in:
2024-11-16 10:54:33 +01:00
parent a91d37736d
commit 49f8a3f8a0
25 changed files with 946 additions and 422 deletions

View File

@@ -29,7 +29,7 @@ class Settings
\admin\factory\Settings::settings_update( 'piksel', $values['piksel'] );
\admin\factory\Settings::settings_update( 'generate_webp', $values['generate_webp'] == 'on' ? 1 : 0 );
\admin\factory\Settings::settings_update( 'lazy_loading', $values['lazy_loading'] == 'on' ? 1 : 0 );
\admin\factory\Settings::settings_update( 'ekomi_survey', $values['ekomi_survey'] );
\admin\factory\Settings::settings_update( 'orlen_paczka_map_token', $values['orlen_paczka_map_token'] );
\admin\factory\Settings::settings_update( 'google_tag_manager_id', $values['google_tag_manager_id'] );
\admin\factory\Settings::settings_update( 'infinitescroll', $values['infinitescroll'] == 'on' ? 1 : 0 );
// own_gtm_js

View File

@@ -4,7 +4,7 @@ class ShopTransport
{
public static function lowest_transport_price( $wp ) {
global $mdb;
return $mdb -> get( 'pp_shop_transports', 'cost', [ 'AND' => [ 'status' => 1, 'id' => [ 2, 4, 6, 8 ], 'max_wp[>=]' => $wp ], 'ORDER' => [ 'cost' => 'ASC' ] ] );
return $mdb -> get( 'pp_shop_transports', 'cost', [ 'AND' => [ 'status' => 1, 'id' => [ 2, 4, 6, 8, 9 ], 'max_wp[>=]' => $wp ], 'ORDER' => [ 'cost' => 'ASC' ] ] );
}
public static function transport_save( $transport_id, $name, $name_visible, $description, $status, $cost, $payment_methods, $max_wp, $default, $apilo_carrier_account_id, $sellasist_shipment_method_id, $delivery_free )

View File

@@ -15,7 +15,7 @@ class Update
foreach ( $versions as $ver )
{
$ver = trim( $ver );
if ( (float)$ver > (float)\S::get_version() )
if ( floatval( $ver ) > (float)\S::get_version() )
{
if ( strlen( $ver ) == 5 )
$dir = substr( $ver, 0, strlen( $ver ) - 2 ) . 0;
@@ -34,29 +34,47 @@ class Update
else
{
/* aktualizacja bazy danych */
$sql = file_get_contents( 'http://www.shoppro.project-dc.pl/updates/' . $dir . '/ver_' . $ver . '_sql.txt' );
$sql = explode( PHP_EOL, $sql );
$url = 'http://www.shoppro.project-dc.pl/updates/' . $dir . '/ver_' . $ver . '_sql.txt';
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_HEADER, true );
$response = curl_exec( $ch );
$content_type = curl_getinfo( $ch, CURLINFO_CONTENT_TYPE );
if ( $response and strpos( $content_type, 'text/plain' ) !== false )
$sql = explode( PHP_EOL, $response );
if ( is_array( $sql ) and !empty( $sql ) ) foreach ( $sql as $query )
{
if ( $sql )
{
$result = $mdb -> query( $query );
}
}
/* usuwanie zbędnych plików */
$lines = file_get_contents( 'http://www.shoppro.project-dc.pl/updates/' . $dir . '/ver_' . $ver . '_files.txt' );
$lines = explode( PHP_EOL, $lines );
if ( is_array( $lines ) ) foreach ( $lines as $line )
$url = 'http://www.shoppro.project-dc.pl/updates/' . $dir . '/ver_' . $ver . '_files.txt';
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_HEADER, true );
$response = curl_exec( $ch );
$content_type = curl_getinfo( $ch, CURLINFO_CONTENT_TYPE );
if ( $response and strpos( $content_type, 'text/plain' ) !== false )
$files = explode( PHP_EOL, $response );
if ( is_array( $files ) and !empty( $files ) ) foreach ( $files as $file )
{
if ( strpos( $line, 'F: ' ) !== false )
if ( strpos( $file, 'F: ' ) !== false )
{
$file = substr( $line, 3, strlen( $line ) );
$file = substr( $file, 3, strlen( $file ) );
if ( file_exists( $file ) )
unlink( $file );
}
if ( strpos( $line, 'D: ' ) !== false )
if ( strpos( $file, 'D: ' ) !== false )
{
$dir = substr( $line, 3, strlen( $line ) );
$dir = substr( $file, 3, strlen( $file ) );
if ( is_dir( $dir ) )
\S::delete_dir( $dir );
}