Recent Topics

Why is creating custom theme such a headache?



  • 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



  • 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.



  • 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\[email protected]')->defaults('_config', [
            'view' => 'shop::home.index'
        ])->name('shop.home.index');
    
        //subscription
        //subscribe
        Route::get('/subscribe', 'Webkul\Shop\Http\Controllers\[email protected]')->name('shop.subscribe');
    
        //unsubscribe
        Route::get('/unsubscribe/{token}', 'Webkul\Shop\Http\Controllers\[email protected]')->name('shop.unsubscribe');
    
        //Store front search
        Route::get('/search', 'Webkul\Shop\Http\Controllers\[email protected]')->defaults('_config', [
            'view' => 'shop::search.search'
        ])->name('shop.search.index');
    
        //Upload image for search product
        Route::post('/upload-search-image', 'Webkul\Shop\Http\Controllers\[email protected]')->name('shop.image.search.upload');
    
        //Country State Selector
        Route::get('get/countries', 'Webkul\Core\Http\Controllers\[email protected]')->defaults('_config', [
            'view' => 'shop::test'
        ])->name('get.countries');
    
        //Get States When Country is Passed
        Route::get('get/states/{country}', 'Webkul\Core\Http\Controllers\[email protected]')->defaults('_config', [
            'view' => 'shop::test'
        ])->name('get.states');
    
        //checkout and cart
        //Cart Items(listing)
        Route::get('checkout/cart', 'Webkul\Shop\Http\Controllers\[email protected]')->defaults('_config', [
            'view' => 'shop::checkout.cart.index'
        ])->name('shop.checkout.cart.index');
    
        Route::post('checkout/cart/coupon', 'Webkul\Shop\Http\Controllers\[email protected]')->name('shop.checkout.cart.coupon.apply');
    
        Route::delete('checkout/cart/coupon', 'Webkul\Shop\Http\Controllers\[email protected]')->name('shop.checkout.coupon.remove.coupon');
    
        //Cart Items Add
        Route::post('checkout/cart/add/{id}', 'Webkul\Shop\Http\Controllers\[email protected]')->defaults('_config', [
            'redirect' => 'shop.checkout.cart.index'
        ])->name('cart.add');
    
        //Cart Items Remove
        Route::get('checkout/cart/remove/{id}', 'Webkul\Shop\Http\Controllers\[email protected]')->name('cart.remove');
    
        //Cart Update Before Checkout
        Route::post('/checkout/cart', 'Webkul\Shop\Http\Controllers\[email protected]')->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\[email protected]')->defaults('_config', [
            'redirect' => 'shop.checkout.cart.index'
        ])->name('shop.checkout.cart.remove');
    
        //Checkout Index page
        Route::get('/checkout/onepage', 'Webkul\Shop\Http\Controllers\[email protected]')->defaults('_config', [
            'view' => 'shop::checkout.onepage'
        ])->name('shop.checkout.onepage.index');
    
        //Checkout Save Order
        Route::get('/checkout/summary', 'Webkul\Shop\Http\Controllers\[email protected]')->name('shop.checkout.summary');
    
        //Checkout Save Address Form Store
        Route::post('/checkout/save-address', 'Webkul\Shop\Http\Controllers\[email protected]')->name('shop.checkout.save-address');
    
        //Checkout Save Shipping Address Form Store
        Route::post('/checkout/save-shipping', 'Webkul\Shop\Http\Controllers\[email protected]')->name('shop.checkout.save-shipping');
    
        //Checkout Save Payment Method Form
        Route::post('/checkout/save-payment', 'Webkul\Shop\Http\Controllers\[email protected]')->name('shop.checkout.save-payment');
    
        //Checkout Save Order
        Route::post('/checkout/save-order', 'Webkul\Shop\Http\Controllers\[email protected]')->name('shop.checkout.save-order');
    
        //Checkout Order Successfull
        Route::get('/checkout/success', 'Webkul\Shop\Http\Controllers\[email protected]')->defaults('_config', [
            'view' => 'shop::checkout.success'
        ])->name('shop.checkout.success');
    
        //Shop buynow button action
        Route::get('move/wishlist/{id}', 'Webkul\Shop\Http\Controllers\[email protected]')->name('shop.movetowishlist');
    
        Route::get('/downloadable/download-sample/{type}/{id}', 'Webkul\Shop\Http\Controllers\[email protected]')->name('shop.downloadable.download_sample');
    
        // Show Product Review Form
        Route::get('/reviews/{slug}', 'Webkul\Shop\Http\Controllers\[email protected]')->defaults('_config', [
            'view' => 'shop::products.reviews.index'
        ])->name('shop.reviews.index');
    
        // Show Product Review(listing)
        Route::get('/product/{slug}/review', 'Webkul\Shop\Http\Controllers\[email protected]')->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\[email protected]')->defaults('_config', [
            'redirect' => 'shop.home.index'
        ])->name('shop.reviews.store');
    
         // Download file or image
        Route::get('/product/{id}/{attribute_id}', 'Webkul\Shop\Http\Controllers\[email protected]')->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\[email protected]')->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\[email protected]')->name('customer.forgot-password.store');
    
            // Reset Password Form Show
            Route::get('/reset-password/{token}', 'Webkul\Customer\Http\Controllers\[email protected]')->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\[email protected]')->defaults('_config', [
                'redirect' => 'customer.profile.index'
            ])->name('customer.reset-password.store');
    
            // Login Routes
            // Login form show
            Route::get('login', 'Webkul\Customer\Http\Controllers\[email protected]')->defaults('_config', [
                'view' => 'shop::customers.session.index',
            ])->name('customer.session.index');
    
            // Login form store
            Route::post('login', 'Webkul\Customer\Http\Controllers\[email protected]')->defaults('_config', [
                'redirect' => 'customer.profile.index'
            ])->name('customer.session.create');
    
            // Registration Routes
            //registration form show
            Route::get('register', 'Webkul\Customer\Http\Controllers\[email protected]')->defaults('_config', [
                'view' => 'shop::customers.signup.index'
            ])->name('customer.register.index');
    
            //registration form store
            Route::post('register', 'Webkul\Customer\Http\Controllers\[email protected]')->defaults('_config', [
                'redirect' => 'customer.session.index',
            ])->name('customer.register.create');
    
            //verify account
            Route::get('/verify-account/{token}', 'Webkul\Customer\Http\Controllers\[email protected]')->name('customer.verify');
    
            //resend verification email
            Route::get('/resend/verification/{email}', 'Webkul\Customer\Http\Controllers\[email protected]')->name('customer.resend.verification-email');
    
            // for customer login checkout
            Route::post('/customer/exist', 'Webkul\Shop\Http\Controllers\[email protected]')->name('customer.checkout.exist');
    
            // for customer login checkout
            Route::post('/customer/checkout/login', 'Webkul\Shop\Http\Controllers\[email protected]')->name('customer.checkout.login');
    
            // Auth Routes
            Route::group(['middleware' => ['customer']], function () {
    
                //Customer logout
                Route::get('logout', 'Webkul\Customer\Http\Controllers\[email protected]')->defaults('_config', [
                    'redirect' => 'customer.session.index'
                ])->name('customer.session.destroy');
    
                //Customer Wishlist add
                Route::get('wishlist/add/{id}', 'Webkul\Customer\Http\Controllers\[email protected]')->name('customer.wishlist.add');
    
                //Customer Wishlist remove
                Route::get('wishlist/remove/{id}', 'Webkul\Customer\Http\Controllers\[email protected]')->name('customer.wishlist.remove');
    
                //Customer Wishlist remove
                Route::get('wishlist/removeall', 'Webkul\Customer\Http\Controllers\[email protected]')->name('customer.wishlist.removeall');
    
                //Customer Wishlist move to cart
                Route::get('wishlist/move/{id}', 'Webkul\Customer\Http\Controllers\[email protected]')->name('customer.wishlist.move');
    
                //customer account
                Route::prefix('account')->group(function () {
                    //Customer Dashboard Route
                    Route::get('index', 'Webkul\Customer\Http\Controllers\[email protected]')->defaults('_config', [
                        'view' => 'shop::customers.account.index'
                    ])->name('customer.account.index');
    
                    //Customer Profile Show
                    Route::get('profile', 'Webkul\Customer\Http\Controllers\[email protected]')->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\[email protected]')->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\[email protected]')->defaults('_config', [
                        'redirect' => 'customer.profile.index'
                    ])->name('customer.profile.store');
    
                    //Customer Profile Delete Form Store
                    Route::post('profile/destroy', 'Webkul\Customer\Http\Controllers\[email protected]')->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\[email protected]')->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\[email protected]')->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\[email protected]')->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\[email protected]')->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\[email protected]')->defaults('_config', [
                        'redirect' => 'customer.address.index'
                    ])->name('customer.address.update');
    
                    //Customer Address Make Default
                    Route::get('addresses/default/{id}', 'Webkul\Customer\Http\Controllers\[email protected]')->name('make.default.address');
    
                    //Customer Address Delete
                    Route::get('addresses/delete/{id}', 'Webkul\Customer\Http\Controllers\[email protected]')->name('address.delete');
    
                    /* Wishlist route */
                    //Customer wishlist(listing)
                    Route::get('wishlist', 'Webkul\Customer\Http\Controllers\[email protected]')->defaults('_config', [
                        'view' => 'shop::customers.account.wishlist.wishlist'
                    ])->name('customer.wishlist.index');
    
                    /* Orders route */
                    //Customer orders(listing)
                    Route::get('orders', 'Webkul\Shop\Http\Controllers\[email protected]')->defaults('_config', [
                        'view' => 'shop::customers.account.orders.index'
                    ])->name('customer.orders.index');
    
                    //Customer downloadable products(listing)
                    Route::get('downloadable-products', 'Webkul\Shop\Http\Controllers\[email protected]')->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\[email protected]')->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\[email protected]')->defaults('_config', [
                        'view' => 'shop::customers.account.orders.view'
                    ])->name('customer.orders.view');
    
                    //Prints invoice
                    Route::get('orders/print/{id}', 'Webkul\Shop\Http\Controllers\[email protected]')->defaults('_config', [
                        'view' => 'shop::customers.account.orders.print'
                    ])->name('customer.orders.print');
    
                    Route::get('/orders/cancel/{id}', 'Webkul\Shop\Http\Controllers\[email protected]')->name('customer.orders.cancel');
    
                    /* Reviews route */
                    //Customer reviews
                    Route::get('reviews', 'Webkul\Customer\Http\Controllers\[email protected]')->defaults('_config', [
                        'view' => 'shop::customers.account.reviews.index'
                    ])->name('customer.reviews.index');
    
                    //Customer review delete
                    Route::get('reviews/delete/{id}', 'Webkul\Shop\Http\Controllers\[email protected]')->defaults('_config', [
                        'redirect' => 'customer.reviews.index'
                    ])->name('customer.review.delete');
    
                    //Customer all review delete
                    Route::get('reviews/all-delete', 'Webkul\Shop\Http\Controllers\[email protected]')->defaults('_config', [
                        'redirect' => 'customer.reviews.index'
                    ])->name('customer.review.deleteall');
                });
            });
        });
        //customer routes end here
    
        Route::get('page/{slug}', 'Webkul\CMS\Http\Controllers\Shop\[email protected]')->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
    

Log in to reply