Git Product home page Git Product logo

bazar's Introduction


Bazar

GitHub Actions Coverage Status

Bazar is a powerful headless e-commerce system, built on Laravel.

Bazar provides a flexible and easily extensible system, respecting the Laravel conventions.

📚 Documentation

Note

The new documentation is coming soon, as part of the Root documentation.

📝 License

Bazar is open-sourced software licensed under the MIT.

bazar's People

Contributors

adamlaki avatar dd10-e avatar designvoid avatar iamgergo avatar reached avatar rowanfuchs avatar szepeviktor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bazar's Issues

UserFactory uses Bazar\Model\Users

  • Bazar Version: 0.7.4
  • Laravel Version: 8.40.0
  • PHP Version: 8.0.5

Description:

When doing tests, any custom methods on the Users model (in my case fresh installation for Laravel Jetstream) does not register. I know the recommended auth scaffolding is Laravel Breeze, just testing Jetstream with Bazar.

Steps To Reproduce:

Fresh install of Laravel
Install Laravel Jetstream
Run tests
BadMethodCallException: Call to undefined method Bazar\Models\User::deleteProfilePhoto()

You can fix this by changing Bazar\Database\Factories\UserFactory

From
use Bazar\Models\User;
To
use App\Models\User;

[Question] Using variants for configurable options

Hello !

I wonder how it is possible to use Variants database structure to do configurable products like :

  • Red Color option should be available only if you select XS Size option
  •  Multiple selection of variations, something like optional products at the end
  • Columns/Row price selection (like an Excel : dimension 500/600 = 110 USD whatever)

I'm thinking more at Tesla website or a window configurator (this one seems to do pretty good things : https://fensternorm.com/en/configurator/windows/upvc/trocal-70-eco/c1)

Pretty hard !

I've done some research with the current implementation, and it was wonderful. I really liked the way you did this, simple and clean API.

The first thing I need to do is to add some attributes (something like a description and step order) and prices to this option, like you're doing on Variants. I can maybe add some attributes on options columns since it's a JSON column, but this might not be a very clean way to do this because I will lose all prices and stock handling of variants, and i don't think i can handle all this things listed above.

So I've considered to requested directly variations this way :

$variants = $product->variantsWhere($this->selection);
// $this->selection is an array of options, handle the same way as variants method of instance Product but return me all available Variants
// Example : $variants = $product->variantsWhere(["Size" => "A", "Color" => "*", "Dimension" => "*"]);
//  "*" is when the User haven't yet selected an option, so this line will give me all Variants with `Size === "A"`

Implementation look like this (unfinished) :

    public function variantsWhere(array $option)
    {
        return $this->variants()->where(function ($query) use ($option) {

            foreach ($option as $key => $value) {
                if ($value !== "*") {
                    $query->where('option->' . $key, $value);
                }
            }

            return $query;
        })->get();
    }

This way, I can add more attributes and have pricing, but I wouldn't be able to query : "Select me all variants when there is Size to XS selected" for example.

I think the best way to do this, and for having the more flexibility should be to have a separate table that we can name configurations with columns option_name|string, value|string, description|string, prices|json, inventory|json, product_id.

