diff --git a/plugins/romanah/bagisto/components/Session.php b/plugins/romanah/bagisto/components/Session.php index 8fbe993..ef6e8eb 100644 --- a/plugins/romanah/bagisto/components/Session.php +++ b/plugins/romanah/bagisto/components/Session.php @@ -3,7 +3,8 @@ namespace Romanah\Bagisto\Components; use Cms\Classes\ComponentBase; -use Illuminate\Support\Facades\Http; +// use Illuminate\Support\Facades\Http; +use October\Rain\Network\Http; use Redirect; use Flash; use Session as SessionP; @@ -53,35 +54,32 @@ class Session extends ComponentBase function onAddCart() { $getToken = SessionP::get('nurgulToken'); - $data = post(); - - // $response = Http::withHeaders([ - // 'Authorization' => $getToken, - // 'Content-Type' => 'application/json' - // ])->post('https://nurgul.com.tm/app/api/customer/cart/add/'.$data["product_id"], [ - // 'product_id' => $data["product_id"], - // 'quantity' => $data["quantity"] - // ]); - - $data = [ - 'product_id' => $data["product_id"], - 'quantity' => $data["quantity"] - ]; + $dataInput = post(); - $response = Http::post('http://nurgul.com.tm/app/api/customer/cart/add/'.$data["product_id"], function ($http) use($getToken, $data) { + $response = Http::post('http://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'); - $data = json_encode($data); + // $data = $dataProd; + $data = [ + $http->data("product_id", $dataInput["product_id"]), + $http->data("quantity", $dataInput["quantity"]), + ]; - $http->setOption(CURLOPT_POSTFIELDS, $data); + $http->setOption(CURLOPT_POSTFIELDS, json_encode($data)); }); $dataqq = json_decode($response); - return $dataqq; + if (!empty($dataqq)) { + Flash::success("Üstünlikli Sebede Goşuldy"); + return redirect()->refresh(); + } elseif (empty($dataqq)) { + Flash::error('Ýalňyşlyk Ýüze Çykdy!!!'); + return redirect()->refresh(); + } } } diff --git a/themes/nurgul/layouts/mainN.htm b/themes/nurgul/layouts/mainN.htm new file mode 100755 index 0000000..db88a70 --- /dev/null +++ b/themes/nurgul/layouts/mainN.htm @@ -0,0 +1,135 @@ +[staticMenu] +code = "top-menu" + +[session] +== + +== + + + + + + + {{this.page.title}} + + + + + + + + + + + + + + + + {% styles %} + + + + {% flash %} +

+ {{ message }} +

+ {% endflash %} + +
+ + {% partial 'header' %} + + {% partial 'cart' %} + + {% partial 'mobile-menu' %} + + {% partial 'overlay' %} + + {% page %} + + {% partial 'footer' %} + + {% partial 'modals' %} + +
+ + + +
+
+
+
+
+
+
+
+ + + + + + + + + + + {% framework extras %} + + {% scripts %} + + + + diff --git a/themes/nurgul/pages/home.htm b/themes/nurgul/pages/home.htm index 00fa827..479bd12 100755 --- a/themes/nurgul/pages/home.htm +++ b/themes/nurgul/pages/home.htm @@ -1,5 +1,5 @@ url = "/" -layout = "main" +layout = "mainN" title = "Home" [products] @@ -35,5 +35,3 @@ title = "Home" {% partial 'home/brand' %} - - diff --git a/themes/nurgul/partials/cart/add.htm b/themes/nurgul/partials/cart/add.htm new file mode 100755 index 0000000..055c01a --- /dev/null +++ b/themes/nurgul/partials/cart/add.htm @@ -0,0 +1,48 @@ +{% put scripts %} + + + +{% endput %} diff --git a/themes/nurgul/partials/cart/get.htm b/themes/nurgul/partials/cart/get.htm new file mode 100755 index 0000000..1edb73b --- /dev/null +++ b/themes/nurgul/partials/cart/get.htm @@ -0,0 +1,37 @@ +{% put scripts %} + + +{% endput %} diff --git a/themes/nurgul/partials/scripts/prodCard.htm b/themes/nurgul/partials/scripts/prodCard.htm index 0a2c634..b0675d4 100755 --- a/themes/nurgul/partials/scripts/prodCard.htm +++ b/themes/nurgul/partials/scripts/prodCard.htm @@ -42,7 +42,7 @@
  • - + {{add}} diff --git a/themes/nurgul/partials/scripts/prodCardBackup.htm b/themes/nurgul/partials/scripts/prodCardBackup.htm new file mode 100755 index 0000000..39487bb --- /dev/null +++ b/themes/nurgul/partials/scripts/prodCardBackup.htm @@ -0,0 +1,166 @@ +{% put scripts %} + + + +{% endput %} \ No newline at end of file