Inheritance: extends Mage2\Framework\System\Models\BaseModel
 /**
  * Show the form for creating a new user addresses.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $user = Auth::user();
     $countries = Country::all();
     $defaultCountry = Configuration::getConfiguration('mage2_address_default_country');
     return view('address.my-account.create-address')->with('user', $user)->with('countries', $countries)->with('defaultCountry', $defaultCountry);
 }
Example #2
0
 public function getTaxAmount()
 {
     $taxPercentage = Configuration::getConfiguration('mage2_tax_class_percentage_of_tax');
     $price = $this->price;
     $taxAmount = $taxPercentage * $price / 100;
     return $taxAmount;
 }
 public function view($slug)
 {
     $productsOnCategoryPage = Configuration::getConfiguration('mage2_catalog_no_of_product_category_page');
     $category = Category::where('slug', '=', $slug)->get()->first();
     $products = $category->products()->paginate($productsOnCategoryPage);
     return view('catalog.category.view')->with('category', $category)->with('products', $products);
 }
Example #4
0
 public function getCountryIdAttribute()
 {
     if (isset($this->attributes['country_id']) && $this->attributes['country_id'] > 0) {
         return $this->attributes['country_id'];
     }
     $defaultCountry = Configuration::getConfiguration('mage2_address_default_country');
     if (isset($defaultCountry)) {
         return $defaultCountry;
     }
     return "";
 }
 /**
  * @param \Illuminate\Http\UploadedFile $file
  */
 public function activate($name)
 {
     $theme = Theme::get($name);
     try {
         Configuration::create(['website_id' => $this->defaultWebsiteId, 'configuration_key' => 'active_theme_identifier', 'configuration_value' => $name]);
         Configuration::create(['website_id' => $this->defaultWebsiteId, 'configuration_key' => 'active_theme_path', 'configuration_value' => $theme['path']]);
         Artisan::call('vendor:publish', ['--tag' => $name]);
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
     return redirect()->route('admin.theme.index');
 }
 public function adminPost(AdminUserRequest $request)
 {
     $role = Role::create(['name' => 'administraotr', 'description' => 'Administrator Role has all access']);
     AdminUser::create(['first_name' => $request->get('first_name'), 'last_name' => $request->get('last_name'), 'email' => $request->get('email'), 'password' => bcrypt($request->get('password')), 'is_super_admin' => 1, 'role_id' => $role->id]);
     $host = str_replace('http://', '', $request->getUriForPath(''));
     $host = str_replace('https://', '', $host);
     $website = Website::create(['host' => $host, 'name' => 'Defaul Website', 'is_default' => 1]);
     Configuration::create(['configuration_key' => 'active_theme_identifier', 'configuration_value' => 'mage2-basic', 'website_id' => $website->id]);
     Configuration::create(['configuration_key' => 'active_theme_path', 'configuration_value' => base_path('themes\\mage2\\basic'), 'website_id' => $website->id]);
     Configuration::create(['configuration_key' => 'mage2_catalog_no_of_product_category_page', 'configuration_value' => 9, 'website_id' => $website->id]);
     Configuration::create(['configuration_key' => 'mage2_catalog_cart_page_display_taxamount', 'configuration_value' => 'yes', 'website_id' => $website->id]);
     Configuration::create(['configuration_key' => 'mage2_tax_class_percentage_of_tax', 'configuration_value' => 15, 'website_id' => $website->id]);
     return redirect()->route('mage2.install.success');
 }
 /**
  * Show the application dashboard.
  *
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     foreach ($request->except(['_token', '_method']) as $key => $value) {
         $configuration = Configuration::where('configuration_key', '=', $key)->get()->first();
         if (null === $configuration) {
             $data['configuration_key'] = $key;
             $data['configuration_value'] = $value;
             $data['website_id'] = $this->websiteId;
             Configuration::create($data);
         } else {
             $configuration->update(['configuration_value' => $value]);
         }
     }
     return redirect()->back()->with('notificationText', 'All Configuration saved.');
 }
Example #8
0
 public function setApiContext($clientId = null, $clientSecret = null, $requestId = null)
 {
     if (null === $clientId) {
         //$clientId  = config('paypal.api-client-d');
         $clientId = Configuration::getConfiguration('paypal_client_id');
     }
     if (null === $clientSecret) {
         //$clientSecret = config('paypal.api-client-secret');
         $clientSecret = Configuration::getConfiguration('paypal_client_secret');
     }
     $credentials = new OAuthTokenCredential($clientId, $clientSecret);
     $this->_apiContext = new ApiContext($credentials, $requestId);
     return $this;
 }
Example #9
0
 private function setupAdminUserAndWebsite()
 {
     $role = Role::create(['name' => 'Administrator', 'description' => 'administrator role']);
     AdminUser::create(['first_name' => 'test User', 'last_name' => 'test User', 'email' => '*****@*****.**', 'password' => bcrypt('admin123'), 'is_super_admin' => 1, 'role_id' => $role->id]);
     $host = str_replace('http://', '', $this->baseUrl);
     $host = str_replace('https://', '', $host);
     $website = Website::create(['host' => $host, 'name' => 'Defaul Website', 'is_default' => 1]);
     Configuration::create(['configuration_key' => 'active_theme_path', 'configuration_value' => base_path('themes/mage2/default'), 'website_id' => $website->id]);
     Configuration::create(['configuration_key' => 'active_theme_name', 'configuration_value' => 'mage2-default', 'website_id' => $website->id]);
 }
 /**
  * Display a listing of the Catalog Configuration.
  *
  * @return \Illuminate\Http\Response
  */
 public function getConfiguration()
 {
     $configurations = Configuration::all()->pluck('configuration_value', 'configuration_key');
     return view('admin.paypal.configuration.index')->with('configurations', $configurations);
 }
 /**
  * Display a listing of the Catalog Configuration.
  *
  * @return \Illuminate\Http\Response
  */
 public function getConfiguration()
 {
     $countries = $this->addressHelper->getCountriesOptions();
     $configurations = Configuration::all()->pluck('configuration_value', 'configuration_key');
     return view('admin.address.configuration.index')->with('configurations', $configurations)->with('countries', $countries);
 }