Data will look this way (note that i've added some extra columns for illustrate application logic used by the application after Bazar Framework) :

option_name value description       price inventory product_id available_on_option_name next_step order
Size         XS     Little           10%                         All                       Color     1    
Size         S     A bit moe bigger 10                           All                       Color     1    
Size         L     link             100                         All                       Color     1    
Color       red                     10%                         Size                     Dimension 2    
Color       blue                     10                           Size                     Dimension 2    
Color       green                   100                         Size                     Dimension 2    

Using another table should be more flexible, right ? But it really looks like variations in fact, except that we don't use the options column of products for query variations. In the other side configurations will be query using $product->configurations()->where('order', 1)->andGetMeArrayValuesWithStepName().

Not tested at all ! But it should be more flexible. I think I described the idea correctly.

So the response seems to be "No.".  But I wanted to share my reflection and ask if it's something that should be added on Bazar Framework ? I'm mainly curious about the roadmap where you mention More flexible option/property management. Are you thinking of something similar or another way ?

Perfect occasion to say that you did an amazing clean work. I learn a lot !

Pretty big question ! Thank you for reading and feel free to close if it's out of the scope.

Add default/favorite product variant

  • Bazar version: 0.8.2
  • Laravel version: 8.42.1
  • PHP version: 8.0.3

Is your feature request related to a problem? Please describe

Product variants is one of the most important features when you are showing your product details. It would greatly help if we set up a default variant in order for it to be loaded when the product details loads for example. There are many advantages to creating this feature.

Describe the solution you'd like

Maybe on the 'Create Variant' page you can set up a favorite/default on the icon-more-vertical.

Why do you think this feature is something we should consider for Bazar?

This feature will allow designers which variant they want as default when the page loads.

Branding 💥

thepinecode/bazar vs. bazar.conedevelopment.com

Is it intentional?

Not able to delete a media image

Was not able to delete a media image, I checked the chrome network tab and I saw that the route was not found. The URL I saw in the network tab is admin/media/batch-destroy.

Custom Login/Logout logic

It would be handy if Bazar would ship its own auth layer, for now only containing login and logout.

This way we would not force developers to use laravel/ui or jetstream to be able to login.

Colliding namespaces

🚨

Blade::components([
View\Components\Breadcrumbs::class,
]);

        Blade::components([
// We have an import named "View": use Illuminate\Support\Facades\View;
            View\Components\Breadcrumbs::class,
        ]);

Suggestion: use only FQCN.

Rework cart API

The add, update, remove methods on the cart drivers are having a quite different signature.

We might rewrite and unify the parameters, so it might be easier to use the cart facade.

Also we should add new events like, CartEmptied, ItemAdded/Updated/Removed, etc.

Also, we should consider adding an easy way to update billing and shipping details.

Add URL helper

Is your feature request related to a problem? Please describe

There are two preg_match('/bazar/', Route::getCurrentRoute()->getName()) in the code base.
None of them are nice.

Describe the solution you'd like

Add an isBazarRoute helper.

Why do you think this feature is something we should consider for Bazar?

Looks professional.

Batch downloads

Currently, customers can download only one file at a time. Let's add the possibility to download all the files at once in a zip format.

Resolve lot of errors

composer require --dev nunomaduro/larastan orchestra/testbench:^5.5.0
vendor/bin/phpstan analyse

phpstan.neon.dist

includes:
    - vendor/nunomaduro/larastan/extension.neon
parameters:
    level: 5
    checkMissingIterableValueType: false
    paths:
        - src/
        - config/
        - database/
        - routes/

Should we publish public directory from current package to Laravel project?

  • Bazar Version: 0.4.6
  • Laravel Version: 8.26.1
  • PHP Version: 7.4.13
  • Database Driver & Version: sqlite

Is your feature request related to a problem? Please describe

when I run php artisan bazar:publish --tag=bazar-assets command Publish Assets, But the 'img/' resources already missing.

image

Describe the solution you'd like

  1. Publish the public/img directory to user Laravel project public/vendor/bazar/img, like:
    Add a line from L150 - L153
$this->publishes([
    __DIR__. '/../public/img' => App::basePath() . '/public/vendor/bazar/img',
    __DIR__.'/../resources/js' => App::resourcePath('js/vendor/bazar'),
    __DIR__.'/../resources/sass' => App::resourcePath('sass/vendor/bazar'),
], 'bazar-assets');
  1. Publish all public directory to user Laravel project public/vendor/bazar, And I think that's good because when user run php artisan bazar:publish --tag=bazar-assets, They no longer need to execute npm install && npm run dev command.
$this->publishes([
    __DIR__. '/../public' => App::basePath() . '/public/vendor/bazar',
], 'bazar-assets');

Why do you think this feature is something we should consider for Bazar?

Because User-friendly.

Additional context

Thanks again for providing the package.

Price is always null

  • Bazar Version: dev-master
  • Laravel Version: 8.44.0
  • PHP Version: 7.4.19
  • Database Driver & Version: PostgreSQL 12

Description:

Bazar\Models\Product::first()->price results in null even though a price is set.

Steps To Reproduce:

Create a product, enter a price, you can see from domain.test/bazar/products that no price is shown.

Bazar\Models\Product::first()->price and Bazar\Models\Product::first()->formatedPrice return null.

Bazar\Models\Product::first()->prices returns a Bazar\Casts\Prices object that shows the entered value under storage->GBP->default

fatal error

  • Bazar Version: 0.3.0
  • Laravel Version: 8.22.1
  • PHP Version: 7.4.13
  • Database Driver & Version: MariaDB 10.3

Description:

My smart fridge throws a fatal error somewhere.

Steps To Reproduce:

Forgot, sorry....

Create product missing price section

  • Bazar Version: 0.9.0
  • Laravel Version: 8.44.0
  • PHP Version: 7.4.19
  • Database Driver & Version: PostgreSQL 12

Description:

As per #163 the price is now shown and accessible via Bazar\Models\Product::first()->price however I'm no longer able to edit it the Admin UI no longer shows the price configuration section and give this javascript error.

TypeError: undefined is not an object (evaluating 'i.data.prices[n].default') —

Steps To Reproduce:

Install Baza

composer require conedevelopment/bazar
artisan bazar:install
artisan bazar:publish

Visit http://domain.test/bazar/products/create price section is missing and console shows error as above.

Addressable User relationship uuid != integer

  • Bazar Version: 0.8.1
  • Laravel Version: 8.41
  • PHP Version: 7.4.19
  • Database Driver & Version: PostgreSQL 12.2

Description:

Attempt to visit /bazar/users and I receive this error

SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: uuid = integer LINE 1: ...dresses" where "bazar_addresses"."addressable_id" in (5, 6, ... ^ HINT: No operator matches the given name and argument types. You might need to add explicit type casts. (SQL: select * from "bazar_addresses" where "bazar_addresses"."addressable_id" in (5, 6, 7) and "bazar_addresses"."addressable_type" = Bazar\Models\User)

I saw something similar when I tried to do an install with --seed option.

It's clear from the database that bazar_addresses.addressable_id is a uuid field and the user.id is an integer so they can't have a direct comparison.

Steps To Reproduce:

Install Bazar and visit/bazar/users

Superior to WooCommerce

This package is superior to WooCommerce.

Very nice to see Events instead of actions and filters :)

