From 0e534ad723e535b83c67961cc88725ad850a4336 Mon Sep 17 00:00:00 2001 From: franknstayn Date: Wed, 6 Oct 2021 06:05:04 +0800 Subject: [PATCH] added canada --- .../Controllers/paypal/PaypalController.php | 309 +- .../teamstore/TeamStoreController.php | 42 +- app/Http/Controllers/user/UserController.php | 18 +- config/services.php | 8 +- public/api/canada.json | 372 ++ public/api/usa.json | 238 + resources/views/merchbay/cart.blade.php | 729 +-- resources/views/merchbay/index.blade.php | 8 +- .../views/user-layouts/address_book.blade.php | 4 +- .../create_address_book.blade.php | 150 +- .../user-layouts/edit_address_book.blade.php | 12 +- .../user-layouts/store_setting.blade.php | 2 +- .../user-layouts/user_template.blade.php | 4099 +++++++++-------- 13 files changed, 3521 insertions(+), 2470 deletions(-) create mode 100644 public/api/canada.json create mode 100644 public/api/usa.json diff --git a/app/Http/Controllers/paypal/PaypalController.php b/app/Http/Controllers/paypal/PaypalController.php index 26cc1a5..2b65b2f 100755 --- a/app/Http/Controllers/paypal/PaypalController.php +++ b/app/Http/Controllers/paypal/PaypalController.php @@ -1,6 +1,7 @@ _apiContext = PayPal::ApiContext( - config('services.paypal_'.$paypal_env.'.client_id'), - config('services.paypal_'.$paypal_env.'.secret') + config('services.paypal_' . $paypal_env . '.client_id'), + config('services.paypal_' . $paypal_env . '.secret') // config('services.paypal_live.client_id'), // config('services.paypal_live.secret') ); - $this->_apiContext->setConfig(array( + $this->_apiContext->setConfig(array( 'mode' => $paypal_env, 'service.EndPoint' => $paypal_apiUrl, 'http.ConnectionTimeOut' => 30, 'log.LogEnabled' => true, 'log.FileName' => storage_path('logs/paypal.log'), 'log.LogLevel' => 'FINE' - )); + )); // live // $this->_apiContext->setConfig(array( @@ -76,16 +77,36 @@ class PaypalController extends Controller public function getCheckout(Request $request) { + $UserModel = new UserModel; if (Auth::guest()) { - $message = 'Please Sign in to your account to proceed.'; Session::flash('msg', $message); return Redirect::back(); } + $userId = Auth::user()->id; + $array_address_book = $UserModel->selectAddresBook('UserId', $userId); + if (count($array_address_book) <= 0) { + $message = 'Please add Shipping address.'; + Session::flash('cartkeyError', $message); + return Redirect::back(); + } + + // $shippingAddress = [ + // "recipient_name" => $array_address_book[0]->Fullname, + // "line1" => $array_address_book[0]->Address, + // "line2" => "", + // "city" => $array_address_book[0]->City, + // "country_code" => $array_address_book[0]->CountryCode, + // "postal_code" => $array_address_book[0]->ZipCode, + // "state" => $array_address_book[0]->State, + // "phone" => $array_address_book[0]->ContactNumber + // ]; + + // $request->session()->forget('cartkey'); - if(!$request->session()->has('cartkey')){ + if (!$request->session()->has('cartkey')) { $message = 'Your cart is empty'; Session::flash('cartkeyError', $message); return Redirect::back(); @@ -94,13 +115,35 @@ class PaypalController extends Controller $payer = PayPal::Payer(); $payer->setPaymentMethod('paypal'); + $inputFields = Paypal::InputFields(); + $inputFields->setAllowNote(true) + ->setNoShipping(1) + ->setAddressOverride(0); + $webProfile = Paypal::WebProfile(); + $webProfile->setName("YeowZa! T-Shirt Shop" . uniqid()) + // ->setPresentation($presentation) + ->setInputFields($inputFields); + + // $shipping = PayPal::ShippingAddress(); + // $shipping->setRecipientName($array_address_book[0]->Fullname); + // $shipping->setLine1($array_address_book[0]->Address); + // $shipping->setCity($array_address_book[0]->City); + // $shipping->setCountryCode($array_address_book[0]->CountryCode); + // $shipping->setPostalCode($array_address_book[0]->ZipCode); + // $shipping->setState($array_address_book[0]->State); + // $shipping->setPhone($array_address_book[0]->ContactNumber); + + // $payerInfo = Paypal::PayerInfo(); + // $payerInfo->setShippingAddress($shipping); + // $payer->setPayerInfo($payerInfo); + $m = new TeamStoreModel; $paypal_model = new PayPalModel; $last_id = $paypal_model->getLastIdPaymentDetails(); // var_dump(count($last_id)); - if(count($last_id) > 0){ + if (count($last_id) > 0) { $lastId = $last_id[0]->Id + 1; - }else{ + } else { $lastId = 1; } $invoice_num = str_pad($lastId, 6, '0', STR_PAD_LEFT); @@ -108,74 +151,20 @@ class PaypalController extends Controller $cartKey = $request->session()->get('cartkey'); $items = $m->myCart($cartKey); - $getSubtotal = $m->getSubtotal($cartKey); + $grouped_item = $m->selectTeamStoreGroupByCartKey($cartKey); $store_array = $m->selectTeamStore('Id', $grouped_item[0]->StoreId); - $getSmallItemQty = 0; - $getBulkyItemQty = 0; - $getMaskItemQty = 0; - $getDGSItemQty = 0; - $shippingFee = 0; + $shippingFee = $this->getShippingFee($cartKey); - foreach ($items as $item) { - if ($item->VoucherId != null) { - $voucherIds[] = $item->VoucherId; - $voucher = $m->selectVoucherWhereIn($voucherIds); - $item_id = $item->Id; - $totalValue = $voucher[0]->VoucherValue; - if ($voucher[0]->VoucherType == "Percentage") { - $getPercentageValue = $totalValue / 100; - $getDiscountValue = ($getSubtotal[0]->Subtotal * $getPercentageValue); - $data = array( - 'Price' => round($getDiscountValue * -1, 2) - ); + $tax = $this->getTax($cartKey)['tax']; + $order_grandtotal = $this->getTax($cartKey)['order_grandtotal']; - $m->updateVoucherValueInCart($data, $item_id); - } else { - $voucherData = array( - 'totalValue' => $totalValue, - 'type' => 'Flat' - ); - } - } - - if($item->ShippingCostId == 1){ - $getSmallItemQty += $item->Quantity; - }else if($item->ShippingCostId == 2){ - $getBulkyItemQty += $item->Quantity; - }else if($item->ShippingCostId == 3){ - $getMaskItemQty += $item->Quantity; - }else if($item->ShippingCostId == 4){ - $getDGSItemQty += $item->Quantity; - } - } - - - - $getSmallItemQty = ceil($getSmallItemQty / 3) * 8; - $getBulkyItemQty = ceil($getBulkyItemQty / 1) * 8; - $getMaskItemQty = ceil($getMaskItemQty / 25) * 8; - $getDGSItemQty = ceil($getDGSItemQty / 4) * 5; - $shippingFee = $getSmallItemQty + $getBulkyItemQty + $getMaskItemQty + $getDGSItemQty; - // var_dump($shippingFee); - $order_items = array(); $updated_items = $m->myCart($cartKey); - $updated_getSubtotal = $m->getSubtotal($cartKey); - // $order_subtotal = $updated_getSubtotal[0]->Subtotal; - $order_grandtotal = $updated_getSubtotal[0]->Subtotal; - - if ($grouped_item[0]->StoreId == 76 || $grouped_item[0]->StoreId == 78 || $grouped_item[0]->StoreId == 111 || $grouped_item[0]->StoreId == 131 || $grouped_item[0]->StoreId == 30 || $grouped_item[0]->StoreId == 141 || $grouped_item[0]->StoreId == 162 || $grouped_item[0]->StoreId == 185 || $grouped_item[0]->StoreId == 244) { - $tax_value = 0; - } else { - $tax_value = 0.10; - } - - $tax = $order_grandtotal * $tax_value; foreach ($updated_items as $key => $item) { @@ -192,6 +181,19 @@ class PaypalController extends Controller $item_list = PayPal::ItemList(); $item_list->setItems($order_items); + + + $shipping = PayPal::ShippingAddress(); + $shipping->setRecipientName($array_address_book[0]->Fullname); + $shipping->setLine1($array_address_book[0]->Address); + $shipping->setCity($array_address_book[0]->City); + $shipping->setCountryCode($array_address_book[0]->CountryCode); + $shipping->setPostalCode($array_address_book[0]->ZipCode); + $shipping->setState($array_address_book[0]->State); + $shipping->setPhone($array_address_book[0]->ContactNumber); + $item_list->setShippingAddress($shipping); + // var_dump($item_list); + $amount_details = PayPal::Details(); $amount_details->setSubtotal($order_grandtotal); $amount_details->setTax($tax); @@ -212,9 +214,13 @@ class PaypalController extends Controller $redirectUrls = PayPal::RedirectUrls(); $redirectUrls->setReturnUrl(route('getDone')); $redirectUrls->setCancelUrl(route('getCancel')); - + // var_dump($shippingAddress) $payment = PayPal::Payment(); + + var_dump(array($transaction)); + + $payment->setExperienceProfileId($this->createWebProfile()); $payment->setIntent('sale'); $payment->setPayer($payer); $payment->setRedirectUrls($redirectUrls); @@ -253,6 +259,108 @@ class PaypalController extends Controller } + public function getShippingFee($cartKey) + { + + $m = new TeamStoreModel; + $UserModel = new UserModel; + $userId = Auth::user()->id; + + + $items = $m->myCart($cartKey); // item from cart_tmp + $getSubtotal = $m->getSubtotal($cartKey); + $getSmallItemQty = 0; + $getBulkyItemQty = 0; + $getMaskItemQty = 0; + $getDGSItemQty = 0; + $shippingFee = 0; + $CAShippingfee = 0; + + + foreach ($items as $item) { + if ($item->VoucherId != null) { + $voucherIds[] = $item->VoucherId; + $voucher = $m->selectVoucherWhereIn($voucherIds); + $item_id = $item->Id; + $totalValue = $voucher[0]->VoucherValue; + if ($voucher[0]->VoucherType == "Percentage") { + $getPercentageValue = $totalValue / 100; + $getDiscountValue = ($getSubtotal[0]->Subtotal * $getPercentageValue); + $data = array( + 'Price' => round($getDiscountValue * -1, 2) + ); + + $m->updateVoucherValueInCart($data, $item_id); + } else { + $voucherData = array( + 'totalValue' => $totalValue, + 'type' => 'Flat' + ); + } + } + + if ($item->ShippingCostId == 1) { + $getSmallItemQty += $item->Quantity; + } else if ($item->ShippingCostId == 2) { + $getBulkyItemQty += $item->Quantity; + } else if ($item->ShippingCostId == 3) { + $getMaskItemQty += $item->Quantity; + } else if ($item->ShippingCostId == 4) { + $getDGSItemQty += $item->Quantity; + } + + $CAShippingfee += $item->Quantity; // for canada + } + + $array_address_book = $UserModel->selectAddresBook('UserId', $userId); + $countryCode = ""; + if (count($array_address_book) > 0) { + $countryCode = $array_address_book[0]->CountryCode; + $CAShippingfee = ceil($CAShippingfee / 2) * 30; + } + + $getSmallItemQty = ceil($getSmallItemQty / 3) * 8; + $getBulkyItemQty = ceil($getBulkyItemQty / 1) * 8; + $getMaskItemQty = ceil($getMaskItemQty / 25) * 8; + $getDGSItemQty = ceil($getDGSItemQty / 4) * 5; + $shippingFee = $getSmallItemQty + $getBulkyItemQty + $getMaskItemQty + $getDGSItemQty; + + if ($countryCode == "CA") { + $shippingFee = $CAShippingfee; + } + + return $shippingFee; + } + + public function getTax($cartKey) + { + $m = new TeamStoreModel; + $updated_getSubtotal = $m->getSubtotal($cartKey); + $grouped_item = $m->selectTeamStoreGroupByCartKey($cartKey); + + if (count($grouped_item) <= 0) { + $tax_value = 0; + } else { + if ($grouped_item[0]->StoreId == 76 || $grouped_item[0]->StoreId == 78 || $grouped_item[0]->StoreId == 111 || $grouped_item[0]->StoreId == 131 || $grouped_item[0]->StoreId == 30 || $grouped_item[0]->StoreId == 141 || $grouped_item[0]->StoreId == 162 || $grouped_item[0]->StoreId == 185 || $grouped_item[0]->StoreId == 244) { + $tax_value = 0; + } else { + $tax_value = 0.10; + } + } + + + $order_grandtotal = $updated_getSubtotal[0]->Subtotal; + + + + $tax = $order_grandtotal * $tax_value; + + return [ + 'tax' => $tax, + 'order_grandtotal' => $order_grandtotal, + ]; + } + public function getDone(Request $request) { $id = $request->get('paymentId'); @@ -261,19 +369,19 @@ class PaypalController extends Controller try { $payment = PayPal::getById($id, $this->_apiContext); - + $paymentExecution = PayPal::PaymentExecution(); - + $paymentExecution->setPayerId($payer_id); $executePayment = $payment->execute($paymentExecution, $this->_apiContext); $obj = json_decode($executePayment); - + // var_dump($obj); } catch (PayPalConnectionException $e) { //throw $th; // echo $e->getCode(); echo $e->getData(); - Session::put('cartkeyError','Invalid payment.'); - return Redirect::route('cart'); + Session::put('cartkeyError', 'Invalid payment.'); + return Redirect::route('cart'); } @@ -287,8 +395,9 @@ class PaypalController extends Controller // // return Redirect::route('paywithpaypal'); // echo 'Payment success'; // } - + // var_dump($obj->payer->payer_info->shipping_address); + // var_dump($obj->transactions[0]->item_list->shipping_address); $line2 = null; @@ -330,9 +439,6 @@ class PaypalController extends Controller $userId = Auth::user()->id; $user_email = Auth::user()->email; - $items = $m->myCart($cartKey); // item from cart_tmp - $getSubtotal = $m->getSubtotal($cartKey); - $payment_details = array( 'UserId' => $userId, @@ -471,4 +577,47 @@ class PaypalController extends Controller return redirect()->route('cart'); } -} \ No newline at end of file + + public function createWebProfile() + { + $UserModel = new UserModel; + $userId = Auth::user()->id; + $array_address_book = $UserModel->selectAddresBook('UserId', $userId); + if (count($array_address_book) <= 0) { + $message = 'Please add Shipping address.'; + Session::flash('cartkeyError', $message); + return Redirect::back(); + } + + // $shippingAddress = [ + // "recipient_name" => , + + $flowConfig = PayPal::FlowConfig(); + $presentation = PayPal::Presentation(); + $inputFields = PayPal::InputFields(); + $webProfile = PayPal::WebProfile(); + + + // $presentation->setLogoImage("https://www.crewsportswear.com/beta/public/images/logo.png")->setBrandName("Merchbay"); //NB: Paypal recommended to use https for the logo's address and the size set to 190x60. + $presentation->setBrandName("Merchbay"); //NB: Paypal recommended to use https for the logo's address and the size set to 190x60. + + if ($array_address_book[0]->CountryCode == "CA") { + $flowConfig->setLandingPageType("Billing"); //Set the page type + $inputFields->setAllowNote(true)->setAddressOverride(1); + } else { + $inputFields->setAllowNote(true)->setAddressOverride(0); + } + + + $webProfile->setName("Merchbay " . uniqid()) + ->setFlowConfig($flowConfig) + // Parameters for style and presentation. + ->setPresentation($presentation) + // Parameters for input field customization. + ->setInputFields($inputFields); + + $createProfileResponse = $webProfile->create($this->_apiContext); + + return $createProfileResponse->getId(); //The new webprofile's id + } +} diff --git a/app/Http/Controllers/teamstore/TeamStoreController.php b/app/Http/Controllers/teamstore/TeamStoreController.php index daa1e8f..c7c69d3 100755 --- a/app/Http/Controllers/teamstore/TeamStoreController.php +++ b/app/Http/Controllers/teamstore/TeamStoreController.php @@ -191,8 +191,8 @@ class TeamStoreController extends Controller alert("Invalid Password"); window.history.back(); '; - // return redirect('cart'); - + // return redirect('cart'); + // return redirect('/'); } } @@ -586,6 +586,14 @@ class TeamStoreController extends Controller { $m = new TeamStoreModel; + $UserModel = new UserModel; + + $userId = Auth::user()->id; + $array_address_book = $UserModel->selectAddresBook('UserId', $userId); + if (count($array_address_book) <= 0) { + $array_address_book = null; + } + $cartKey = $request->session()->get('cartkey'); $items = $m->myCart($cartKey); $getSubtotal = $m->getSubtotal($cartKey); @@ -639,13 +647,26 @@ class TeamStoreController extends Controller } else { $finalSubTotal = $getSubtotal[0]->Subtotal; } + + if($cartKey != null) { + $shippingFee = app(\App\Http\Controllers\paypal\PaypalController::class)->getShippingFee($cartKey); + $tax = app(\App\Http\Controllers\paypal\PaypalController::class)->getTax($cartKey); + }else{ + $shippingFee = 0; + $tax = []; + } + return view('merchbay.cart') ->with('item_group', $items_group) ->with('row', $items) ->with('img_thumb', $item_thumbs) ->with('getSubtotal', $finalSubTotal) - ->with('store_array', $store_array); + ->with('store_array', $store_array) + ->with('store_array', $store_array) + ->with('shipping_fee', $shippingFee) + ->with('tax', $tax) + ->with('address_book', $array_address_book); } public function addVoucher(Request $request) @@ -818,10 +839,11 @@ class TeamStoreController extends Controller $m = new TemplatesModel; $data = $m->selectAllTemplate(); return view('merchbay.templates') - ->with('row', $data); + ->with('row', $data); } - public function contactUsSend(Request $request) { + public function contactUsSend(Request $request) + { $post = $request->all(); $post['captcha'] = $this->captchaCheck(); @@ -850,7 +872,7 @@ class TeamStoreController extends Controller $message = ' '; Session::flash('contactUserError', $message); return Redirect::back(); @@ -861,11 +883,11 @@ class TeamStoreController extends Controller 'emailAddress' => $post['emailAddress'], 'msg' => $post['message'], 'receiver' => 'orders@merchbay.com', - 'email_cc' => ['webmaster@merchbay.com','angelo@merchbay.com'], + 'email_cc' => ['webmaster@merchbay.com', 'angelo@merchbay.com'], 'subject' => 'Merchbay - Contact Us Page', ); - Mail::send('emails.contact_us', $data, function ($msg) use ($data) { + Mail::send('emails.contact_us', $data, function ($msg) use ($data) { $msg->from('support@merchbay.com', 'Merchbay Contact Us Page'); $msg->bcc($data['email_cc'], 'Merchbay Contact Us Page'); $msg->to($data['receiver'])->subject($data['subject']); @@ -874,7 +896,7 @@ class TeamStoreController extends Controller $contactUsUrl = url('/contact-us'); echo ''; } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/user/UserController.php b/app/Http/Controllers/user/UserController.php index a6d05a8..2e9e2d8 100755 --- a/app/Http/Controllers/user/UserController.php +++ b/app/Http/Controllers/user/UserController.php @@ -81,7 +81,9 @@ class UserController extends Controller { 'Address' => $post['address'], 'State' => $post['state'], 'City' => $post['city'], - 'ZipCode' => $post['zipcode'] + 'ZipCode' => $post['zipcode'], + 'CountryCode' => $post['countryCode'], + 'Country' => $post['country'] ); echo $i = $m->insertAddressBook($data); @@ -118,7 +120,9 @@ class UserController extends Controller { 'Address' => $post['address'], 'State' => $post['state'], 'City' => $post['city'], - 'ZipCode' => $post['zipcode'] + 'ZipCode' => $post['zipcode'], + 'CountryCode' => $post['countryCode'], + 'Country' => $post['country'] ); echo $i = $m->saveUpdateAddressBook($data, $id); @@ -937,7 +941,7 @@ class UserController extends Controller { } $data = array( - 'StoreUrl' => $store_url, + // 'StoreUrl' => $store_url, // 'ImageFolder' => $store_url, 'Password' => $store_password, 'HashId' => md5($store_url), @@ -1183,5 +1187,13 @@ class UserController extends Controller { // $response = $UserModel->updateAnnouncement($getAnnouncement[0]->Id, $data); } + + function getAddressBook() { + $UserModel = new UserModel; + $userId = Auth::user()->id; + $array_address_book = $UserModel->selectAddresBook('UserId', $userId); + + return $array_address_book; + } } diff --git a/config/services.php b/config/services.php index f1c9e70..cda926b 100755 --- a/config/services.php +++ b/config/services.php @@ -59,10 +59,10 @@ return [ // ], // sandbox crew - // 'paypal_sandbox' => [ - // 'client_id' => 'AQuz-HKzQiL7FygkG8skSekaWf-RP6Rgj4f1XeX1Ghp86bUFj7tQXVT1xbpluu5_WCGRbQpOVGtlJKVB', - // 'secret' => 'EJAMKxQsl-mFkL_4J_90cvTamYfcsgswqgIxz9wQPiRAwJ6sy_wNsttMlmrXIpxI96JpYzdMXkLCHAPz' - // ], + 'paypal_sandbox' => [ + 'client_id' => 'AQuz-HKzQiL7FygkG8skSekaWf-RP6Rgj4f1XeX1Ghp86bUFj7tQXVT1xbpluu5_WCGRbQpOVGtlJKVB', + 'secret' => 'EJAMKxQsl-mFkL_4J_90cvTamYfcsgswqgIxz9wQPiRAwJ6sy_wNsttMlmrXIpxI96JpYzdMXkLCHAPz' + ], // live crew 'paypal_live' => [ diff --git a/public/api/canada.json b/public/api/canada.json new file mode 100644 index 0000000..198f645 --- /dev/null +++ b/public/api/canada.json @@ -0,0 +1,372 @@ +{ + "Alberta": [ + "Airdrie", + "Grande Prairie", + "Red Deer", + "Beaumont", + "Hanna", + "St. Albert", + "Bonnyville", + "Hinton", + "Spruce Grove", + "Brazeau", + "Irricana", + "Strathcona County", + "Breton", + "Lacombe", + "Strathmore", + "Calgary", + "Leduc", + "Sylvan Lake", + "Camrose", + "Lethbridge", + "Swan Hills", + "Canmore", + "McLennan", + "Taber", + "Didzbury", + "Medicine Hat", + "Turner Valley", + "Drayton Valley", + "Olds", + "Vermillion", + "Edmonton", + "Onoway", + "Wood Buffalo", + "Ft. Saskatchewan", + "Provost" + ], + "British Columbia": [ + "Burnaby", + "Lumby", + "City of Port Moody", + "Cache Creek", + "Maple Ridge", + "Prince George", + "Castlegar", + "Merritt", + "Prince Rupert", + "Chemainus", + "Mission", + "Richmond", + "Chilliwack", + "Nanaimo", + "Saanich", + "Clearwater", + "Nelson", + "Sooke", + "Colwood", + "New Westminster", + "Sparwood", + "Coquitlam", + "North Cowichan", + "Surrey", + "Cranbrook", + "North Vancouver", + "Terrace", + "Dawson Creek", + "North Vancouver", + "Tumbler", + "Delta", + "Osoyoos", + "Vancouver", + "Fernie", + "Parksville", + "Vancouver", + "Invermere", + "Peace River", + "Vernon", + "Kamloops", + "Penticton", + "Victoria", + "Kaslo", + "Port Alberni", + "Whistler", + "Langley", + "Port Hardy" + ], + "Manitoba": [ + "Birtle", + "Flin Flon", + "Swan River", + "Brandon", + "Snow Lake", + "The Pas", + "Cranberry Portage", + "Steinbach", + "Thompson", + "Dauphin", + "Stonewall", + "Winnipeg" + ], + "New Brunswick": [ + "Cap-Pele", + "Miramichi", + "Saint John", + "Fredericton", + "Moncton", + "Saint Stephen", + "Grand Bay-Westfield", + "Oromocto", + "Shippagan", + "Grand Falls", + "Port Elgin", + "Sussex", + "Memramcook", + "Sackville", + "Tracadie-Sheila" + ], + "Newfoundland And Labrador": [ + "Argentia", + "Corner Brook", + "Paradise", + "Bishop's Falls", + "Labrador City", + "Portaux Basques", + "Botwood", + "Mount Pearl", + "St. John's", + "Brigus" + ], + "Northwest Territories": [ + "Town of Hay River", + "Town of Inuvik", + "Yellowknife" + ], + "Nova Scotia": [ + "Amherst", + "Hants County", + "Pictou", + "Annapolis", + "Inverness County", + "Pictou County", + "Argyle", + "Kentville", + "Queens", + "Baddeck", + "County of Kings", + "Richmond", + "Bridgewater", + "Lunenburg", + "Shelburne", + "Cape Breton", + "Lunenburg County", + "Stellarton", + "Chester", + "Mahone Bay", + "Truro", + "Cumberland County", + "New Glasgow", + "Windsor", + "East Hants", + "New Minas", + "Yarmouth", + "Halifax", + "Parrsboro" + ], + "Ontario": [ + "Ajax", + "Halton", + "Peterborough", + "Atikokan", + "Halton Hills", + "Pickering", + "Barrie", + "Hamilton", + "Port Bruce", + "Belleville", + "Hamilton-Wentworth", + "Port Burwell", + "Blandford-Blenheim", + "Hearst", + "Port Colborne", + "Blind River", + "Huntsville", + "Port Hope", + "Brampton", + "Ingersoll", + "Prince Edward", + "Brant", + "James", + "Quinte West", + "Brantford", + "Kanata", + "Renfrew", + "Brock", + "Kincardine", + "Richmond Hill", + "Brockville", + "King", + "Sarnia", + "Burlington", + "Kingston", + "Sault Ste. Marie", + "Caledon", + "Kirkland Lake", + "Scarborough", + "Cambridge", + "Kitchener", + "Scugog", + "Chatham-Kent", + "Larder Lake", + "Souix Lookout CoC Sioux Lookout", + "Chesterville", + "Leamington", + "Smiths Falls", + "Clarington", + "Lennox-Addington", + "South-West Oxford", + "Cobourg", + "Lincoln", + "St. Catharines", + "Cochrane", + "Lindsay", + "St. Thomas", + "Collingwood", + "London", + "Stoney Creek", + "Cornwall", + "Loyalist Township", + "Stratford", + "Cumberland", + "Markham", + "Sudbury", + "Deep River", + "Metro Toronto", + "Temagami", + "Dundas", + "Merrickville", + "Thorold", + "Durham", + "Milton", + "Thunder Bay", + "Dymond", + "Nepean", + "Tillsonburg", + "Ear Falls", + "Newmarket", + "Timmins", + "East Gwillimbury", + "Niagara", + "Toronto", + "East Zorra-Tavistock", + "Niagara Falls", + "Uxbridge", + "Elgin", + "Niagara-on-the-Lake", + "Vaughan", + "Elliot Lake", + "North Bay", + "Wainfleet", + "Flamborough", + "North Dorchester", + "Wasaga Beach", + "Fort Erie", + "North Dumfries", + "Waterloo", + "Fort Frances", + "North York", + "Waterloo", + "Gananoque", + "Norwich", + "Welland", + "Georgina", + "Oakville", + "Wellesley", + "Glanbrook", + "Orangeville", + "West Carleton", + "Gloucester", + "Orillia", + "West Lincoln", + "Goulbourn", + "Osgoode", + "Whitby", + "Gravenhurst", + "Oshawa", + "Wilmot", + "Grimsby", + "Ottawa", + "Windsor", + "Guelph", + "Ottawa-Carleton", + "Woolwich", + "Haldimand-Norfork", + "Owen Sound", + "York" + ], + "Prince Edward Island": [ + "Alberton", + "Montague", + "Stratford", + "Charlottetown", + "Souris", + "Summerside", + "Cornwall" + ], + "Quebec": [ + "Alma", + "Fleurimont", + "Longueuil", + "Amos", + "Gaspe", + "Marieville", + "Anjou", + "Gatineau", + "Mount Royal", + "Aylmer", + "Hull", + "Montreal", + "Beauport", + "Joliette", + "Montreal Region", + "Bromptonville", + "Jonquiere", + "Montreal-Est", + "Brosssard", + "Lachine", + "Quebec", + "Chateauguay", + "Lasalle", + "Saint-Leonard", + "Chicoutimi", + "Laurentides", + "Sherbrooke", + "Coaticook", + "LaSalle", + "Sorel", + "Coaticook", + "Laval", + "Thetford Mines", + "Dorval", + "Lennoxville", + "Victoriaville", + "Drummondville", + "Levis" + ], + "Saskatchewan": [ + "Avonlea", + "Melfort", + "Swift Current", + "Colonsay", + "Nipawin", + "Tisdale", + "Craik", + "Prince Albert", + "Unity", + "Creighton", + "Regina", + "Weyburn", + "Eastend", + "Saskatoon", + "Wynyard", + "Esterhazy", + "Shell Lake", + "Yorkton", + "Gravelbourg" + ], + "Yukon": [ + "Carcross", + "Whitehorse" + ] +} \ No newline at end of file diff --git a/public/api/usa.json b/public/api/usa.json new file mode 100644 index 0000000..396778e --- /dev/null +++ b/public/api/usa.json @@ -0,0 +1,238 @@ +[ + { + "name": "Alabama", + "abbreviation": "AL" + }, + { + "name": "Alaska", + "abbreviation": "AK" + }, + { + "name": "American Samoa", + "abbreviation": "AS" + }, + { + "name": "Arizona", + "abbreviation": "AZ" + }, + { + "name": "Arkansas", + "abbreviation": "AR" + }, + { + "name": "California", + "abbreviation": "CA" + }, + { + "name": "Colorado", + "abbreviation": "CO" + }, + { + "name": "Connecticut", + "abbreviation": "CT" + }, + { + "name": "Delaware", + "abbreviation": "DE" + }, + { + "name": "District Of Columbia", + "abbreviation": "DC" + }, + { + "name": "Federated States Of Micronesia", + "abbreviation": "FM" + }, + { + "name": "Florida", + "abbreviation": "FL" + }, + { + "name": "Georgia", + "abbreviation": "GA" + }, + { + "name": "Guam", + "abbreviation": "GU" + }, + { + "name": "Hawaii", + "abbreviation": "HI" + }, + { + "name": "Idaho", + "abbreviation": "ID" + }, + { + "name": "Illinois", + "abbreviation": "IL" + }, + { + "name": "Indiana", + "abbreviation": "IN" + }, + { + "name": "Iowa", + "abbreviation": "IA" + }, + { + "name": "Kansas", + "abbreviation": "KS" + }, + { + "name": "Kentucky", + "abbreviation": "KY" + }, + { + "name": "Louisiana", + "abbreviation": "LA" + }, + { + "name": "Maine", + "abbreviation": "ME" + }, + { + "name": "Marshall Islands", + "abbreviation": "MH" + }, + { + "name": "Maryland", + "abbreviation": "MD" + }, + { + "name": "Massachusetts", + "abbreviation": "MA" + }, + { + "name": "Michigan", + "abbreviation": "MI" + }, + { + "name": "Minnesota", + "abbreviation": "MN" + }, + { + "name": "Mississippi", + "abbreviation": "MS" + }, + { + "name": "Missouri", + "abbreviation": "MO" + }, + { + "name": "Montana", + "abbreviation": "MT" + }, + { + "name": "Nebraska", + "abbreviation": "NE" + }, + { + "name": "Nevada", + "abbreviation": "NV" + }, + { + "name": "New Hampshire", + "abbreviation": "NH" + }, + { + "name": "New Jersey", + "abbreviation": "NJ" + }, + { + "name": "New Mexico", + "abbreviation": "NM" + }, + { + "name": "New York", + "abbreviation": "NY" + }, + { + "name": "North Carolina", + "abbreviation": "NC" + }, + { + "name": "North Dakota", + "abbreviation": "ND" + }, + { + "name": "Northern Mariana Islands", + "abbreviation": "MP" + }, + { + "name": "Ohio", + "abbreviation": "OH" + }, + { + "name": "Oklahoma", + "abbreviation": "OK" + }, + { + "name": "Oregon", + "abbreviation": "OR" + }, + { + "name": "Palau", + "abbreviation": "PW" + }, + { + "name": "Pennsylvania", + "abbreviation": "PA" + }, + { + "name": "Puerto Rico", + "abbreviation": "PR" + }, + { + "name": "Rhode Island", + "abbreviation": "RI" + }, + { + "name": "South Carolina", + "abbreviation": "SC" + }, + { + "name": "South Dakota", + "abbreviation": "SD" + }, + { + "name": "Tennessee", + "abbreviation": "TN" + }, + { + "name": "Texas", + "abbreviation": "TX" + }, + { + "name": "Utah", + "abbreviation": "UT" + }, + { + "name": "Vermont", + "abbreviation": "VT" + }, + { + "name": "Virgin Islands", + "abbreviation": "VI" + }, + { + "name": "Virginia", + "abbreviation": "VA" + }, + { + "name": "Washington", + "abbreviation": "WA" + }, + { + "name": "West Virginia", + "abbreviation": "WV" + }, + { + "name": "Wisconsin", + "abbreviation": "WI" + }, + { + "name": "Wyoming", + "abbreviation": "WY" + } +] \ No newline at end of file diff --git a/resources/views/merchbay/cart.blade.php b/resources/views/merchbay/cart.blade.php index 2bb9ad4..bee35ab 100755 --- a/resources/views/merchbay/cart.blade.php +++ b/resources/views/merchbay/cart.blade.php @@ -1,347 +1,422 @@ @extends('merchbay_main') @section('main-content') - + .cart-store-logo { + border: 1px solid #e2e2e2; + } -
-
-
+ - {{-- breadcrumbs --}} -
-
-
- +
+
+
+ + {{-- breadcrumbs --}} +
+
+
+ +
+
-
-
-
-
-

Shopping Cart

- @if(Session::has('cartkeyError')) - {{--
+
+
+

Shopping Cart

+ @if (Session::has('cartkeyError')) + {{--

Error:

{!! Session::get('cartkeyError') !!}
--}} - - @endif + + @endif +
+ + @if (count($row) > 0) +
+
+
+
+ {{ $store_array[0]->StoreName }}
+
+ @foreach ($item_group as $item) + @if ($item->VoucherId == null) +
+
+
+
+ @foreach ($img_thumb as $img) + @if ($img->ProductId == $item->ProductId) + + @endif + @endforeach +
+
+
+

+ {{ $item->ProductName }} +

+

Total Price: + {{ $item->total_price . ' ' . $store_array[0]->StoreCurrency }} + • Row(s): {{ $item->qty }}

+
+ + + @if ($item->FormUsed == 'jersey-and-shorts-form') + + + + + + + + + + @elseif($item->FormUsed=="tshirt-form") + + + + + + + + @elseif($item->FormUsed=="quantity-form") + + + + + + + + @elseif($item->FormUsed=="name-number-form") + + + + + + + + + @elseif($item->FormUsed=="name-number-size-form") + + + + + + + + + + @elseif($item->FormUsed=="number-form") + + + + + + + @elseif($item->FormUsed=="name-name2-size-form") + + + + + + + + + @elseif($item->FormUsed=="name-size-form") + + + + + + + + @elseif($item->FormUsed=="jersey-and-shorts-quantity-form") + + + + + + + + @elseif($item->FormUsed=="number-jersey-shorts-form") + + + + + + + + + @else + + @endif + + @foreach ($row as $sub_item) + @if ($sub_item->ProductId == $item->ProductId) + + @if ($item->FormUsed == 'jersey-and-shorts-form') + + + + + + + + + + @elseif($item->FormUsed=="tshirt-form") + + + + + + + @elseif($item->FormUsed=="quantity-form") + + + + + + @elseif($item->FormUsed=="name-number-form") + + + + + + + + @elseif($item->FormUsed=="name-number-size-form") + + + + + + + + + @elseif($item->FormUsed=="number-form") + + + + + + + @elseif($item->FormUsed=="name-name2-size-form") + + + + + + + + + @elseif($item->FormUsed=="name-size-form") + + + + + + + + @elseif($item->FormUsed=="jersey-and-shorts-quantity-form") + + + + + + + + @elseif($item->FormUsed=="number-jersey-shorts-form") + + + + + + + + + @else + + @endif + + @endif + @endforeach +
NameNumberJersey SizeShorts SizePriceQuantity
SizePriceQuantity
PriceQuantity
NameNumberPriceQuantity
NameNumberSizePriceQuantity
NumberPriceQuantity
Gamer TagNameSizePriceQuantity
NameSizePriceQuantity
Jersey SizeShorts SizePriceQuantity
NumberJersey SizeShorts SizePriceQuantity
@if ($sub_item->Name != '') {{ $sub_item->Name }} @else -- @endif {{ $sub_item->Number }}{{ $sub_item->JerseySize }}{{ $sub_item->ShortsSize }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->Size }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->Name }}{{ $sub_item->Number }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->Name }}{{ $sub_item->Number }}{{ $sub_item->Size }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->Number }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->Name }}{{ $sub_item->Name2 }}{{ $sub_item->Size }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->Name }}{{ $sub_item->Size }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->JerseySize }}{{ $sub_item->ShortsSize }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->Number }}{{ $sub_item->JerseySize }}{{ $sub_item->ShortsSize }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
+
+
+
+
+ @endif + @endforeach +
+ +
+
+ @if (Session::has('msg')) +
+ +

Warning:

+ {!! Session::get('msg') !!} +
+ @endif +

Order Summary

+
+ +
+

Ship to:

+ @if ($address_book === null) + [ Add ] + @else +
{{ $address_book[0]->Fullname }}
+
{{ $address_book[0]->ContactNumber }}
+
+ {{ $address_book[0]->Address . ', ' . $address_book[0]->State . ', ' . $address_book[0]->City . ', ' . $address_book[0]->Country . ', ' . $address_book[0]->CountryCode . ' ' . $address_book[0]->ZipCode }} + [ Edit ]
+ @endif + +
+ +
+
Subtotal: {{ number_format($tax['order_grandtotal'] , 2) . ' ' . $store_array[0]->StoreCurrency }}
+
Shipping Fee: {{ number_format($shipping_fee , 2) . ' ' . $store_array[0]->StoreCurrency }}
+
Tax: {{ number_format($tax['tax'] , 2) . ' ' . $store_array[0]->StoreCurrency }}
+
+

Total: {{ number_format($tax['order_grandtotal'] + $shipping_fee + $tax['tax'], 2) }} + {{ $store_array[0]->StoreCurrency }}

+ + {{-- {{ var_dump($tax) }} + {{ var_dump($shipping_fee) }} --}} +
+
+ @foreach ($row as $item) + @if ($item->VoucherId != null) +
+ @if ($item->VoucherType == 'Percentage') + + @else + + @endif + +
+ @endif + @endforeach + +
+
+
+ + + + +
+ +
+
+
+ +
+
+ +
+ Be advised payments made on merchbay will show up as crewsportswear on your receipt +
+
+ + + +
+ +
+ @else +
+
+

Your cart is currently empty.

+
+
+ @endif +
- - @if(count($row) > 0) -
-
-
-
{{ $store_array[0]->StoreName }}
-
- @foreach($item_group as $item) - @if($item->VoucherId == null) -
-
-
-
- @foreach($img_thumb as $img) - @if($img->ProductId == $item->ProductId) - - @endif - @endforeach -
-
-
-

- {{ $item->ProductName }} -

-

Total Price: {{ $item->total_price . ' ' . $store_array[0]->StoreCurrency }} • Row(s): {{ $item->qty }}

-
- - - @if($item->FormUsed=="jersey-and-shorts-form") - - - - - - - - - - @elseif($item->FormUsed=="tshirt-form") - - - - - - - - @elseif($item->FormUsed=="quantity-form") - - - - - - - - @elseif($item->FormUsed=="name-number-form") - - - - - - - - - @elseif($item->FormUsed=="name-number-size-form") - - - - - - - - - - @elseif($item->FormUsed=="number-form") - - - - - - - @elseif($item->FormUsed=="name-name2-size-form") - - - - - - - - - @elseif($item->FormUsed=="name-size-form") - - - - - - - - @elseif($item->FormUsed=="jersey-and-shorts-quantity-form") - - - - - - - - @elseif($item->FormUsed=="number-jersey-shorts-form") - - - - - - - - - @else - - @endif - - @foreach($row as $sub_item) - @if($sub_item->ProductId == $item->ProductId) - - @if($item->FormUsed=="jersey-and-shorts-form") - - - - - - - - - - @elseif($item->FormUsed=="tshirt-form") - - - - - - - @elseif($item->FormUsed=="quantity-form") - - - - - - @elseif($item->FormUsed=="name-number-form") - - - - - - - - @elseif($item->FormUsed=="name-number-size-form") - - - - - - - - - @elseif($item->FormUsed=="number-form") - - - - - - - @elseif($item->FormUsed=="name-name2-size-form") - - - - - - - - - @elseif($item->FormUsed=="name-size-form") - - - - - - - - @elseif($item->FormUsed=="jersey-and-shorts-quantity-form") - - - - - - - - @elseif($item->FormUsed=="number-jersey-shorts-form") - - - - - - - - - @else - - @endif - - @endif - @endforeach -
NameNumberJersey SizeShorts SizePriceQuantity
SizePriceQuantity
PriceQuantity
NameNumberPriceQuantity
NameNumberSizePriceQuantity
NumberPriceQuantity
Gamer TagNameSizePriceQuantity
NameSizePriceQuantity
Jersey SizeShorts SizePriceQuantity
NumberJersey SizeShorts SizePriceQuantity
@if($sub_item->Name != '') {{ $sub_item->Name }} @else -- @endif {{ $sub_item->Number }}{{ $sub_item->JerseySize }}{{ $sub_item->ShortsSize }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}{{ $sub_item->Quantity }}
{{ $sub_item->Size }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}{{ $sub_item->Quantity }}
{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}{{ $sub_item->Quantity }}
{{ $sub_item->Name }}{{ $sub_item->Number }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}{{ $sub_item->Quantity }}
{{ $sub_item->Name }}{{ $sub_item->Number }}{{ $sub_item->Size }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}{{ $sub_item->Quantity }}
{{ $sub_item->Number }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}{{ $sub_item->Quantity }}
{{ $sub_item->Name }}{{ $sub_item->Name2 }}{{ $sub_item->Size }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}{{ $sub_item->Quantity }}
{{ $sub_item->Name }}{{ $sub_item->Size }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}{{ $sub_item->Quantity }}
{{ $sub_item->JerseySize}}{{ $sub_item->ShortsSize}}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}{{ $sub_item->Quantity }}
{{ $sub_item->Number }}{{ $sub_item->JerseySize }}{{ $sub_item->ShortsSize }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }}{{ $sub_item->Quantity }}
-
-
-
-
- @endif - @endforeach -
- -
-
- @if(Session::has('msg')) -
- -

