Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Why is creating custom theme such a headache?

    General Discussion
    2
    3
    404
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      courage last edited by courage

      so far, so good i have followed all the steps to create a custom theme but one would expect that after such reading and trial at least i should have a result at the very least... That's the case with me right now.

      I have tried to use the api as well but the customer register - Login route was was not found as it constantly returned 404

      HERE IS WHAT I HAVE DONE

      • defined the setting in themes.php link so:
      'Malls' => [
                  'views_path' => 'resources/themes/malls/views',
                  'assets_path' => 'public/themes/malls/assets',
                  'name' => 'Malls',
                  'parent' => 'default'
              ],
      
      • carefully defined my path using velocity theme as a prototype
      • created my master layout
      • created an index file in home directory
        Screen shot
        alt text

      when i load this in browser am displayed with some BLISS interface which is totally different from what i have done.

      I have set the package channel to malls as well but still the same.
      the question is, do i have to define my own routes and if i must, how to i override the package route. been on this for a while but the theme won't work and <host>/api has some misplaced routes like register, login and some others i have not discovered

      1 Reply Last reply Reply Quote 0
      • ghermans
        ghermans last edited by

        Hi, sorry that creating a custom theme is giving you a headache, to release you from this pain, you could check https://devdocs.bagisto.com/1.x/themes/create_theme.html as we explain on this page step by step how you can create your own custom theme.

        Kind regards,
        Glenn Hermans

        Manager Bagisto Europe
        info@bagisto.eu

        1 Reply Last reply Reply Quote 1
        • ghermans
          ghermans last edited by ghermans

          Indeed you need to overwrite the routes.
          To do this add the following to your theme package ServiceProvider:

          public function boot()
              {
                  $this->loadRoutesFrom(__DIR__ . '/../Http/shop-routes.php');
                  $this->loadViewsFrom(__DIR__ . '/../Resources/views', 'yourpackage');
              }
          

          in your package create a new folder names Http and create a new file inside this folder named shop-routes.php, once that is done add the following routes

          <?php
          
          Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function () {
              //Store front home
              Route::get('/', 'Webkul\Shop\Http\Controllers\HomeController@index')->defaults('_config', [
                  'view' => 'shop::home.index'
              ])->name('shop.home.index');
          
              //subscription
              //subscribe
              Route::get('/subscribe', 'Webkul\Shop\Http\Controllers\SubscriptionController@subscribe')->name('shop.subscribe');
          
              //unsubscribe
              Route::get('/unsubscribe/{token}', 'Webkul\Shop\Http\Controllers\SubscriptionController@unsubscribe')->name('shop.unsubscribe');
          
              //Store front search
              Route::get('/search', 'Webkul\Shop\Http\Controllers\SearchController@index')->defaults('_config', [
                  'view' => 'shop::search.search'
              ])->name('shop.search.index');
          
              //Upload image for search product
              Route::post('/upload-search-image', 'Webkul\Shop\Http\Controllers\HomeController@upload')->name('shop.image.search.upload');
          
              //Country State Selector
              Route::get('get/countries', 'Webkul\Core\Http\Controllers\CountryStateController@getCountries')->defaults('_config', [
                  'view' => 'shop::test'
              ])->name('get.countries');
          
              //Get States When Country is Passed
              Route::get('get/states/{country}', 'Webkul\Core\Http\Controllers\CountryStateController@getStates')->defaults('_config', [
                  'view' => 'shop::test'
              ])->name('get.states');
          
              //checkout and cart
              //Cart Items(listing)
              Route::get('checkout/cart', 'Webkul\Shop\Http\Controllers\CartController@index')->defaults('_config', [
                  'view' => 'shop::checkout.cart.index'
              ])->name('shop.checkout.cart.index');
          
              Route::post('checkout/cart/coupon', 'Webkul\Shop\Http\Controllers\CartController@applyCoupon')->name('shop.checkout.cart.coupon.apply');
          
              Route::delete('checkout/cart/coupon', 'Webkul\Shop\Http\Controllers\CartController@removeCoupon')->name('shop.checkout.coupon.remove.coupon');
          
              //Cart Items Add
              Route::post('checkout/cart/add/{id}', 'Webkul\Shop\Http\Controllers\CartController@add')->defaults('_config', [
                  'redirect' => 'shop.checkout.cart.index'
              ])->name('cart.add');
          
              //Cart Items Remove
              Route::get('checkout/cart/remove/{id}', 'Webkul\Shop\Http\Controllers\CartController@remove')->name('cart.remove');
          
              //Cart Update Before Checkout
              Route::post('/checkout/cart', 'Webkul\Shop\Http\Controllers\CartController@updateBeforeCheckout')->defaults('_config', [
                  'redirect' => 'shop.checkout.cart.index'
              ])->name('shop.checkout.cart.update');
          
              //Cart Items Remove
              Route::get('/checkout/cart/remove/{id}', 'Webkul\Shop\Http\Controllers\CartController@remove')->defaults('_config', [
                  'redirect' => 'shop.checkout.cart.index'
              ])->name('shop.checkout.cart.remove');
          
              //Checkout Index page
              Route::get('/checkout/onepage', 'Webkul\Shop\Http\Controllers\OnepageController@index')->defaults('_config', [
                  'view' => 'shop::checkout.onepage'
              ])->name('shop.checkout.onepage.index');
          
              //Checkout Save Order
              Route::get('/checkout/summary', 'Webkul\Shop\Http\Controllers\OnepageController@summary')->name('shop.checkout.summary');
          
              //Checkout Save Address Form Store
              Route::post('/checkout/save-address', 'Webkul\Shop\Http\Controllers\OnepageController@saveAddress')->name('shop.checkout.save-address');
          
              //Checkout Save Shipping Address Form Store
              Route::post('/checkout/save-shipping', 'Webkul\Shop\Http\Controllers\OnepageController@saveShipping')->name('shop.checkout.save-shipping');
          
              //Checkout Save Payment Method Form
              Route::post('/checkout/save-payment', 'Webkul\Shop\Http\Controllers\OnepageController@savePayment')->name('shop.checkout.save-payment');
          
              //Checkout Save Order
              Route::post('/checkout/save-order', 'Webkul\Shop\Http\Controllers\OnepageController@saveOrder')->name('shop.checkout.save-order');
          
              //Checkout Order Successfull
              Route::get('/checkout/success', 'Webkul\Shop\Http\Controllers\OnepageController@success')->defaults('_config', [
                  'view' => 'shop::checkout.success'
              ])->name('shop.checkout.success');
          
              //Shop buynow button action
              Route::get('move/wishlist/{id}', 'Webkul\Shop\Http\Controllers\CartController@moveToWishlist')->name('shop.movetowishlist');
          
              Route::get('/downloadable/download-sample/{type}/{id}', 'Webkul\Shop\Http\Controllers\ProductController@downloadSample')->name('shop.downloadable.download_sample');
          
              // Show Product Review Form
              Route::get('/reviews/{slug}', 'Webkul\Shop\Http\Controllers\ReviewController@show')->defaults('_config', [
                  'view' => 'shop::products.reviews.index'
              ])->name('shop.reviews.index');
          
              // Show Product Review(listing)
              Route::get('/product/{slug}/review', 'Webkul\Shop\Http\Controllers\ReviewController@create')->defaults('_config', [
                  'view' => 'shop::products.reviews.create'
              ])->name('shop.reviews.create');
          
              // Show Product Review Form Store
              Route::post('/product/{slug}/review', 'Webkul\Shop\Http\Controllers\ReviewController@store')->defaults('_config', [
                  'redirect' => 'shop.home.index'
              ])->name('shop.reviews.store');
          
               // Download file or image
              Route::get('/product/{id}/{attribute_id}', 'Webkul\Shop\Http\Controllers\ProductController@download')->defaults('_config', [
                  'view' => 'shop.products.index'
              ])->name('shop.product.file.download');
          
              //customer routes starts here
              Route::prefix('customer')->group(function () {
                  // forgot Password Routes
                  // Forgot Password Form Show
                  Route::get('/forgot-password', 'Webkul\Customer\Http\Controllers\ForgotPasswordController@create')->defaults('_config', [
                      'view' => 'shop::customers.signup.forgot-password'
                  ])->name('customer.forgot-password.create');
          
                  // Forgot Password Form Store
                  Route::post('/forgot-password', 'Webkul\Customer\Http\Controllers\ForgotPasswordController@store')->name('customer.forgot-password.store');
          
                  // Reset Password Form Show
                  Route::get('/reset-password/{token}', 'Webkul\Customer\Http\Controllers\ResetPasswordController@create')->defaults('_config', [
                      'view' => 'shop::customers.signup.reset-password'
                  ])->name('customer.reset-password.create');
          
                  // Reset Password Form Store
                  Route::post('/reset-password', 'Webkul\Customer\Http\Controllers\ResetPasswordController@store')->defaults('_config', [
                      'redirect' => 'customer.profile.index'
                  ])->name('customer.reset-password.store');
          
                  // Login Routes
                  // Login form show
                  Route::get('login', 'Webkul\Customer\Http\Controllers\SessionController@show')->defaults('_config', [
                      'view' => 'shop::customers.session.index',
                  ])->name('customer.session.index');
          
                  // Login form store
                  Route::post('login', 'Webkul\Customer\Http\Controllers\SessionController@create')->defaults('_config', [
                      'redirect' => 'customer.profile.index'
                  ])->name('customer.session.create');
          
                  // Registration Routes
                  //registration form show
                  Route::get('register', 'Webkul\Customer\Http\Controllers\RegistrationController@show')->defaults('_config', [
                      'view' => 'shop::customers.signup.index'
                  ])->name('customer.register.index');
          
                  //registration form store
                  Route::post('register', 'Webkul\Customer\Http\Controllers\RegistrationController@create')->defaults('_config', [
                      'redirect' => 'customer.session.index',
                  ])->name('customer.register.create');
          
                  //verify account
                  Route::get('/verify-account/{token}', 'Webkul\Customer\Http\Controllers\RegistrationController@verifyAccount')->name('customer.verify');
          
                  //resend verification email
                  Route::get('/resend/verification/{email}', 'Webkul\Customer\Http\Controllers\RegistrationController@resendVerificationEmail')->name('customer.resend.verification-email');
          
                  // for customer login checkout
                  Route::post('/customer/exist', 'Webkul\Shop\Http\Controllers\OnepageController@checkExistCustomer')->name('customer.checkout.exist');
          
                  // for customer login checkout
                  Route::post('/customer/checkout/login', 'Webkul\Shop\Http\Controllers\OnepageController@loginForCheckout')->name('customer.checkout.login');
          
                  // Auth Routes
                  Route::group(['middleware' => ['customer']], function () {
          
                      //Customer logout
                      Route::get('logout', 'Webkul\Customer\Http\Controllers\SessionController@destroy')->defaults('_config', [
                          'redirect' => 'customer.session.index'
                      ])->name('customer.session.destroy');
          
                      //Customer Wishlist add
                      Route::get('wishlist/add/{id}', 'Webkul\Customer\Http\Controllers\WishlistController@add')->name('customer.wishlist.add');
          
                      //Customer Wishlist remove
                      Route::get('wishlist/remove/{id}', 'Webkul\Customer\Http\Controllers\WishlistController@remove')->name('customer.wishlist.remove');
          
                      //Customer Wishlist remove
                      Route::get('wishlist/removeall', 'Webkul\Customer\Http\Controllers\WishlistController@removeAll')->name('customer.wishlist.removeall');
          
                      //Customer Wishlist move to cart
                      Route::get('wishlist/move/{id}', 'Webkul\Customer\Http\Controllers\WishlistController@move')->name('customer.wishlist.move');
          
                      //customer account
                      Route::prefix('account')->group(function () {
                          //Customer Dashboard Route
                          Route::get('index', 'Webkul\Customer\Http\Controllers\AccountController@index')->defaults('_config', [
                              'view' => 'shop::customers.account.index'
                          ])->name('customer.account.index');
          
                          //Customer Profile Show
                          Route::get('profile', 'Webkul\Customer\Http\Controllers\CustomerController@index')->defaults('_config', [
                              'view' => 'shop::customers.account.profile.index'
                          ])->name('customer.profile.index');
          
                          //Customer Profile Edit Form Show
                          Route::get('profile/edit', 'Webkul\Customer\Http\Controllers\CustomerController@edit')->defaults('_config', [
                              'view' => 'shop::customers.account.profile.edit'
                          ])->name('customer.profile.edit');
          
                          //Customer Profile Edit Form Store
                          Route::post('profile/edit', 'Webkul\Customer\Http\Controllers\CustomerController@update')->defaults('_config', [
                              'redirect' => 'customer.profile.index'
                          ])->name('customer.profile.store');
          
                          //Customer Profile Delete Form Store
                          Route::post('profile/destroy', 'Webkul\Customer\Http\Controllers\CustomerController@destroy')->defaults('_config', [
                              'redirect' => 'customer.profile.index'
                          ])->name('customer.profile.destroy');
          
                          /*  Profile Routes Ends Here  */
          
                          /*    Routes for Addresses   */
                          //Customer Address Show
                          Route::get('addresses', 'Webkul\Customer\Http\Controllers\AddressController@index')->defaults('_config', [
                              'view' => 'shop::customers.account.address.index'
                          ])->name('customer.address.index');
          
                          //Customer Address Create Form Show
                          Route::get('addresses/create', 'Webkul\Customer\Http\Controllers\AddressController@create')->defaults('_config', [
                              'view' => 'shop::customers.account.address.create'
                          ])->name('customer.address.create');
          
                          //Customer Address Create Form Store
                          Route::post('addresses/create', 'Webkul\Customer\Http\Controllers\AddressController@store')->defaults('_config', [
                              'view' => 'shop::customers.account.address.address',
                              'redirect' => 'customer.address.index'
                          ])->name('customer.address.store');
          
                          //Customer Address Edit Form Show
                          Route::get('addresses/edit/{id}', 'Webkul\Customer\Http\Controllers\AddressController@edit')->defaults('_config', [
                              'view' => 'shop::customers.account.address.edit'
                          ])->name('customer.address.edit');
          
                          //Customer Address Edit Form Store
                          Route::put('addresses/edit/{id}', 'Webkul\Customer\Http\Controllers\AddressController@update')->defaults('_config', [
                              'redirect' => 'customer.address.index'
                          ])->name('customer.address.update');
          
                          //Customer Address Make Default
                          Route::get('addresses/default/{id}', 'Webkul\Customer\Http\Controllers\AddressController@makeDefault')->name('make.default.address');
          
                          //Customer Address Delete
                          Route::get('addresses/delete/{id}', 'Webkul\Customer\Http\Controllers\AddressController@destroy')->name('address.delete');
          
                          /* Wishlist route */
                          //Customer wishlist(listing)
                          Route::get('wishlist', 'Webkul\Customer\Http\Controllers\WishlistController@index')->defaults('_config', [
                              'view' => 'shop::customers.account.wishlist.wishlist'
                          ])->name('customer.wishlist.index');
          
                          /* Orders route */
                          //Customer orders(listing)
                          Route::get('orders', 'Webkul\Shop\Http\Controllers\OrderController@index')->defaults('_config', [
                              'view' => 'shop::customers.account.orders.index'
                          ])->name('customer.orders.index');
          
                          //Customer downloadable products(listing)
                          Route::get('downloadable-products', 'Webkul\Shop\Http\Controllers\DownloadableProductController@index')->defaults('_config', [
                              'view' => 'shop::customers.account.downloadable_products.index'
                          ])->name('customer.downloadable_products.index');
          
                          //Customer downloadable products(listing)
                          Route::get('downloadable-products/download/{id}', 'Webkul\Shop\Http\Controllers\DownloadableProductController@download')->defaults('_config', [
                              'view' => 'shop::customers.account.downloadable_products.index'
                          ])->name('customer.downloadable_products.download');
          
                          //Customer orders view summary and status
                          Route::get('orders/view/{id}', 'Webkul\Shop\Http\Controllers\OrderController@view')->defaults('_config', [
                              'view' => 'shop::customers.account.orders.view'
                          ])->name('customer.orders.view');
          
                          //Prints invoice
                          Route::get('orders/print/{id}', 'Webkul\Shop\Http\Controllers\OrderController@print')->defaults('_config', [
                              'view' => 'shop::customers.account.orders.print'
                          ])->name('customer.orders.print');
          
                          Route::get('/orders/cancel/{id}', 'Webkul\Shop\Http\Controllers\OrderController@cancel')->name('customer.orders.cancel');
          
                          /* Reviews route */
                          //Customer reviews
                          Route::get('reviews', 'Webkul\Customer\Http\Controllers\CustomerController@reviews')->defaults('_config', [
                              'view' => 'shop::customers.account.reviews.index'
                          ])->name('customer.reviews.index');
          
                          //Customer review delete
                          Route::get('reviews/delete/{id}', 'Webkul\Shop\Http\Controllers\ReviewController@destroy')->defaults('_config', [
                              'redirect' => 'customer.reviews.index'
                          ])->name('customer.review.delete');
          
                          //Customer all review delete
                          Route::get('reviews/all-delete', 'Webkul\Shop\Http\Controllers\ReviewController@deleteAll')->defaults('_config', [
                              'redirect' => 'customer.reviews.index'
                          ])->name('customer.review.deleteall');
                      });
                  });
              });
              //customer routes end here
          
              Route::get('page/{slug}', 'Webkul\CMS\Http\Controllers\Shop\PagePresenterController@presenter')->name('shop.cms.page');
          
              Route::fallback(\Webkul\Shop\Http\Controllers\ProductsCategoriesProxyController::class . '@index')
                  ->defaults('_config', [
                      'product_view' => 'shop::products.view',
                      'category_view' => 'shop::products.index'
                  ])
                  ->name('shop.productOrCategory.index');
          });
          

          As you probably noticed in the routes above you can change the view path to your package views.

          After making the above changes run the following command:

          php artisan route:cache
          

          Kind regards,
          Glenn Hermans

          Manager Bagisto Europe
          info@bagisto.eu

          1 Reply Last reply Reply Quote 0
          • First post
            Last post