Design and Route Not working

  • Bazar Version: 0.4.4
  • Laravel Version: 8.25.0
  • PHP Version: 7.4.0
  • Database Driver & Version: MariaDB

Description:

image

Steps To Reproduce:

I have minor design issue on admin and profile, password route is not working for me.

Parent category and children

Currently it's only possible to have one level of categories, however by adding a parent_id and the following relations a multidimensional category structure is created. The admin view needs to be adjusted to show a tree structure and dropdown's containing categories can be added to the create/update views

/**
 * @return \Illuminate\Database\Eloquent\Relations\HasMany
 */
public function children(): \Illuminate\Database\Eloquent\Relations\HasMany
{
    return $this->hasMany(self::class, 'parent_id');
}

/**
 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
 */
public function parent(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
    return $this->belongsTo(self::class, 'parent_id');
}

This is a small change which provides a beneficial feature. If this is a feature which is considered an addition I can provide an initial pull request with the required changes.

cart to order and return on cancellation process

I'm not sure if I missed it but as far as I see a mid-order cancellation process isn't supported yet. There is a moment where you can create an order which goes perfectly. But what if the payment because of some reason fails after the creation. Within my payment provider the user can cancel or simply return of the page. On that moment a reinitialization of the cart is required so that customers can adjust or extend their cart.

What process do you use to do so? or is this something of which you are planning to implement?

Extending Admin UI

What's the right way to add a page to Admin UI?
I want to implement basic CRUD for an Eloquent model.

Using constants

May I send a PR with the following?

  • Carbon constants (7 -> Carbon::DAYS_PER_WEEK)
  • HTTP status codes (403 -> JsonResponse::HTTP_FORBIDDEN)
  • and $request->input('per_page', 25) -> Controller::DEFAULT_ITEMS_PER_PAGE = 25
phpmnd --non-zero-exit-on-violation --include-numeric-string --extensions all src/

'npm run' Throw Error

ERROR in ./resources/js/vendor/bazar/Plugins/Bazar.js 4:0-52
Module not found: Error: Can't resolve './../Components/Media/Manager' in 'C:\wamp64\www\bazar\resources\js\vendor\bazar\Plugins'

ERROR in ./resources/js/vendor/bazar/Plugins/Bazar.js 5:0-40
Module not found: Error: Can't resolve './../Components/Card' in 'C:\wamp64\www\bazar\resources\js\vendor\bazar\Plugins'
ERROR in ./resources/js/vendor/bazar/Plugins/Bazar.js 6:0-40
Module not found: Error: Can't resolve './../Components/Icon' in 'C:\wamp64\www\bazar\resources\js\vendor\bazar\Plugins'
ERROR in ./resources/js/vendor/bazar/Plugins/Bazar.js 7:0-48
Module not found: Error: Can't resolve './../Components/Dropdown' in 'C:\wamp64\www\bazar\resources\js\vendor\bazar\Plugins'