Warning:

- {!! Session::get('msg') !!} -
- @endif -

Order Summary

-
- -
-

Subtotal: {{ round($getSubtotal, 2) }} {{ $store_array[0]->StoreCurrency }}

-
-
- @foreach($row as $item) - @if($item->VoucherId != null) -
- @if($item->VoucherType == "Percentage") - - @else - - @endif - -
- @endif - @endforeach - -
-
-
- - - - -
- -
-
-
- -
-
- -
- Be advised payments made on merchbay will show up as crewsportswear on your receipt -
-
- - - -
- -
- @else -
-
-

Your cart is currently empty.

-
-
- @endif -
-
@endsection diff --git a/resources/views/merchbay/index.blade.php b/resources/views/merchbay/index.blade.php index 73fc63a..ed012e5 100755 --- a/resources/views/merchbay/index.blade.php +++ b/resources/views/merchbay/index.blade.php @@ -33,12 +33,12 @@ -
- - + +
@@ -61,6 +65,10 @@
+
+ + +
diff --git a/resources/views/user-layouts/store_setting.blade.php b/resources/views/user-layouts/store_setting.blade.php index 0024dff..5ce5232 100755 --- a/resources/views/user-layouts/store_setting.blade.php +++ b/resources/views/user-layouts/store_setting.blade.php @@ -34,7 +34,7 @@
- +
diff --git a/resources/views/user-layouts/user_template.blade.php b/resources/views/user-layouts/user_template.blade.php index bf5d3e5..d83046d 100755 --- a/resources/views/user-layouts/user_template.blade.php +++ b/resources/views/user-layouts/user_template.blade.php @@ -1,112 +1,132 @@ - - - - Merchbay | Dashboard - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + - - - + - + function gtag() { + dataLayer.push(arguments); + } + gtag('js', new Date()); - -
+ gtag('config', 'UA-136108155-1'); + + - - @include('user-layouts.header') + +
- - @include('user-layouts.sidebar') - - - @yield('content') + + @include('user-layouts.header') - - @include('user-layouts.footer') -
- + + @include('user-layouts.sidebar') - - - - + + @yield('content') - - - - - - - - - - - - - - + @include('user-layouts.footer') +
+ + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - {{-- Chartjs --}} - + + + + + + + + + + + + + + + + + + + + + + + + + {{-- Chartjs --}} + - - - - + } + + + + + \ No newline at end of file