diff --git a/composer.json b/composer.json index 6624edda5..b67e85057 100644 --- a/composer.json +++ b/composer.json @@ -12,6 +12,7 @@ "dimsav/laravel-translatable": "^9.0", "fideloper/proxy": "^4.0", "intervention/image": "^2.4", + "intervention/imagecache": "^2.3", "kalnoy/nestedset": "^4.3", "laravel/framework": "5.6.*", "laravel/tinker": "^1.0", diff --git a/composer.lock b/composer.lock index cb287d95e..ec992ced6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ee788a0a8a86526cd58b0b4853a45c06", + "content-hash": "c0c2a23aa2502c590b2ccf7975329ce1", "packages": [ { "name": "commerceguys/intl", @@ -600,6 +600,59 @@ ], "time": "2018-05-29T14:19:03+00:00" }, + { + "name": "intervention/imagecache", + "version": "2.3.3", + "source": { + "type": "git", + "url": "https://github.com/Intervention/imagecache.git", + "reference": "7936b90e695daee1aafbd25221815352ef97bcbc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/imagecache/zipball/7936b90e695daee1aafbd25221815352ef97bcbc", + "reference": "7936b90e695daee1aafbd25221815352ef97bcbc", + "shasum": "" + }, + "require": { + "illuminate/cache": "~4|~5", + "illuminate/filesystem": "~4|~5", + "intervention/image": "dev-master|~2,>=2.2.0", + "jeremeamia/superclosure": "~1|~2", + "php": ">=5.3.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.2", + "phpunit/phpunit": "3.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src/Intervention/Image" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@olivervogel.net", + "homepage": "http://olivervogel.net/" + } + ], + "description": "Caching extension for the Intervention Image Class", + "homepage": "http://image.intervention.io", + "keywords": [ + "cache", + "gd", + "image", + "imagick", + "laravel" + ], + "time": "2015-09-22T15:22:47+00:00" + }, { "name": "jakub-onderka/php-console-color", "version": "0.1", @@ -752,6 +805,64 @@ ], "time": "2018-05-16T11:53:55+00:00" }, + { + "name": "jeremeamia/SuperClosure", + "version": "2.4.0", + "source": { + "type": "git", + "url": "https://github.com/jeremeamia/super_closure.git", + "reference": "5707d5821b30b9a07acfb4d76949784aaa0e9ce9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jeremeamia/super_closure/zipball/5707d5821b30b9a07acfb4d76949784aaa0e9ce9", + "reference": "5707d5821b30b9a07acfb4d76949784aaa0e9ce9", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^1.2|^2.0|^3.0|^4.0", + "php": ">=5.4", + "symfony/polyfill-php56": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "psr-4": { + "SuperClosure\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia", + "role": "Developer" + } + ], + "description": "Serialize Closure objects, including their context and binding", + "homepage": "https://github.com/jeremeamia/super_closure", + "keywords": [ + "closure", + "function", + "lambda", + "parser", + "serializable", + "serialize", + "tokenizer" + ], + "time": "2018-03-21T22:21:57+00:00" + }, { "name": "kalnoy/nestedset", "version": "v4.3.2", @@ -2580,6 +2691,62 @@ ], "time": "2018-04-26T10:06:28+00:00" }, + { + "name": "symfony/polyfill-php56", + "version": "v1.9.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php56.git", + "reference": "7b4fc009172cc0196535b0328bd1226284a28000" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/7b4fc009172cc0196535b0328bd1226284a28000", + "reference": "7b4fc009172cc0196535b0328bd1226284a28000", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/polyfill-util": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php56\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2018-08-06T14:22:27+00:00" + }, { "name": "symfony/polyfill-php72", "version": "v1.8.0", @@ -2635,6 +2802,58 @@ ], "time": "2018-04-26T10:06:28+00:00" }, + { + "name": "symfony/polyfill-util", + "version": "v1.9.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-util.git", + "reference": "8e15d04ba3440984d23e7964b2ee1d25c8de1581" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/8e15d04ba3440984d23e7964b2ee1d25c8de1581", + "reference": "8e15d04ba3440984d23e7964b2ee1d25c8de1581", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Util\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony utilities for portability of PHP codes", + "homepage": "https://symfony.com", + "keywords": [ + "compat", + "compatibility", + "polyfill", + "shim" + ], + "time": "2018-08-06T14:22:27+00:00" + }, { "name": "symfony/process", "version": "v4.1.2", diff --git a/config/app.php b/config/app.php index 856fbf5a1..b0f6ebc94 100644 --- a/config/app.php +++ b/config/app.php @@ -242,7 +242,8 @@ return [ 'View' => Illuminate\Support\Facades\View::class, 'Datagrid' => Webkul\Ui\DataGrid\Facades\DataGrid::class, 'ProductGrid' => Webkul\Ui\DataGrid\Facades\ProductGrid::class, - 'Image' => Intervention\Image\Facades\Image::class + 'Image' => Intervention\Image\Facades\Image::class, + 'Core' => Webkul\Core\Facades\Core::class ], ]; diff --git a/config/filesystems.php b/config/filesystems.php index 25a84a4bd..b36f4c121 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -51,7 +51,7 @@ return [ 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/public/storage', + 'url' => env('APP_URL') . '/public/storage', 'visibility' => 'public', ], diff --git a/config/imagecache.php b/config/imagecache.php new file mode 100644 index 000000000..83dae729f --- /dev/null +++ b/config/imagecache.php @@ -0,0 +1,72 @@ + 'cache', + + /* + |-------------------------------------------------------------------------- + | Storage paths + |-------------------------------------------------------------------------- + | + | The following paths will be searched for the image filename, submited + | by URI. + | + | Define as many directories as you like. + | + */ + + 'paths' => array( + storage_path('app/public'), + public_path('storage') + ), + + /* + |-------------------------------------------------------------------------- + | Manipulation templates + |-------------------------------------------------------------------------- + | + | Here you may specify your own manipulation filter templates. + | The keys of this array will define which templates + | are available in the URI: + | + | {route}/{template}/{filename} + | + | The values of this array will define which filter class + | will be applied, by its fully qualified name. + | + */ + + 'templates' => array( + 'small' => 'Webkul\Product\CacheFilters\Small', + 'medium' => 'Webkul\Product\CacheFilters\Medium', + 'large' => 'Webkul\Product\CacheFilters\Large', + ), + + /* + |-------------------------------------------------------------------------- + | Image Cache Lifetime + |-------------------------------------------------------------------------- + | + | Lifetime in minutes of the images handled by the imagecache route. + | + */ + + 'lifetime' => 1, + // 'lifetime' => 43200, + +); diff --git a/config/repository.php b/config/repository.php new file mode 100644 index 000000000..a251120c6 --- /dev/null +++ b/config/repository.php @@ -0,0 +1,244 @@ + [ + 'limit' => 15 + ], + + /* + |-------------------------------------------------------------------------- + | Fractal Presenter Config + |-------------------------------------------------------------------------- + | + + Available serializers: + ArraySerializer + DataArraySerializer + JsonApiSerializer + + */ + 'fractal' => [ + 'params' => [ + 'include' => 'include' + ], + 'serializer' => League\Fractal\Serializer\DataArraySerializer::class + ], + + /* + |-------------------------------------------------------------------------- + | Cache Config + |-------------------------------------------------------------------------- + | + */ + 'cache' => [ + /* + |-------------------------------------------------------------------------- + | Cache Status + |-------------------------------------------------------------------------- + | + | Enable or disable cache + | + */ + 'enabled' => false, + + /* + |-------------------------------------------------------------------------- + | Cache Minutes + |-------------------------------------------------------------------------- + | + | Time of expiration cache + | + */ + 'minutes' => 30, + + /* + |-------------------------------------------------------------------------- + | Cache Repository + |-------------------------------------------------------------------------- + | + | Instance of Illuminate\Contracts\Cache\Repository + | + */ + 'repository' => 'cache', + + /* + |-------------------------------------------------------------------------- + | Cache Clean Listener + |-------------------------------------------------------------------------- + | + | + | + */ + 'clean' => [ + + /* + |-------------------------------------------------------------------------- + | Enable clear cache on repository changes + |-------------------------------------------------------------------------- + | + */ + 'enabled' => true, + + /* + |-------------------------------------------------------------------------- + | Actions in Repository + |-------------------------------------------------------------------------- + | + | create : Clear Cache on create Entry in repository + | update : Clear Cache on update Entry in repository + | delete : Clear Cache on delete Entry in repository + | + */ + 'on' => [ + 'create' => true, + 'update' => true, + 'delete' => true, + ] + ], + + 'params' => [ + /* + |-------------------------------------------------------------------------- + | Skip Cache Params + |-------------------------------------------------------------------------- + | + | + | Ex: http://prettus.local/?search=lorem&skipCache=true + | + */ + 'skipCache' => 'skipCache' + ], + + /* + |-------------------------------------------------------------------------- + | Methods Allowed + |-------------------------------------------------------------------------- + | + | methods cacheable : all, paginate, find, findByField, findWhere, getByCriteria + | + | Ex: + | + | 'only' =>['all','paginate'], + | + | or + | + | 'except' =>['find'], + */ + 'allowed' => [ + 'only' => null, + 'except' => null + ] + ], + + /* + |-------------------------------------------------------------------------- + | Criteria Config + |-------------------------------------------------------------------------- + | + | Settings of request parameters names that will be used by Criteria + | + */ + 'criteria' => [ + /* + |-------------------------------------------------------------------------- + | Accepted Conditions + |-------------------------------------------------------------------------- + | + | Conditions accepted in consultations where the Criteria + | + | Ex: + | + | 'acceptedConditions'=>['=','like'] + | + | $query->where('foo','=','bar') + | $query->where('foo','like','bar') + | + */ + 'acceptedConditions' => [ + '=', + 'like' + ], + /* + |-------------------------------------------------------------------------- + | Request Params + |-------------------------------------------------------------------------- + | + | Request parameters that will be used to filter the query in the repository + | + | Params : + | + | - search : Searched value + | Ex: http://prettus.local/?search=lorem + | + | - searchFields : Fields in which research should be carried out + | Ex: + | http://prettus.local/?search=lorem&searchFields=name;email + | http://prettus.local/?search=lorem&searchFields=name:like;email + | http://prettus.local/?search=lorem&searchFields=name:like + | + | - filter : Fields that must be returned to the response object + | Ex: + | http://prettus.local/?search=lorem&filter=id,name + | + | - orderBy : Order By + | Ex: + | http://prettus.local/?search=lorem&orderBy=id + | + | - sortedBy : Sort + | Ex: + | http://prettus.local/?search=lorem&orderBy=id&sortedBy=asc + | http://prettus.local/?search=lorem&orderBy=id&sortedBy=desc + | + | - searchJoin: Specifies the search method (AND / OR), by default the + | application searches each parameter with OR + | EX: + | http://prettus.local/?search=lorem&searchJoin=and + | http://prettus.local/?search=lorem&searchJoin=or + | + */ + 'params' => [ + 'search' => 'search', + 'searchFields' => 'searchFields', + 'filter' => 'filter', + 'orderBy' => 'orderBy', + 'sortedBy' => 'sortedBy', + 'with' => 'with', + 'searchJoin' => 'searchJoin' + ] + ], + /* + |-------------------------------------------------------------------------- + | Generator Config + |-------------------------------------------------------------------------- + | + */ + 'generator' => [ + 'basePath' => app()->path(), + 'rootNamespace' => 'App\\', + 'stubsOverridePath' => app()->path(), + 'paths' => [ + 'models' => 'Entities', + 'repositories' => 'Repositories', + 'interfaces' => 'Repositories', + 'transformers' => 'Transformers', + 'presenters' => 'Presenters', + 'validators' => 'Validators', + 'controllers' => 'Http/Controllers', + 'provider' => 'RepositoryServiceProvider', + 'criteria' => 'Criteria' + ] + ] +]; diff --git a/packages/Webkul/Admin/src/Providers/EventServiceProvider.php b/packages/Webkul/Admin/src/Providers/EventServiceProvider.php index 2c1b321ac..accef9ceb 100644 --- a/packages/Webkul/Admin/src/Providers/EventServiceProvider.php +++ b/packages/Webkul/Admin/src/Providers/EventServiceProvider.php @@ -108,6 +108,12 @@ class EventServiceProvider extends ServiceProvider Event::listen('admin.acl.build', function ($acl) { $acl->add('dashboard', 'Dashboard', 'admin.dashboard.index', 1); + $acl->add('catalog', 'Catalog', 'admin.catalog.index', 2); + + $acl->add('catalog.products', 'Products', 'admin.catalog.products.index', 1); + + $acl->add('catalog.categories', 'Categories', 'admin.catalog.categories.index', 1); + $acl->add('configuration', 'Configure', 'admin.account.edit', 5); $acl->add('settings', 'Settings', 'admin.users.index', 6); diff --git a/packages/Webkul/Core/src/Providers/CoreServiceProvider.php b/packages/Webkul/Core/src/Providers/CoreServiceProvider.php index e5ab890d2..893feccac 100644 --- a/packages/Webkul/Core/src/Providers/CoreServiceProvider.php +++ b/packages/Webkul/Core/src/Providers/CoreServiceProvider.php @@ -1,17 +1,12 @@ loadMigrationsFrom(__DIR__ . '/../Database/Migrations'); - $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'core'); - $router->aliasMiddleware('locale', Locale::class); - - $router->aliasMiddleware('admin', RedirectIfNotAdmin::class); - - $router->aliasMiddleware('customer', RedirectIfNotCustomer::class); - - $this->publishes([ - __DIR__ . '/../../publishable/lang' => public_path('vendor/webkul/core/lang'), - ], 'public'); - + // $this->publishes([ + // __DIR__ . '/../../publishable/lang' => public_path('vendor/webkul/core/lang'), + // ], 'public'); Validator::extend('slug', 'Webkul\Core\Contracts\Validations\Slug@passes'); - Validator::extend('code', 'Webkul\Core\Contracts\Validations\Code@passes'); } - /** * Register services. * @@ -51,7 +35,6 @@ class CoreServiceProvider extends ServiceProvider { $this->registerFacades(); } - /** * Register Bouncer as a singleton. * @@ -61,7 +44,6 @@ class CoreServiceProvider extends ServiceProvider { $loader = AliasLoader::getInstance(); $loader->alias('core', CoreFacade::class); - $this->app->singleton('core', function () { return new Core(); }); diff --git a/packages/Webkul/Customer/src/Providers/CustomerServiceProvider.php b/packages/Webkul/Customer/src/Providers/CustomerServiceProvider.php index f5cc64d94..fedbe7294 100644 --- a/packages/Webkul/Customer/src/Providers/CustomerServiceProvider.php +++ b/packages/Webkul/Customer/src/Providers/CustomerServiceProvider.php @@ -13,10 +13,6 @@ class CustomerServiceProvider extends ServiceProvider { public function boot(Router $router) { - $this->publishes([ - __DIR__ . '/../../publishable/assets' => public_path('vendor/webkul/customer/assets'), - ], 'public'); - $router->aliasMiddleware('customer', RedirectIfNotCustomer::class); $this->loadMigrationsFrom(__DIR__ . '/../Database/migrations'); diff --git a/packages/Webkul/Product/src/CacheFilters/Large.php b/packages/Webkul/Product/src/CacheFilters/Large.php new file mode 100644 index 000000000..bb71ee7f9 --- /dev/null +++ b/packages/Webkul/Product/src/CacheFilters/Large.php @@ -0,0 +1,14 @@ +resize(480, 480); + } +} \ No newline at end of file diff --git a/packages/Webkul/Product/src/CacheFilters/Medium.php b/packages/Webkul/Product/src/CacheFilters/Medium.php new file mode 100644 index 000000000..39ec33170 --- /dev/null +++ b/packages/Webkul/Product/src/CacheFilters/Medium.php @@ -0,0 +1,14 @@ +resize(280, 350); + } +} \ No newline at end of file diff --git a/packages/Webkul/Product/src/CacheFilters/Small.php b/packages/Webkul/Product/src/CacheFilters/Small.php new file mode 100644 index 000000000..a3698696c --- /dev/null +++ b/packages/Webkul/Product/src/CacheFilters/Small.php @@ -0,0 +1,14 @@ +resize(120, 120); + } +} \ No newline at end of file diff --git a/packages/Webkul/Product/src/Product/ConfigurableOption.php b/packages/Webkul/Product/src/Product/ConfigurableOption.php index 6cb84ad3d..216fd5408 100644 --- a/packages/Webkul/Product/src/Product/ConfigurableOption.php +++ b/packages/Webkul/Product/src/Product/ConfigurableOption.php @@ -3,7 +3,7 @@ namespace Webkul\Product\Product; use Webkul\Attribute\Repositories\AttributeOptionRepository as AttributeOption; -use Webkul\Product\Product\Gallery; +use Webkul\Product\Product\ProductImage; use Webkul\Product\Product\Price; class ConfigurableOption extends AbstractProduct @@ -16,11 +16,11 @@ class ConfigurableOption extends AbstractProduct protected $attributeOption; /** - * Gallery object + * ProductImage object * * @var array */ - protected $gallery; + protected $productImage; /** * Price object @@ -33,19 +33,19 @@ class ConfigurableOption extends AbstractProduct * Create a new controller instance. * * @param Webkul\Attribute\Repositories\AttributeOptionRepository $attributeOption - * @param Webkul\Product\Product\Gallery $gallery + * @param Webkul\Product\Product\ProductImage $productImage * @param Webkul\Product\Product\Price $price * @return void */ public function __construct( AttributeOption $attributeOption, - Gallery $gallery, + ProductImage $productImage, Price $price ) { $this->attributeOption = $attributeOption; - $this->gallery = $gallery; + $this->productImage = $productImage; $this->price = $price; } @@ -82,6 +82,10 @@ class ConfigurableOption extends AbstractProduct $config = [ 'attributes' => $this->getAttributesData($product, $options), 'index' => isset($options['index']) ? $options['index'] : [], + 'regular_price' => [ + 'formated_price' => core()->currency($this->price->getMinimalPrice($product)), + 'price' => $this->price->getMinimalPrice($product) + ], 'variant_prices' => $this->getVariantPrices($product), 'variant_images' => $this->getVariantImages($product), 'chooseText' => trans('shop::app.products.choose-option') @@ -201,8 +205,14 @@ class ConfigurableOption extends AbstractProduct foreach ($this->getAllowProducts($product) as $variant) { $prices[$variant->id] = [ - 'regular_price' => $variant->price, - 'final_price' => $this->price->getMinimalPrice($variant), + 'regular_price' => [ + 'formated_price' => core()->currency($variant->price), + 'price' => $variant->price + ], + 'final_price' => [ + 'formated_price' => core()->currency($this->price->getMinimalPrice($variant)), + 'price' => $this->price->getMinimalPrice($variant) + ] ]; } @@ -220,7 +230,7 @@ class ConfigurableOption extends AbstractProduct $images = []; foreach ($this->getAllowProducts($product) as $variant) { - $images[$variant->id] = $this->gallery->getImages($variant); + $images[$variant->id] = $this->productImage->getGalleryImages($variant); } return $images; diff --git a/packages/Webkul/Product/src/Product/Gallery.php b/packages/Webkul/Product/src/Product/Gallery.php deleted file mode 100644 index 7e47592c1..000000000 --- a/packages/Webkul/Product/src/Product/Gallery.php +++ /dev/null @@ -1,25 +0,0 @@ - '', - 'medium_image_url' => '', - 'large_image_url' => '', - ]; - - return $images; - } -} \ No newline at end of file diff --git a/packages/Webkul/Product/src/Product/ProductImage.php b/packages/Webkul/Product/src/Product/ProductImage.php new file mode 100644 index 000000000..1477144e9 --- /dev/null +++ b/packages/Webkul/Product/src/Product/ProductImage.php @@ -0,0 +1,72 @@ +images as $image) { + if(!Storage::has($image->path)) + continue; + + $images[] = [ + 'small_image_url' => url('cache/small/' . $image->path), + 'medium_image_url' => url('cache/medium/' . $image->path), + 'large_image_url' => url('cache/large/' . $image->path), + 'original_image_url' => url('cache/original/' . $image->path), + ]; + } + + if(!$product->parent_id && !count($images)) { + $images[] = [ + 'small_image_url' => bagisto_asset('images/product/small-product-placeholder.png'), + 'medium_image_url' => bagisto_asset('images/product/meduim-product-placeholder.png'), + 'large_image_url' => bagisto_asset('images/product/large-product-placeholder.png'), + 'original_image_url' => bagisto_asset('images/product/large-product-placeholder.png'), + ]; + } + + return $images; + } + + /** + * Get product's base image + * + * @param Product $product + * @return array + */ + public function getProductBaseImage($product) + { + $images = $product->images; + + if($images->count()) { + $image = [ + 'small_image_url' => url('cache/small/' . $images[0]->path), + 'medium_image_url' => url('cache/medium/' . $images[0]->path), + 'large_image_url' => url('cache/large/' . $images[0]->path), + 'original_image_url' => url('cache/original/' . $images[0]->path), + ]; + } else { + $image = [ + 'small_image_url' => bagisto_asset('images/product/small-product-placeholder.png'), + 'medium_image_url' => bagisto_asset('images/product/meduim-product-placeholder.png'), + 'large_image_url' => bagisto_asset('images/product/large-product-placeholder.png'), + 'original_image_url' => bagisto_asset('images/product/large-product-placeholder.png'), + ]; + } + + return $image; + } +} \ No newline at end of file diff --git a/packages/Webkul/Shop/src/Http/routes.php b/packages/Webkul/Shop/src/Http/routes.php index a960ff3dc..bbd99dd80 100644 --- a/packages/Webkul/Shop/src/Http/routes.php +++ b/packages/Webkul/Shop/src/Http/routes.php @@ -14,23 +14,6 @@ Route::group(['middleware' => ['web']], function () { 'view' => 'shop::customers.checkout.index' ])->name('shop.checkout'); - - /* dummy routes */ - Route::view('/customer/order','shop::customers.account.orders.index'); - - // Route::view('/customer/checkout','shop::customers.checkout.index'); - - Route::view('/customer/signin','shop::customers.checkout.signin'); - - Route::view('/customer/ship_method','shop::customers.checkout.ship-method'); - - Route::view('/customer/payment_method','shop::customers.checkout.payment-method'); - - Route::view('/customer/payment_complete','shop::customers.checkout.complete'); - - Route::view('/test','shop::index'); - - /* dummy routes ends here */ @@ -52,6 +35,10 @@ Route::group(['middleware' => ['web']], function () { 'redirect' => 'shop.reviews.index' ])->name('shop.reviews.store'); + Route::post('/reviews/create/{slug}', 'Webkul\Shop\Http\Controllers\ReviewController@store')->defaults('_config', [ + 'redirect' => 'admin.reviews.index' + ])->name('admin.reviews.store'); + // Route::post('/reviews/create/{slug}', 'Webkul\Core\Http\Controllers\ReviewController@store')->defaults('_config', [ // 'redirect' => 'admin.reviews.index' // ])->name('admin.reviews.store'); diff --git a/packages/Webkul/Shop/src/Resources/assets/images/product/large-product-placeholder.png b/packages/Webkul/Shop/src/Resources/assets/images/product/large-product-placeholder.png new file mode 100644 index 000000000..e839910cc Binary files /dev/null and b/packages/Webkul/Shop/src/Resources/assets/images/product/large-product-placeholder.png differ diff --git a/packages/Webkul/Shop/src/Resources/assets/images/product/meduim-product-placeholder.png b/packages/Webkul/Shop/src/Resources/assets/images/product/meduim-product-placeholder.png new file mode 100644 index 000000000..0aa66dc52 Binary files /dev/null and b/packages/Webkul/Shop/src/Resources/assets/images/product/meduim-product-placeholder.png differ diff --git a/packages/Webkul/Shop/src/Resources/assets/images/product/small-product-placeholder.png b/packages/Webkul/Shop/src/Resources/assets/images/product/small-product-placeholder.png new file mode 100644 index 000000000..8526a85f5 Binary files /dev/null and b/packages/Webkul/Shop/src/Resources/assets/images/product/small-product-placeholder.png differ diff --git a/packages/Webkul/Shop/src/Resources/assets/sass/app.scss b/packages/Webkul/Shop/src/Resources/assets/sass/app.scss index 0606f90fe..6b594e5c4 100644 --- a/packages/Webkul/Shop/src/Resources/assets/sass/app.scss +++ b/packages/Webkul/Shop/src/Resources/assets/sass/app.scss @@ -800,10 +800,18 @@ section.slider-block { .product-card { - .product-image img { - align-self: center; - width: 100%; - margin-bottom: 14px; + .product-image { + background: #F2F2F2; + margin-bottom: 10px; + // width: 380px; + // max-width: 100%; + // text-align: center; + + img { + align-self: center; + width: 100%; + margin-bottom: 14px; + } } .product-name { @@ -1336,9 +1344,10 @@ section.product-detail { } div.layouter { - display:flex; - flex-flow: row; - margin-top: 21px; + margin-top: 20px; + margin-bottom: 20px; + display: inline-block; + width: 100%; .mixed-group { @@ -1453,20 +1462,74 @@ section.product-detail { } div.product-image-group { - display:flex; - flex-direction: row; - justify-content: flex-start; - margin-right: 2.5%; + width: 43%; + float: left; + min-height: 1px; + position: relative; - .side-group { + .thumb-list { display: flex; flex-direction: column; margin-right: 4px; + height: 480px; + overflow: hidden; + position: relative; + float: left; + + .thumb-frame { + border: 2px solid transparent; + background: #F2F2F2; + width: 120px; + height: 120px; + + &.active { + border-color: #979797; + } + + img { + width: 100%; + height: 100%; + } + } + + .gallery-control { + width: 100%; + position: absolute; + text-align: center; + cursor: pointer; + z-index: 1; + + .overlay { + opacity: 0.3; + background: #000000; + width: 100%; + height: 18px; + position: absolute; + left: 0; + z-index: -1; + } + + .icon { + z-index: 2; + } + + &.top { + top: 0; + } + + &.bottom { + bottom: 0; + } + } } .product-hero-image { display: block; position: relative; + background: #F2F2F2; + width: 480px; + max-height: 480px; + float: left; .wishlist { position: absolute; @@ -1483,6 +1546,9 @@ section.product-detail { } .details { + width: 57%; + float: left; + .product-price { margin-bottom: 14px; } diff --git a/packages/Webkul/Shop/src/Resources/views/products/list/card.blade.php b/packages/Webkul/Shop/src/Resources/views/products/list/card.blade.php index 4a8597386..fcf42cf63 100644 --- a/packages/Webkul/Shop/src/Resources/views/products/list/card.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/products/list/card.blade.php @@ -1,7 +1,12 @@
+ + @inject ('productImageHelper', 'Webkul\Product\Product\ProductImage') + + getProductBaseImage($product); ?> +
- +
diff --git a/packages/Webkul/Shop/src/Resources/views/products/price.blade.php b/packages/Webkul/Shop/src/Resources/views/products/price.blade.php index dedfcc8a7..e47b15221 100644 --- a/packages/Webkul/Shop/src/Resources/views/products/price.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/products/price.blade.php @@ -6,7 +6,7 @@ {{ __('shop::app.products.price-label') }} - {{ core()->currency($priceHelper->getMinimalPrice($product)) }} + {{ core()->currency($priceHelper->getMinimalPrice($product)) }} @else diff --git a/packages/Webkul/Shop/src/Resources/views/products/view.blade.php b/packages/Webkul/Shop/src/Resources/views/products/view.blade.php index c42e1a245..d39dd2bb1 100644 --- a/packages/Webkul/Shop/src/Resources/views/products/view.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/products/view.blade.php @@ -10,13 +10,11 @@
-
+ @csrf() - - @include ('shop::products.view.gallery') diff --git a/packages/Webkul/Shop/src/Resources/views/products/view/configurable-options.blade.php b/packages/Webkul/Shop/src/Resources/views/products/view/configurable-options.blade.php index f6cad3173..1b545815c 100644 --- a/packages/Webkul/Shop/src/Resources/views/products/view/configurable-options.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/products/view/configurable-options.blade.php @@ -2,7 +2,6 @@ @inject ('configurableOptionHelper', 'Webkul\Product\Product\ConfigurableOption') - @push('scripts') @@ -10,39 +9,56 @@ + getConfigurationConfig($product) ?> + + + + +@endpush diff --git a/packages/Webkul/Ui/src/Resources/assets/images/down-arrow-white.svg b/packages/Webkul/Ui/src/Resources/assets/images/down-arrow-white.svg new file mode 100644 index 000000000..b80e0ae72 --- /dev/null +++ b/packages/Webkul/Ui/src/Resources/assets/images/down-arrow-white.svg @@ -0,0 +1,10 @@ + + + + down-arrow + Created with Sketch. + + + + + \ No newline at end of file diff --git a/packages/Webkul/Ui/src/Resources/assets/images/up-arrow-white.svg b/packages/Webkul/Ui/src/Resources/assets/images/up-arrow-white.svg new file mode 100644 index 000000000..468ad116f --- /dev/null +++ b/packages/Webkul/Ui/src/Resources/assets/images/up-arrow-white.svg @@ -0,0 +1,15 @@ + + + + up-arrow + Created with Sketch. + + + + + + + + + + \ No newline at end of file diff --git a/packages/Webkul/Ui/src/Resources/assets/sass/app.scss b/packages/Webkul/Ui/src/Resources/assets/sass/app.scss index 8fe339165..38583fc6a 100644 --- a/packages/Webkul/Ui/src/Resources/assets/sass/app.scss +++ b/packages/Webkul/Ui/src/Resources/assets/sass/app.scss @@ -993,6 +993,7 @@ h2 { background-image: url("../images/placeholder-icon.svg"); background-repeat: no-repeat; background-position: center; + margin-bottom: 20px; img.preview { width: 100%; diff --git a/packages/Webkul/Ui/src/Resources/assets/sass/icons.scss b/packages/Webkul/Ui/src/Resources/assets/sass/icons.scss index 178c84342..610a5c338 100644 --- a/packages/Webkul/Ui/src/Resources/assets/sass/icons.scss +++ b/packages/Webkul/Ui/src/Resources/assets/sass/icons.scss @@ -168,6 +168,18 @@ height: 24px; } +.arrow-down-white-icon { + background-image: url("../images/down-arrow-white.svg"); + width: 17px; + height: 13px; +} + +.arrow-up-white-icon { + background-image: url("../images/up-arrow-white.svg"); + width: 17px; + height: 13px; +} + .active { .dashboard-icon { background-image: url("../images/Icon-Dashboard-Active.svg"); diff --git a/packages/Webkul/User/src/Bouncer.php b/packages/Webkul/User/src/Bouncer.php index 0a22518d9..4d3196e31 100644 --- a/packages/Webkul/User/src/Bouncer.php +++ b/packages/Webkul/User/src/Bouncer.php @@ -4,6 +4,20 @@ namespace Webkul\User; class Bouncer { + /** + * Checks if user has permission for certain action + * + * @param String $permission + * @return Void + */ + public static function hasPermission($permission) + { + if(!auth()->check() || !auth()->user()->hasPermission($permission)) + return false; + + return true; + } + /** * Checks if user allowed or not for certain action * diff --git a/public/themes/default/assets/css/shop.css b/public/themes/default/assets/css/shop.css index 5c1e1e14b..efb69f365 100644 --- a/public/themes/default/assets/css/shop.css +++ b/public/themes/default/assets/css/shop.css @@ -849,6 +849,11 @@ section.slider-block div.slider-content div.slider-control .light-right-icon { justify-content: center; } +.main-container-wrapper .product-card .product-image { + background: #F2F2F2; + margin-bottom: 10px; +} + .main-container-wrapper .product-card .product-image img { -ms-flex-item-align: center; align-self: center; @@ -1409,14 +1414,10 @@ section.product-detail div.category-breadcrumbs { } section.product-detail div.layouter { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-flow: row; - flex-flow: row; - margin-top: 21px; + margin-top: 20px; + margin-bottom: 20px; + display: inline-block; + width: 100%; } section.product-detail div.layouter .mixed-group .single-image { @@ -1547,20 +1548,13 @@ section.product-detail div.layouter .rating-reviews .reviews .view-all { } section.product-detail div.layouter div.product-image-group { - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-direction: row; - flex-direction: row; - -webkit-box-pack: start; - -ms-flex-pack: start; - justify-content: flex-start; - margin-right: 2.5%; + width: 43%; + float: left; + min-height: 1px; + position: relative; } -section.product-detail div.layouter div.product-image-group .side-group { +section.product-detail div.layouter div.product-image-group .thumb-list { display: -webkit-box; display: -ms-flexbox; display: flex; @@ -1569,11 +1563,65 @@ section.product-detail div.layouter div.product-image-group .side-group { -ms-flex-direction: column; flex-direction: column; margin-right: 4px; + height: 480px; + overflow: hidden; + position: relative; + float: left; +} + +section.product-detail div.layouter div.product-image-group .thumb-list .thumb-frame { + border: 2px solid transparent; + background: #F2F2F2; + width: 120px; + height: 120px; +} + +section.product-detail div.layouter div.product-image-group .thumb-list .thumb-frame.active { + border-color: #979797; +} + +section.product-detail div.layouter div.product-image-group .thumb-list .thumb-frame img { + width: 100%; + height: 100%; +} + +section.product-detail div.layouter div.product-image-group .thumb-list .gallery-control { + width: 100%; + position: absolute; + text-align: center; + cursor: pointer; + z-index: 1; +} + +section.product-detail div.layouter div.product-image-group .thumb-list .gallery-control .overlay { + opacity: 0.3; + background: #000000; + width: 100%; + height: 18px; + position: absolute; + left: 0; + z-index: -1; +} + +section.product-detail div.layouter div.product-image-group .thumb-list .gallery-control .icon { + z-index: 2; +} + +section.product-detail div.layouter div.product-image-group .thumb-list .gallery-control.top { + top: 0; +} + +section.product-detail div.layouter div.product-image-group .thumb-list .gallery-control.bottom { + bottom: 0; } section.product-detail div.layouter div.product-image-group .product-hero-image { display: block; position: relative; + background: #F2F2F2; + width: 480px; + max-height: 480px; + float: left; } section.product-detail div.layouter div.product-image-group .product-hero-image .wishlist { @@ -1588,6 +1636,11 @@ section.product-detail div.layouter div.product-image-group .product-hero-image right: 45px; } +section.product-detail div.layouter .details { + width: 57%; + float: left; +} + section.product-detail div.layouter .details .product-price { margin-bottom: 14px; } diff --git a/public/themes/default/assets/images/product/large-product-placeholder.png b/public/themes/default/assets/images/product/large-product-placeholder.png new file mode 100644 index 000000000..e839910cc Binary files /dev/null and b/public/themes/default/assets/images/product/large-product-placeholder.png differ diff --git a/public/themes/default/assets/images/product/meduim-product-placeholder.png b/public/themes/default/assets/images/product/meduim-product-placeholder.png new file mode 100644 index 000000000..0aa66dc52 Binary files /dev/null and b/public/themes/default/assets/images/product/meduim-product-placeholder.png differ diff --git a/public/themes/default/assets/images/product/small-product-placeholder.png b/public/themes/default/assets/images/product/small-product-placeholder.png new file mode 100644 index 000000000..8526a85f5 Binary files /dev/null and b/public/themes/default/assets/images/product/small-product-placeholder.png differ