npm run dev throw this error

Rework the form component

Since we have inertia, it offers a lot of new possibilities, such as handling the forms differently as before.

Our goal is to keep the front-end simple and clean as well, to do so we might implement the following steps:

  • Remove the input wrapper components, keep only those we can't avoid handling as a component like: Tags, Autocomplete, Editor
  • Use the preserveState: true option for the form
  • Cleanup the Errors class

We might apply a rewrite in Vue 3, reworking the components and adding front-end tests as well.

Extending shipping with a new driver doesn't overwrite the default

I'm a little lost in the functionality of the contracts and extension of them. I have the following shipping driver set up but it always defaults to local-pickup unless I hard code assigning a new carrier after the creation of a new cart. Am I missing something? How can I make sure it it enforces the default dhl of the config value shipping.default

Config:

'shipping' => [
    'default' => strtolower(env('BAZAR_SHIPPING_DRIVER', 'local-pickup')),
    'drivers' => [
        'local-pickup' => [],
        'dhl' => [],
    ],
],

Result of the default is: dhl

The boot of AppServiceProvider contains the extension of the Shipping facade

use Bazar\Support\Facades\Shipping;

public function boot()
{
    Shipping::extend('dhl', function ($app) {
        return new DHLDriver();
    });
}

The DHLDriver contains the following

<?php

namespace App\Drivers;

use Bazar\Contracts\Shippable;
use Bazar\Shipping\Driver;

class DHLDriver extends Driver
{
    public function calculate(Shippable $model): float
    {
        return 4.5;
    }
}

Auth error after install and login

  • Bazar Version: 0.6.0
  • Laravel Version: 8.3.0
  • PHP Version: 7.4.16
  • Database Driver & Version: MySQL 5.7.23

Description:

Auth error bazar panel after login in app - 'manage-bazar'

Bazar\BazarServiceProvider::Bazar\{closure}
vendor/conedevelopment/bazar/src/BazarServiceProvider.php:226
    protected function registerAuth(): void

    {

        Gate::define('manage-bazar', static function (Contracts\Models\User $user): bool {

            return $user->isAdmin();

        });

    }

Steps To Reproduce:

install laravel, bazar, (breeze, jetstream, laravel ui), login in app ([email protected]).

Shippable/non-shippable items

Determine if an item should be shipped.

For example a virtual item should be excluded from the shipping calculation.

If a cart holds only non-shippable items, calculation should be skipped, shipping model should not be attached to the cart/order during checkout.

[Cart] Array to string conversion

  • Bazar Version: v0.9.1
  • Laravel Version: 8.43
  • PHP Version: 7.4
  • Database Driver & Version: mysql Ver 8.0.23-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))

Description:

return $this->items->first(static function (Item $item) use ($attributes): bool {
return empty(array_diff(
Arr::dot($attributes),
Arr::dot($item->withoutRelations()->toArray())
));
});
}

This code is causing error is causing an error : "Array to string conversion".

Steps To Reproduce:

use Bazar\Support\Facades\Cart;

$item = Cart::addItem($product);

Should change current project package.json

In this section: customizing the ui We should change our package.json file from vendor/conedevelopment/bazar/package.json

"devDependencies": {
    "@inertiajs/inertia": "^0.3.6",
    "@inertiajs/inertia-vue": "^0.2.4",
    "axios": "^0.21.0",
    "bootstrap": "^4.5.3",
    "chart.js": "^2.9.4",
    "cross-env": "^7.0.3",
    "laravel-mix": "^5.0.7",
    "quill": "^1.3.7",
    "resolve-url-loader": "^3.1.2",
    "sass": "^1.32.4",
    "sass-loader": "^8.0.0",
    "simplebar": "^5.3.0",
    "vue": "^2.6.12",
    "vue-loader": "^15.9.5",
    "vue-template-compiler": "^2.6.12"
}

Media Modal has some logic error in product/create page

  • Bazar Version: 0.4.6
  • Laravel Version: 8.26.1
  • PHP Version: 7.4.13
  • Database Driver & Version: sqlite

Description:

When I click the icon in the editor on the left, the right elements is on it.

When I click "Select Media" on the right, It is OK.

I think it is determined by the different documents where the modal is located.

So I tried to modify the left '.form__body { z-index: 11;}' the left Modal is OK, But the modal box on the right is wrong.

Steps To Reproduce:

The screenshot like this:

bug

