diff --git a/admin/templates/update/main-view.php b/admin/templates/update/main-view.php index af81a3c..d22a1db 100644 --- a/admin/templates/update/main-view.php +++ b/admin/templates/update/main-view.php @@ -64,7 +64,7 @@ echo $grid -> draw(); ?> 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() diff --git a/autoload/admin/factory/class.Update.php b/autoload/admin/factory/class.Update.php index c215123..5996d2c 100644 --- a/autoload/admin/factory/class.Update.php +++ b/autoload/admin/factory/class.Update.php @@ -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 ); diff --git a/autoload/class.Log.php b/autoload/class.Log.php index 1fb80a4..0afc67e 100644 --- a/autoload/class.Log.php +++ b/autoload/class.Log.php @@ -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, diff --git a/autoload/class.S.php b/autoload/class.S.php index 8f5bf77..948f55c 100644 --- a/autoload/class.S.php +++ b/autoload/class.S.php @@ -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 ) { diff --git a/autoload/front/.DS_Store b/autoload/front/.DS_Store new file mode 100644 index 0000000..7285fd1 Binary files /dev/null and b/autoload/front/.DS_Store differ diff --git a/autoload/front/controls/class.ShopOrder.php b/autoload/front/controls/class.ShopOrder.php index 170b66a..ac40287 100644 --- a/autoload/front/controls/class.ShopOrder.php +++ b/autoload/front/controls/class.ShopOrder.php @@ -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 ] ); diff --git a/autoload/front/factory/class.ShopOrder.php b/autoload/front/factory/class.ShopOrder.php index 072eaf7..3ec5313 100644 --- a/autoload/front/factory/class.ShopOrder.php +++ b/autoload/front/factory/class.ShopOrder.php @@ -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'; diff --git a/autoload/shop/class.Order.php b/autoload/shop/class.Order.php index 28f94e8..c74b545 100644 --- a/autoload/shop/class.Order.php +++ b/autoload/shop/class.Order.php @@ -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'; diff --git a/templates/.DS_Store b/templates/.DS_Store new file mode 100644 index 0000000..35bede8 Binary files /dev/null and b/templates/.DS_Store differ diff --git a/templates/shop-order/mail-summary.php b/templates/shop-order/mail-summary.php index c598010..1320239 100644 --- a/templates/shop-order/mail-summary.php +++ b/templates/shop-order/mail-summary.php @@ -136,6 +136,13 @@ echo $this -> settings['newsletter_header']; + coupon ):?> + + + Kod rabatowy: coupon -> name;?> - coupon -> amount;?> coupon -> type == 1 ? '%' : 'zł';?> + + + order['payment_method'];?> diff --git a/templates/shop-order/order-details.php b/templates/shop-order/order-details.php index dcf2c67..c5ef684 100644 --- a/templates/shop-order/order-details.php +++ b/templates/shop-order/order-details.php @@ -5,6 +5,7 @@ $this -> order, + 'coupon' => $this -> coupon, 'statuses' => \shop\Order::order_statuses() ] );?> order['status'] == 0 or $this -> order['status'] == 2 ):?> diff --git a/templates/shop-order/order-simple.php b/templates/shop-order/order-simple.php index 9f0f5ba..e05ea45 100644 --- a/templates/shop-order/order-simple.php +++ b/templates/shop-order/order-simple.php @@ -88,6 +88,11 @@ Rabat + coupon ):?> +
+ Kod rabatowy: coupon -> name;?> - coupon -> amount;?> coupon -> type == 1 ? '%' : 'zł';?> +
+
order['transport'];?> order['transport_cost'] );?> zł
diff --git a/templates_user/shop-order/order-details.php b/templates_user/shop-order/order-details.php index a2b9d5d..1c95acf 100644 --- a/templates_user/shop-order/order-details.php +++ b/templates_user/shop-order/order-details.php @@ -5,6 +5,7 @@ $this -> order, + 'coupon' => $this -> coupon, 'statuses' => \shop\Order::order_statuses() ] );?> order['status'] == 0 or $this -> order['status'] == 2 ):?>