diff --git a/plugins/romanah/bagisto/components/Session.php b/plugins/romanah/bagisto/components/Session.php index c5295e5..92fea25 100644 --- a/plugins/romanah/bagisto/components/Session.php +++ b/plugins/romanah/bagisto/components/Session.php @@ -57,7 +57,7 @@ class Session extends ComponentBase $dataInput = post(); - $response = Http::post('http://nurgul.com.tm/app/api/customer/cart/add/'.$dataInput["product_id"], function ($http) use($getToken, $dataInput) { + $response = Http::post('https://nurgul.com.tm/app/api/customer/cart/add/'.$dataInput["product_id"], function ($http) use($getToken, $dataInput) { // $http->header('Content-Type', 'application/json'); $http->header('Authorization', 'Bearer '.$getToken); $http->header('Accept', 'application/json'); @@ -87,7 +87,7 @@ class Session extends ComponentBase { $getToken = SessionP::get('nurgulToken'); - $response = Http::get('http://nurgul.com.tm/app/api/customer/cart', function ($http) use($getToken) { + $response = Http::get('https://nurgul.com.tm/app/api/customer/cart', function ($http) use($getToken) { $http->header('Authorization', 'Bearer '.$getToken); }); @@ -102,7 +102,7 @@ class Session extends ComponentBase $getToken = SessionP::get('nurgulToken'); $dataInput = post(); - $response = Http::delete('http://nurgul.com.tm/app/api/customer/cart/remove/'.$dataInput["item_id"], function ($http) use($getToken) { + $response = Http::delete('https://nurgul.com.tm/app/api/customer/cart/remove/'.$dataInput["item_id"], function ($http) use($getToken) { $http->header('Authorization', 'Bearer '.$getToken); }); @@ -117,7 +117,7 @@ class Session extends ComponentBase $getToken = SessionP::get('nurgulToken'); $dataInput = post(); - $response = Http::delete('http://nurgul.com.tm/app/api/customer/cart/remove/'.$dataInput["item_id"], function ($http) use($getToken) { + $response = Http::delete('https://nurgul.com.tm/app/api/customer/cart/remove/'.$dataInput["item_id"], function ($http) use($getToken) { $http->header('Authorization', 'Bearer '.$getToken); }); @@ -129,6 +129,167 @@ class Session extends ComponentBase } } + function onGetAddress() + { + $getToken = SessionP::get('nurgulToken'); + + $response = Http::get('https://nurgul.com.tm/app/api/customer/addresses', function ($http) use($getToken) { + $http->header('Authorization', 'Bearer '.$getToken); + }); + + $dataqq = json_decode($response); + + return $dataqq; + } + + function onAddAddress() + { + $getToken = SessionP::get('nurgulToken'); + $dataInput = post(); + + + $response = Http::post('https://nurgul.com.tm/app/api/customer/addresses', function ($http) use($getToken, $dataInput) { + // $http->header('Content-Type', 'application/json'); + $http->header('Authorization', 'Bearer '.$getToken); + $http->header('Accept', 'application/json'); + + // $data = $dataProd; + $data = [ + $http->data("locale", 'tm'), + $http->data("address1", [$dataInput["new_addr"]]), + $http->data("city", 'Ashgabat'), + ]; + + $http->setOption(CURLOPT_POSTFIELDS, json_encode($data)); + }); + + $dataqq = json_decode($response); + + if (!empty($dataqq)) { + Flash::success("Üstünlikli Salgy Goşuldy"); + return redirect()->refresh(); + } elseif (empty($dataqq)) { + Flash::error('Ýalňyşlyk Ýüze Çykdy!!!'); + return redirect()->refresh(); + } + } + + + function onSaveShipping() + { + $getToken = SessionP::get('nurgulToken'); + $dataInput = post(); + + + $response = Http::post('https://nurgul.com.tm/app/api/customer/checkout/save-shipping', function ($http) use($getToken, $dataInput) { + // $http->header('Content-Type', 'application/json'); + $http->header('Authorization', 'Bearer '.$getToken); + $http->header('Accept', 'application/json'); + + // $data = $dataProd; + $data = [ + $http->data("billing", ["address1" => [$dataInput["selected_address"]]]), + $http->data("shipping", ["address1" => [$dataInput["selected_address"]]]), + $http->data("shipping_method", 'courier_courier'), + ]; + + + $http->setOption(CURLOPT_POSTFIELDS, json_encode($data)); + }); + + $dataqq = json_decode($response); + + return $dataqq; + } + + function onSavePayment() + { + $getToken = SessionP::get('nurgulToken'); + $dataInput = post(); + + + $response = Http::post('https://nurgul.com.tm/app/api/customer/checkout/save-payment', function ($http) use($getToken, $dataInput) { + // $http->header('Content-Type', 'application/json'); + $http->header('Authorization', 'Bearer '.$getToken); + $http->header('Accept', 'application/json'); + + // $data = $dataProd; + $data = [ + $http->data("payment", ["method" => $dataInput["payment"]]), + ]; + + $http->setOption(CURLOPT_POSTFIELDS, json_encode($data)); + }); + + $dataqq = json_decode($response); + + return $dataqq; + } + + + function onSaveOrder() + { + $getToken = SessionP::get('nurgulToken'); + + + $response = Http::post('https://nurgul.com.tm/app/api/customer/checkout/save-order', function ($http) use($getToken) { + // $http->header('Content-Type', 'application/json'); + $http->header('Authorization', 'Bearer '.$getToken); + $http->header('Accept', 'application/json'); + + + $http->setOption(CURLOPT_POSTFIELDS); + }); + + $dataqq = json_decode($response); + + if (!empty($dataqq)) { + Flash::success("Sargydyňyz Üstünlikli Amala Aşyryldy"); + return Redirect::to('/'); + } elseif (empty($dataqq)) { + Flash::error('Ýalňyşlyk Ýüze Çykdy!!!'); + return redirect()->refresh(); + } + } + + + function onSaveWishlist() + { + $getToken = SessionP::get('nurgulToken'); + $dataInput = post(); + + + $response = Http::post('https://nurgul.com.tm/app/api/customer/wishlist/'.$dataInput["product_id"], function ($http) use($getToken, $dataInput) { + // $http->header('Content-Type', 'application/json'); + $http->header('Authorization', 'Bearer '.$getToken); + $http->header('Accept', 'application/json'); + + $http->setOption(CURLOPT_POSTFIELDS); + }); + + $dataqq = json_decode($response); + + if (!empty($dataqq)) { + Flash::success("Halanlaryma Üstünlikli Goşuldy"); + return Redirect::to('/wishlist'); + } elseif (empty($dataqq)) { + Flash::error('Ýalňyşlyk Ýüze Çykdy!!!'); + return redirect()->refresh(); + } + } + + function onGetWish() + { + $getToken = SessionP::get('nurgulToken'); + + $response = Http::get('https://nurgul.com.tm/app/api/customer/wishlist', function ($http) use($getToken) { + $http->header('Authorization', 'Bearer '.$getToken); + }); + + $dataqq = json_decode($response); + + return $dataqq; + } } diff --git a/themes/nurgul/pages/cart.htm b/themes/nurgul/pages/cart.htm index 5fab831..6eb0428 100755 --- a/themes/nurgul/pages/cart.htm +++ b/themes/nurgul/pages/cart.htm @@ -1,6 +1,6 @@ -title = "Cart" url = "/cart" layout = "mainN" +title = "Cart" == {%partial "bread" title='cart.title'|_ %} @@ -51,7 +51,7 @@ layout = "mainN"
@@ -59,4 +59,4 @@ layout = "mainN" - + \ No newline at end of file diff --git a/themes/nurgul/pages/category.htm b/themes/nurgul/pages/category.htm index af5dbf0..202e3a2 100755 --- a/themes/nurgul/pages/category.htm +++ b/themes/nurgul/pages/category.htm @@ -72,7 +72,7 @@ function onStart(){ - {% partial 'product/tab-pane' %} + {% partial 'product/tab-pane' id='cat' %} diff --git a/themes/nurgul/pages/checkout.htm b/themes/nurgul/pages/checkout.htm new file mode 100755 index 0000000..e061d07 --- /dev/null +++ b/themes/nurgul/pages/checkout.htm @@ -0,0 +1,179 @@ +title = "Checkout" +url = "/checkout" +layout = "mainN" +== +{%partial "bread" title='checkout.title'|_ %} +| {{'checkout.order.total'|_}} | +0.00 TMT | +