Some Ideas:

  1. Change z-index value when toggle media modal status.

  2. We can use Portal Vue package, and Remove media-manager component out left and right side, example: Remove to the .form child.

Not a drop-in solution

I'm already using spatie/laravel-medialibrary and also already have products table.
So, I can't even install bazar :(

Currently, I'm renaming my tables, will see what issues I'll face next.

But I already see what needs to be changed:

  1. Put table names in config.
  2. Use stubs for migrations and publish them to application migrations directory, same like larave/ui does.

Integrate with existing products and categories

I have an existing project where Products and Categories are implemented already and being synced with warehouse management system and several external marketplaces. Products and Categories are simply Eloquent models. Also I have Characteristics model which belongs to Category and in many to many relationship with Product.
However, I want to implement Cart, Checkout, Discounts, Shipping and Taxes.
Also, having an option to edit Product Characteristics would also be nice.

What is the easiest way to implement this?
What will be the right way, considering Products have much more attributes than Bazar offers.

Product price validation error when 2 digits are submitted

  • Bazar Version: 0.9.0
  • Laravel Version: 8.49.0
  • PHP Version: 8.0.2

Description:

When creating a product. The price only accepts 1 digit.
image

Steps To Reproduce:

On the creation product page, input on the price 19.99 an error occurs on validation
'Please select a valid value...'

Product image folders

Hello,

wanted to ask your opinion about storing each product's images into separate folders, named as product's slug for example.
The idea is to structure the images into folders for readability, otherwise, when having 100+ products for example, it will be very hard to find the right images for the needed product, especially when having few variants with different images assigned. So I guess, you can create a folder with the product's slug as name when saving the product.

Best regards

Need a bazar-example app for visual testing

Is your feature request related to a problem? Please describe

Selenium testing needs a working Laravel app with Bazar + database.
CRUD operations should be possible on all Models.

Describe the solution you'd like

I would contribute automated acceptance tests with https://ui.vision/
Could be run in a browser or with Selenium in CI.
Includes HTML element checking and visual comparison with small PNG images.

Why do you think this feature is something we should consider for Bazar?

Most parts of Vue files are out of control.

Database fields not configured for Uuid's

  • Bazar Version: 0.7.0
  • Laravel Version: 8.37.0
  • PHP Version: 8.0
  • Database Driver & Version: mariadb 10.5

Description:

database id fields are not configured for Uuid's

SQLSTATE[01000]: Warning: 1265 Data truncated for column 'shippable_id' at row 1 (SQL: insert into bazar_shippings (tax, cost, driver, shippable_id, shippable_type, updated_at, created_at) values (0, 0, local-pickup, 38c3b5d1-1135-4c93-8fc2-e5227ef0ed05, Bazar\Models\Cart, 2021-04-16 11:38:38, 2021-04-16 11:38:38))

fixed by setting the field to the char(36)
but is followed by

SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: 'd7df5adb-a383-4fe1-bcd8-53e17b90aa69' for column dsp.bazar_shippings.shippable_id at row 1 (SQL: insert into bazar_shippings (tax, cost, driver, shippable_id, shippable_type, updated_at, created_at) values (0, 0, local-pickup, d7df5adb-a383-4fe1-bcd8-53e17b90aa69, Bazar\Models\Cart, 2021-04-16 11:50:11, 2021-04-16 11:50:11))

and is also fixed by setting the field to the char(36)

SKU validation fails when value is all integers

  • Bazar Version: 0.9.0
  • Laravel Version: 8.43.0
  • PHP Version: 8.0.2

Description:

Minor bug

SKU value only accepts strings, but if the SKU is full of integers and you try to edit and submit a product this error occurs:
image

This error also happens when editing a variant product with a SKU with only integers.

Steps To Reproduce:

Create a product page:

  • Create a product
  • Input only integers on SKU
  • Edit the product and submit
  • The error occurs

Create a Variant Page

  • Create a variant
  • Input only integers on SKU
  • Edit the variant and submit
  • The error occurs

Menu Builder

It would be nice if we could easily add menu items without editing the Sidebar.vue file.

To do that, we might implement a simple menu builder and generate a JSON/Array format of the menu tree.

Also, we'd use that as a view composer, not as a shared Inertia data, and handle the active menu items from the JS. This way we can keep the JSON responses smaller and cleaner.

Example implementation:

use Bazar\Support\Facades\Menu;


Menu::item('Coupons', 'bazar.coupons.index', [
    'icon' => 'icon-sale',
    'group' => 'shop',
    'children' => [...],
]);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.