Usunięto pliki .DS_Store, dodano kolumnę used_count do tabeli pp_shop_coupon, zaktualizowano wersję na 0.227 oraz dodano obsługę kuponów w szczegółach zamówienia.

This commit is contained in:
2025-03-11 23:56:46 +01:00
parent 9bb837d5fc
commit e674ae6f42
21 changed files with 78 additions and 40 deletions

View File

@@ -12,11 +12,11 @@ $grid -> search = [
[ 'name' => 'Wysłany', 'db' => 'send', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
];
$grid -> columns_view = [
[
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
'autoincrement' => true
], [
'name' => 'Aktywny',
'db' => 'status',
@@ -24,6 +24,11 @@ $grid -> columns_view = [
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
'sort' => true
], [
'name' => 'Użyto X razy',
'db' => 'used_count',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ],
], [
'name' => 'Nazwa',
'db' => 'name',
@@ -60,22 +65,22 @@ $grid -> columns_view = [
'db' => 'date_used',
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 150px;' ]
], [
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/shop_coupon/coupon_edit/id=[id]' ],
], [
'name' => 'Edytuj',
'action' => [ 'type' => 'edit', 'url' => '/admin/shop_coupon/coupon_edit/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
], [
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/shop_coupon/coupon_delete/id=[id]' ],
], [
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/admin/shop_coupon/coupon_delete/id=[id]' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 70px;' ],
'td' => [ 'class' => 'g-center' ]
]
];
$grid -> buttons = [
[
'label' => 'Dodaj kupon',
'url' => '/admin/shop_coupon/coupon_edit/',
[
'label' => 'Dodaj kupon',
'url' => '/admin/shop_coupon/coupon_edit/',
'icon' => 'fa-plus-circle',
'class' => 'btn-success'
]

View File

@@ -44,6 +44,9 @@ ob_start();
<div class="panel">
<div class="panel-body">
<div>Kwota zamówienia <b><?= $this -> order[ 'summary' ];?> zł</b></div>
<? if ( $this -> coupon ):?>
<div>Kod rabatowy: <span style="color: #cc0000;"><?= $this -> coupon -> name;?> - <?= $this -> coupon -> amount;?> <?= $this -> coupon -> type == 1 ? '%' : 'zł';?></span></div>
<? endif;?>
<br>
<div><?= strip_tags( $this -> order[ 'transport' ] );?>: <b><?= $this -> order[ 'transport_cost' ];?> zł</b></div>
<? if ( $this -> order['transport_id'] == 2 and $this -> order[ 'inpost_paczkomat' ] ):?>

View File

@@ -64,7 +64,7 @@ echo $grid -> draw();
?>
<?
ob_start();
echo $versions = file_get_contents( 'http://www.shoppro.project-dc.pl/updates/changelog.php' );
echo $versions = file_get_contents( 'https://shoppro.project-dc.pl/updates/changelog.php' );
$out = ob_get_clean();
$grid = new \gridEdit;

BIN
autoload/.DS_Store vendored

Binary file not shown.

View File

@@ -51,12 +51,16 @@ class ShopOrder
public static function order_details()
{
$order = new \shop\Order( (int)\S::get( 'order_id' ) );
$coupon = new \shop\Coupon( $order -> coupon_id );
return \Tpl::view( 'shop-order/order-details', [
'order' => new \shop\Order( (int)\S::get( 'order_id' ) ),
'order_statuses' => \shop\Order::order_statuses(),
'next_order_id' => \admin\factory\ShopOrder::next_order_id( (int)\S::get( 'order_id' ) ),
'prev_order_id' => \admin\factory\ShopOrder::prev_order_id( (int)\S::get( 'order_id' ) ),
] );
'order' => $order,
'coupon' => $coupon,
'order_statuses' => \shop\Order::order_statuses(),
'next_order_id' => \admin\factory\ShopOrder::next_order_id( (int)\S::get( 'order_id' ) ),
'prev_order_id' => \admin\factory\ShopOrder::prev_order_id( (int)\S::get( 'order_id' ) ),
] );
}
public static function view_list()

View File

@@ -9,7 +9,7 @@ class Update
\S::delete_session( 'new-version' );
$versions = file_get_contents( 'http://www.shoppro.project-dc.pl/updates/versions.php?key=' . $settings['update_key'] );
$versions = file_get_contents( 'https://shoppro.project-dc.pl/updates/versions.php?key=' . $settings['update_key'] );
$versions = explode( PHP_EOL, $versions );
foreach ( $versions as $ver )
@@ -22,7 +22,7 @@ class Update
else
$dir = substr( $ver, 0, strlen( $ver ) - 1 ) . 0;
$file = file_get_contents( 'http://www.shoppro.project-dc.pl/updates/' . $dir . '/ver_' . $ver . '.zip' );
$file = file_get_contents( 'https://shoppro.project-dc.pl/updates/' . $dir . '/ver_' . $ver . '.zip' );
$dlHandler = fopen( 'update.zip' , 'w' );
if ( !fwrite( $dlHandler, $file ) )
@@ -34,10 +34,10 @@ class Update
else
{
/* aktualizacja bazy danych */
$url = 'http://www.shoppro.project-dc.pl/updates/' . $dir . '/ver_' . $ver . '_sql.txt';
$url = 'https://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 );
curl_setopt( $ch, CURLOPT_HEADER, false );
$response = curl_exec( $ch );
$content_type = curl_getinfo( $ch, CURLINFO_CONTENT_TYPE );
@@ -53,10 +53,10 @@ class Update
}
/* usuwanie zbędnych plików */
$url = 'http://www.shoppro.project-dc.pl/updates/' . $dir . '/ver_' . $ver . '_files.txt';
$url = 'https://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 );
curl_setopt( $ch, CURLOPT_HEADER, false );
$response = curl_exec( $ch );
$content_type = curl_getinfo( $ch, CURLINFO_CONTENT_TYPE );

View File

@@ -4,6 +4,7 @@ class Log
static public function save_log( $message, $user_id = null )
{
global $mdb;
$mdb -> insert( 'pp_log', [
'message' => $message,
'user_id' => $user_id ? $user_id : null,

View File

@@ -395,7 +395,7 @@ class S
return $version;
$version = 0;
$versions = file_get_contents( 'http://www.shoppro.project-dc.pl/updates/versions.php?key=' . $settings['update_key'] );
$versions = file_get_contents( 'https://shoppro.project-dc.pl/updates/versions.php?key=' . $settings['update_key'] );
$versions = explode( PHP_EOL, $versions );
foreach ( $versions as $key => $version_tmp )
{

Binary file not shown.

View File

@@ -142,11 +142,14 @@ class ShopOrder
global $page, $settings;
$page['language']['meta_title'] = \S::lang( 'meta-title-szczegoly-zamowienia' ) . ' | ' . $settings['firm_name'];
$order = \front\factory\ShopOrder::order_details(
\front\factory\ShopOrder::order_id( \S::get( 'order_hash' ) )
);
$coupon = new \shop\Coupon( $order['coupon_id'] );
return \Tpl::view( 'shop-order/order-details', [
'order' => \front\factory\ShopOrder::order_details(
\front\factory\ShopOrder::order_id( \S::get( 'order_hash' ) )
),
'order' => $order,
'coupon' => $coupon,
'client' => \S::get_session( 'client' ),
'settings' => $settings
] );

View File

@@ -140,12 +140,14 @@ class ShopOrder
'apilo_order_status_date' => date( 'Y-m-d H:i:s' ),
'sellasist_order_status_date' => date( 'Y-m-d H:i:s' ),
] );
$order_id = $mdb -> id();
if ( !$order_id )
return false;
\Log::save_log( 'Złożono nowe zamówienie | NR: ' . $order_id );
if ( $coupon )
$mdb -> update( 'pp_shop_coupon', [ 'used_count[+]' => 1 ], [ 'id' => $coupon -> id ] );
// ustawienie statusu zamówienia
$mdb -> insert( 'pp_shop_order_statuses', [ 'order_id' => $order_id, 'status_id' => 0, 'mail' => 1 ] );
@@ -217,9 +219,10 @@ class ShopOrder
$order = \front\factory\ShopOrder::order_details( $order_id );
$mail_order = \Tpl::view( 'shop-order/mail-summary', [
'settings' => $settings,
'order' => $order
] );
'settings' => $settings,
'order' => $order,
'coupon' => $coupon,
] );
$settings[ 'ssl' ] ? $base = 'https' : $base = 'http';

View File

@@ -328,10 +328,12 @@ class Order implements \ArrayAccess
global $settings;
$order = \front\factory\ShopOrder::order_details( $this -> id );
$coupon = new \shop\Coupon( $order['coupon_id'] );
$mail_order = \Tpl::view( 'shop-order/mail-summary', [
'settings' => $settings,
'order' => $order
'order' => $order,
'coupon' => $coupon,
] );
$settings[ 'ssl' ] ? $base = 'https' : $base = 'http';

View File

@@ -1,7 +1,7 @@
<?php
$database['host'] = 'localhost';
$database['user'] = 'host117523_shoppro';
$database['password'] = 'f4ceujsqtO';
$database['password'] = 'mhA9WCEXEnRfTtbN33hL';
$database['name'] = 'host117523_shoppro';
$database['time_debug'] = false;
$database['long_query_time'] = 0.1;
@@ -11,8 +11,8 @@ $config['google-ads-id'] = 'AW-810084545';
$config['baselinker-start'] = '2031-06-09 21:26';
$config['redis']['host'] = '127.0.0.1';
$config['redis']['port'] = 44090;
$config['redis']['password'] = 'KvCb8A3OJl3JhML1IuD51tD6q9d3TJLu';
$config['redis']['port'] = 20470;
$config['redis']['password'] = 'Gi7FzWtkry19hZ1BqT1LKEWfwokQpigh';
$config['debug']['apilo'] = false;
?>

View File

@@ -136,6 +136,13 @@ echo $this -> settings['newsletter_header'];
</td>
</tr>
<? endif;?>
<? if ( $this -> coupon ):?>
<tr>
<td style="text-align: right; font-weight: 600; padding-top: 10px;" colspan="4">
Kod rabatowy: <span style="color: #cc0000;"><?= $this -> coupon -> name;?> - <?= $this -> coupon -> amount;?> <?= $this -> coupon -> type == 1 ? '%' : 'zł';?></span>
</td>
</tr>
<? endif;?>
<tr>
<td style="text-align: right; font-weight: 600; padding-top: 10px;" colspan="4"><?= $this -> order['payment_method'];?></td>
</tr>

View File

@@ -5,6 +5,7 @@
</div>
<?= \Tpl::view( 'shop-order/order-simple', [
'order' => $this -> order,
'coupon' => $this -> coupon,
'statuses' => \shop\Order::order_statuses()
] );?>
<? if ( $this -> order['status'] == 0 or $this -> order['status'] == 2 ):?>

View File

@@ -88,6 +88,11 @@
Rabat <span class="text-danger"><?= \S::decimal( $discount );?> zł</span>
</div>
<? endif;?>
<? if ( $this -> coupon ):?>
<div class="basket-summary">
Kod rabatowy: <span style="color: #cc0000;"><?= $this -> coupon -> name;?> - <?= $this -> coupon -> amount;?> <?= $this -> coupon -> type == 1 ? '%' : 'zł';?></span>
</div>
<? endif;?>
<div class="basket-summary">
<?= $this -> order['transport'];?> <span><?= \S::decimal( $this -> order['transport_cost'] );?> zł</span>
</div>

BIN
updates/0.20/ver_0.227.zip Normal file

Binary file not shown.

View File

@@ -0,0 +1 @@
ALTER TABLE `pp_shop_coupon` ADD COLUMN `used_count` INT NULL DEFAULT '0' AFTER `categories`;

View File

@@ -1,3 +1,6 @@
<b>ver. 0.227</b><br />
- NEW - historia kodów rabatowych
<hr>
<b>ver. 0.226</b><br />
- NEW - dodanie opcji faktury do zamówienia
<hr>

View File

@@ -15,14 +15,14 @@ if ( $_POST['action'] == 'install' )
$mysqli = new mysqli( $_POST['host'], $_POST['user'], $_POST['password'], $_POST['name'] );
$mysqli -> set_charset( 'utf8' );
$file_sql = file_get_contents( 'http://www.shoppro.project-dc.pl/updates/shopPRO_sql.txt' );
$file_sql = file_get_contents( 'https://shoppro.project-dc.pl/updates/shopPRO_sql.txt' );
$sql_commands = explode( ';', $file_sql );
for ( $i = 0; $i < count( $sql_commands ) - 1; $i++ )
$result = $mysqli -> query( $sql_commands[$i] );
mysqli_close( $mysqli );
$file = file_get_contents( 'http://www.shoppro.project-dc.pl/updates/shopPRO.zip' );
$file = file_get_contents( 'https://shoppro.project-dc.pl/updates/shopPRO.zip' );
$dlHandler = fopen( 'update.zip', 'w' );
if ( !fwrite( $dlHandler, $file ) )
@@ -206,7 +206,7 @@ if ( $_POST['action'] == 'install' )
<body>
<div class="contener">
<div class="con-form">
<div class="form-header">
<div class="form-header">
<h3 class="form-title">Instalacja</h3>
</div>
<form method="POST" action="" style="text-align: center">
@@ -225,7 +225,7 @@ if ( $_POST['action'] == 'install' )
</div>
<div class="form-group">
<label form="password">Hasło:</label>
<input type="text" name="password" value="<?= $_POST['password']?>">
<input type="text" name="password" value="<?= $_POST['password']?>">
</div>
<div class="form-footer">
<input class="testbaz" type="submit" name="action" value="Test Połączenia">

View File

@@ -1,5 +1,5 @@
<?
$current_ver = 226;
$current_ver = 227;
for ($i = 1; $i <= $current_ver; $i++)
{