- {{ __('admin::app.settings.development.webconsole') }} -
-- -
-diff --git a/.env.example b/.env.example index 76b6ac73c..bb471ec98 100644 --- a/.env.example +++ b/.env.example @@ -13,6 +13,7 @@ DB_PORT=3306 DB_DATABASE= DB_USERNAME= DB_PASSWORD= +DB_PREFIX= BROADCAST_DRIVER=log CACHE_DRIVER=file diff --git a/.env.testing b/.env.testing new file mode 100644 index 000000000..6b1104008 --- /dev/null +++ b/.env.testing @@ -0,0 +1,45 @@ +APP_NAME=Bagisto +APP_ENV=local +APP_VERSION=0.1.8 +APP_KEY=base64:NFtGjjFAqET6RlX3PVC/gFpzHb4jK1OxDc3cuU5Asz4= +APP_DEBUG=true +APP_URL=http://localhost + +LOG_CHANNEL=stack + +DB_CONNECTION=mysql +DB_HOST=mysql +DB_PORT=3306 +DB_DATABASE=bagisto_test +DB_USERNAME=root +DB_PASSWORD=root + +BROADCAST_DRIVER=log +CACHE_DRIVER=file +SESSION_DRIVER=file +SESSION_LIFETIME=20 +QUEUE_DRIVER=sync + +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_DRIVER=smtp +MAIL_HOST=smtp.mailtrap.io +MAIL_PORT=2525 +MAIL_USERNAME= +MAIL_PASSWORD= +MAIL_ENCRYPTION=tls + +SHOP_MAIL_FROM= +ADMIN_MAIL_TO= + +fixer_api_key= + +PUSHER_APP_ID= +PUSHER_APP_KEY= +PUSHER_APP_SECRET= +PUSHER_APP_CLUSTER=mt1 + +MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" +MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" diff --git a/codeception.yml b/codeception.yml new file mode 100644 index 000000000..f0446cc8a --- /dev/null +++ b/codeception.yml @@ -0,0 +1,10 @@ +paths: + tests: tests + output: tests/_output + data: tests/_data + support: tests/_support + envs: tests/_envs +actor_suffix: Tester +extensions: + enabled: + - Codeception\Extension\RunFailed diff --git a/composer.json b/composer.json index 06554c6dc..04f267c58 100755 --- a/composer.json +++ b/composer.json @@ -36,6 +36,7 @@ }, "require-dev": { + "codeception/codeception": "3.1.*", "barryvdh/laravel-debugbar": "^3.1", "filp/whoops": "^2.0", "fzaninotto/faker": "^1.4", @@ -125,6 +126,12 @@ "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover" + ], + "test": [ + "set -e", + "@php artisan migrate:fresh --env=testing", + "vendor/bin/codecept run unit", + "vendor/bin/codecept run functional" ] }, "config": { @@ -132,5 +139,6 @@ "sort-packages": true, "optimize-autoloader": true }, - "minimum-stability": "dev" + "minimum-stability": "dev", + "prefer-stable": true } diff --git a/config/database.php b/config/database.php index 71280b1b1..e84936069 100755 --- a/config/database.php +++ b/config/database.php @@ -36,7 +36,7 @@ return [ 'sqlite' => [ 'driver' => 'sqlite', 'database' => env('DB_DATABASE', database_path('database.sqlite')), - 'prefix' => '', + 'prefix' => env('DB_PREFIX'), ], 'mysql' => [ @@ -49,7 +49,7 @@ return [ 'unix_socket' => env('DB_SOCKET', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => '', + 'prefix' => env('DB_PREFIX'), 'strict' => false, 'engine' => 'InnoDB ROW_FORMAT=DYNAMIC', ], @@ -62,7 +62,7 @@ return [ 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', - 'prefix' => '', + 'prefix' => env('DB_PREFIX'), 'schema' => 'public', 'sslmode' => 'prefer', ], diff --git a/packages/Webkul/Admin/src/DataGrids/AddressDataGrid.php b/packages/Webkul/Admin/src/DataGrids/AddressDataGrid.php index 4c2de244c..ac7bbc749 100644 --- a/packages/Webkul/Admin/src/DataGrids/AddressDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/AddressDataGrid.php @@ -28,19 +28,19 @@ class AddressDataGrid extends DataGrid * @var object */ protected $customer; - + /** * Create a new controller instance. * * @param Webkul\Customer\Repositories\CustomerRepository $customer * @return void */ - public function __construct( + public function __construct( Customer $customer ) { parent::__construct(); - + $this->customer = $customer; } @@ -52,7 +52,7 @@ class AddressDataGrid extends DataGrid $queryBuilder = DB::table('customer_addresses as ca') ->leftJoin('countries', 'ca.country', '=', 'countries.code') ->leftJoin('customers as c', 'ca.customer_id', '=', 'c.id') - ->addSelect('ca.id as address_id', 'ca.address1', 'ca.country', DB::raw('countries.name as country_name'), 'ca.state', 'ca.city', 'ca.postcode', 'ca.phone', 'ca.default_address') + ->addSelect('ca.id as address_id', 'ca.address1', 'ca.country', DB::raw(''.DB::getTablePrefix().'countries.name as country_name'), 'ca.state', 'ca.city', 'ca.postcode', 'ca.phone', 'ca.default_address') ->where('c.id', $customer->id); $queryBuilder = $queryBuilder->leftJoin('country_states', function($qb) { @@ -62,13 +62,13 @@ class AddressDataGrid extends DataGrid $queryBuilder ->groupBy('ca.id') - ->addSelect(DB::raw('country_states.default_name as state_name')); + ->addSelect(DB::raw(''.DB::getTablePrefix().'country_states.default_name as state_name')); $this->addFilter('address_id', 'ca.id'); $this->addFilter('address1', 'ca.address1'); $this->addFilter('city', 'ca.city'); - $this->addFilter('state_name', DB::raw('country_states.default_name')); - $this->addFilter('country_name', DB::raw('countries.name')); + $this->addFilter('state_name', DB::raw(''.DB::getTablePrefix().'country_states.default_name')); + $this->addFilter('country_name', DB::raw(''.DB::getTablePrefix().'countries.name')); $this->addFilter('postcode', 'ca.postcode'); $this->addFilter('default_address', 'ca.default_address'); diff --git a/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php index 7073e047c..98f7152a7 100755 --- a/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CategoryDataGrid.php @@ -21,7 +21,7 @@ class CategoryDataGrid extends DataGrid { $queryBuilder = DB::table('categories as cat') ->select('cat.id as category_id', 'ct.name', 'cat.position', 'cat.status', 'ct.locale', - DB::raw('COUNT(DISTINCT pc.product_id) as count')) + DB::raw('COUNT(DISTINCT '.DB::getTablePrefix().'pc.product_id) as count')) ->leftJoin('category_translations as ct', function($leftJoin) { $leftJoin->on('cat.id', '=', 'ct.category_id') ->where('ct.locale', app()->getLocale()); diff --git a/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php b/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php index 6952abca6..beba7a4b9 100755 --- a/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/CustomerDataGrid.php @@ -25,10 +25,10 @@ class CustomerDataGrid extends DataGrid $queryBuilder = DB::table('customers') ->leftJoin('customer_groups', 'customers.customer_group_id', '=', 'customer_groups.id') ->addSelect('customers.id as customer_id', 'customers.email', 'customer_groups.name', 'customers.phone', 'customers.gender', 'status') - ->addSelect(DB::raw('CONCAT(customers.first_name, " ", customers.last_name) as full_name')); + ->addSelect(DB::raw('CONCAT('.DB::getTablePrefix().'customers.first_name, " ", '.DB::getTablePrefix().'customers.last_name) as full_name')); $this->addFilter('customer_id', 'customers.id'); - $this->addFilter('full_name', DB::raw('CONCAT(customers.first_name, " ", customers.last_name)')); + $this->addFilter('full_name', DB::raw('CONCAT('.DB::getTablePrefix().'customers.first_name, " ", '.DB::getTablePrefix().'customers.last_name)')); $this->addFilter('phone', 'customers.phone'); $this->addFilter('gender', 'customers.gender'); diff --git a/packages/Webkul/Admin/src/DataGrids/OrderDataGrid.php b/packages/Webkul/Admin/src/DataGrids/OrderDataGrid.php index aa2d91b68..7b8049f84 100755 --- a/packages/Webkul/Admin/src/DataGrids/OrderDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/OrderDataGrid.php @@ -29,11 +29,11 @@ class OrderDataGrid extends DataGrid ->where('order_address_billing.address_type', 'billing'); }) ->addSelect('orders.id','orders.increment_id', 'orders.base_sub_total', 'orders.base_grand_total', 'orders.created_at', 'channel_name', 'status') - ->addSelect(DB::raw('CONCAT(order_address_billing.first_name, " ", order_address_billing.last_name) as billed_to')) - ->addSelect(DB::raw('CONCAT(order_address_shipping.first_name, " ", order_address_shipping.last_name) as shipped_to')); + ->addSelect(DB::raw('CONCAT('.DB::getTablePrefix().'order_address_billing.first_name, " ", '.DB::getTablePrefix().'order_address_billing.last_name) as billed_to')) + ->addSelect(DB::raw('CONCAT('.DB::getTablePrefix().'order_address_shipping.first_name, " ", '.DB::getTablePrefix().'order_address_shipping.last_name) as shipped_to')); - $this->addFilter('billed_to', DB::raw('CONCAT(order_address_billing.first_name, " ", order_address_billing.last_name)')); - $this->addFilter('shipped_to', DB::raw('CONCAT(order_address_shipping.first_name, " ", order_address_shipping.last_name)')); + $this->addFilter('billed_to', DB::raw('CONCAT('.DB::getTablePrefix().'order_address_billing.first_name, " ", '.DB::getTablePrefix().'order_address_billing.last_name)')); + $this->addFilter('shipped_to', DB::raw('CONCAT('.DB::getTablePrefix().'order_address_shipping.first_name, " ", '.DB::getTablePrefix().'order_address_shipping.last_name)')); $this->addFilter('increment_id', 'orders.increment_id'); $this->addFilter('created_at', 'orders.created_at'); diff --git a/packages/Webkul/Admin/src/DataGrids/OrderRefundDataGrid.php b/packages/Webkul/Admin/src/DataGrids/OrderRefundDataGrid.php index 2e4b09a37..2c425cb70 100755 --- a/packages/Webkul/Admin/src/DataGrids/OrderRefundDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/OrderRefundDataGrid.php @@ -26,9 +26,9 @@ class OrderRefundDataGrid extends DataGrid $leftJoin->on('order_address_billing.order_id', '=', 'orders.id') ->where('order_address_billing.address_type', 'billing'); }) - ->addSelect(DB::raw('CONCAT(order_address_billing.first_name, " ", order_address_billing.last_name) as billed_to')); + ->addSelect(DB::raw('CONCAT('.DB::getTablePrefix().'order_address_billing.first_name, " ", '.DB::getTablePrefix().'order_address_billing.last_name) as billed_to')); - $this->addFilter('billed_to', DB::raw('CONCAT(order_address_billing.first_name, " ", order_address_billing.last_name)')); + $this->addFilter('billed_to', DB::raw('CONCAT('.DB::getTablePrefix().'order_address_billing.first_name, " ", '.DB::getTablePrefix().'order_address_billing.last_name)')); $this->addFilter('id', 'refunds.id'); $this->addFilter('increment_id', 'orders.increment_id'); $this->addFilter('state', 'refunds.state'); diff --git a/packages/Webkul/Admin/src/DataGrids/OrderShipmentsDataGrid.php b/packages/Webkul/Admin/src/DataGrids/OrderShipmentsDataGrid.php index 9c94dbf69..c6a30567f 100755 --- a/packages/Webkul/Admin/src/DataGrids/OrderShipmentsDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/OrderShipmentsDataGrid.php @@ -27,7 +27,7 @@ class OrderShipmentsDataGrid extends DataGrid ->leftJoin('orders as ors', 'shipments.order_id', '=', 'ors.id') ->leftJoin('inventory_sources as is', 'shipments.inventory_source_id', '=', 'is.id') ->select('shipments.id as shipment_id', 'ors.increment_id as shipment_order_id', 'shipments.total_qty as shipment_total_qty', 'is.name as inventory_source_name', 'ors.created_at as order_date', 'shipments.created_at as shipment_created_at') - ->addSelect(DB::raw('CONCAT(order_address_shipping.first_name, " ", order_address_shipping.last_name) as shipped_to')); + ->addSelect(DB::raw('CONCAT('.DB::getTablePrefix().'order_address_shipping.first_name, " ", '.DB::getTablePrefix().'order_address_shipping.last_name) as shipped_to')); $this->addFilter('shipment_id', 'shipments.id'); $this->addFilter('shipment_order_id', 'ors.increment_id'); @@ -35,7 +35,7 @@ class OrderShipmentsDataGrid extends DataGrid $this->addFilter('inventory_source_name', 'is.name'); $this->addFilter('order_date', 'ors.created_at'); $this->addFilter('shipment_created_at', 'shipments.created_at'); - $this->addFilter('shipped_to', DB::raw('CONCAT(order_address_shipping.first_name, " ", order_address_shipping.last_name)')); + $this->addFilter('shipped_to', DB::raw(''.DB::getTablePrefix().'CONCAT(order_address_shipping.first_name, " ", '.DB::getTablePrefix().'order_address_shipping.last_name)')); $this->setQueryBuilder($queryBuilder); } diff --git a/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php b/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php index bac760717..52f7318d4 100644 --- a/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php +++ b/packages/Webkul/Admin/src/DataGrids/ProductDataGrid.php @@ -25,7 +25,7 @@ class ProductDataGrid extends DataGrid ->leftJoin('products', 'product_flat.product_id', '=', 'products.id') ->leftJoin('attribute_families', 'products.attribute_family_id', '=', 'attribute_families.id') ->leftJoin('product_inventories', 'product_flat.product_id', '=', 'product_inventories.product_id') - ->select('product_flat.product_id as product_id', 'product_flat.sku as product_sku', 'product_flat.name as product_name', 'products.type as product_type', 'product_flat.status', 'product_flat.price', 'attribute_families.name as attribute_family', DB::raw('SUM(product_inventories.qty) as quantity')) + ->select('product_flat.product_id as product_id', 'product_flat.sku as product_sku', 'product_flat.name as product_name', 'products.type as product_type', 'product_flat.status', 'product_flat.price', 'attribute_families.name as attribute_family', DB::raw('SUM('.DB::getTablePrefix().'product_inventories.qty) as quantity')) ->where('channel', core()->getCurrentChannelCode()) ->where('locale', app()->getLocale()) ->groupBy('product_flat.product_id'); @@ -152,7 +152,7 @@ class ProductDataGrid extends DataGrid public function prepareMassActions() { $this->addMassAction([ 'type' => 'delete', - 'label' => 'Delete', + 'label' => 'Delete', 'action' => route('admin.catalog.products.massdelete'), 'method' => 'DELETE' ]); diff --git a/packages/Webkul/Admin/src/Http/Controllers/ConfigurationController.php b/packages/Webkul/Admin/src/Http/Controllers/ConfigurationController.php index aaaec0503..30ab97908 100755 --- a/packages/Webkul/Admin/src/Http/Controllers/ConfigurationController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/ConfigurationController.php @@ -120,6 +120,10 @@ class ConfigurationController extends Controller { Event::fire('core.configuration.save.before'); + $this->validate(request(), [ + 'general.design.admin_logo.logo_image' => 'mimes:jpeg,bmp,png,jpg' + ]); + $this->coreConfigRepository->create(request()->all()); Event::fire('core.configuration.save.after'); diff --git a/packages/Webkul/Admin/src/Http/Controllers/DashboardController.php b/packages/Webkul/Admin/src/Http/Controllers/DashboardController.php index b9d3d47ba..c77a66a73 100755 --- a/packages/Webkul/Admin/src/Http/Controllers/DashboardController.php +++ b/packages/Webkul/Admin/src/Http/Controllers/DashboardController.php @@ -186,7 +186,7 @@ class DashboardController extends Controller ->where('order_items.created_at', '>=', $this->startDate) ->where('order_items.created_at', '<=', $this->endDate) ->addSelect(DB::raw('SUM(qty_invoiced - qty_refunded) as total_qty_invoiced')) - ->addSelect(DB::raw('COUNT(products.id) as total_products')) + ->addSelect(DB::raw('COUNT('.DB::getTablePrefix().'products.id) as total_products')) ->addSelect('order_items.id', 'categories.id as category_id', 'category_translations.name') ->groupBy('categories.id') ->havingRaw('SUM(qty_invoiced - qty_refunded) > 0') diff --git a/packages/Webkul/Admin/src/Resources/lang/ar/app.php b/packages/Webkul/Admin/src/Resources/lang/ar/app.php index 50f5f977d..b2ac14466 100644 --- a/packages/Webkul/Admin/src/Resources/lang/ar/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/ar/app.php @@ -729,7 +729,6 @@ return [ ], 'development' => [ 'title' => 'تطوير', - 'webconsole' => 'وحدة تحكم الويب', ] ], diff --git a/packages/Webkul/Admin/src/Resources/lang/en/app.php b/packages/Webkul/Admin/src/Resources/lang/en/app.php index c45e11962..4578ecd53 100755 --- a/packages/Webkul/Admin/src/Resources/lang/en/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/en/app.php @@ -839,7 +839,6 @@ return [ ], 'development' => [ 'title' => 'Development', - 'webconsole' => 'Web Console', ] ], diff --git a/packages/Webkul/Admin/src/Resources/lang/fa/app.php b/packages/Webkul/Admin/src/Resources/lang/fa/app.php index d2e1db49e..8c12fc9d8 100644 --- a/packages/Webkul/Admin/src/Resources/lang/fa/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/fa/app.php @@ -764,7 +764,6 @@ return [ ], 'development' => [ 'title' => 'توسعه', - 'webconsole' => 'کنسول وب', ] ], diff --git a/packages/Webkul/Admin/src/Resources/lang/pt_BR/app.php b/packages/Webkul/Admin/src/Resources/lang/pt_BR/app.php index 3bf3b157a..3d543a1f7 100755 --- a/packages/Webkul/Admin/src/Resources/lang/pt_BR/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/pt_BR/app.php @@ -755,7 +755,6 @@ return [ ], 'development' => [ 'title' => 'Desenvolvimento', - 'webconsole' => 'Console da Web', ] ], 'customers' => [ diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/products/create.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/products/create.blade.php index c3ff363e0..7308fd5c1 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/products/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/products/create.blade.php @@ -64,7 +64,7 @@ @if ($familyId) - + @endif @{{ errors.first('type') }} diff --git a/packages/Webkul/Admin/src/Resources/views/settings/development/dashboard.blade.php b/packages/Webkul/Admin/src/Resources/views/settings/development/dashboard.blade.php index 1b4bcc7ae..1eaf61ad0 100755 --- a/packages/Webkul/Admin/src/Resources/views/settings/development/dashboard.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/settings/development/dashboard.blade.php @@ -13,16 +13,7 @@
@stop \ No newline at end of file diff --git a/packages/Webkul/CMS/src/Http/Controllers/Admin/PageController.php b/packages/Webkul/CMS/src/Http/Controllers/Admin/PageController.php index 8af28df46..814f7ae00 100644 --- a/packages/Webkul/CMS/src/Http/Controllers/Admin/PageController.php +++ b/packages/Webkul/CMS/src/Http/Controllers/Admin/PageController.php @@ -40,7 +40,9 @@ use Webkul\Core\Repositories\LocaleRepository as Locale; /** * Pass the class instance through admin middleware */ - $this->middleware('auth:admin'); + // $this->middleware('auth:admin'); + + $this->middleware('admin'); /** * Channel repository instance diff --git a/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php b/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php index 24790355f..9e6fa86b5 100755 --- a/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php @@ -59,15 +59,12 @@ class WishlistController extends Controller /** * Displays the listing resources if the customer having items in wishlist. - * + * * @return \Illuminate\View\View */ public function index() { - $wishlistItems = $this->wishlistRepository->findWhere([ - 'channel_id' => core()->getCurrentChannel()->id, - 'customer_id' => auth()->guard('customer')->user()->id] - ); + $wishlistItems = $this->wishlistRepository->getCustomerWhishlist(); return view($this->_config['view'])->with('items', $wishlistItems); } diff --git a/packages/Webkul/Customer/src/Repositories/WishlistRepository.php b/packages/Webkul/Customer/src/Repositories/WishlistRepository.php index cd25ef3ed..a491d3828 100755 --- a/packages/Webkul/Customer/src/Repositories/WishlistRepository.php +++ b/packages/Webkul/Customer/src/Repositories/WishlistRepository.php @@ -62,8 +62,7 @@ class WishlistRepository extends Repository return $this->model->find($id)->item_wishlist; } - - /** + /** * get customer wishlist Items. * * @return mixed diff --git a/packages/Webkul/Product/src/Helpers/Review.php b/packages/Webkul/Product/src/Helpers/Review.php index ff3b5394d..6d109f729 100755 --- a/packages/Webkul/Product/src/Helpers/Review.php +++ b/packages/Webkul/Product/src/Helpers/Review.php @@ -40,7 +40,7 @@ class Review extends AbstractProduct if(array_key_exists($product->id, $avgRating)) return $avgRating[$product->id]; - return $avgRating[$product->id] = number_format(round($product->reviews()->where('status', 'approved')->average('rating'), 2), 1); + return $avgRating[$product->id] = number_format(round($product->reviews()->where('status', 'approved')->avg('rating'), 2), 1); } /** diff --git a/packages/Webkul/Product/src/Type/Configurable.php b/packages/Webkul/Product/src/Type/Configurable.php index 6977bf5de..e0f1c3eea 100644 --- a/packages/Webkul/Product/src/Type/Configurable.php +++ b/packages/Webkul/Product/src/Type/Configurable.php @@ -143,9 +143,15 @@ class Configurable extends AbstractType ]; } + $typeOfVariants = 'simple'; + $productInstance = app(config('product_types.' . $product->type . '.class')); + if (isset($productInstance->variantsType) && ! in_array($productInstance->variantsType , ['bundle', 'configurable', 'grouped'])) { + $typeOfVariants = $productInstance->variantsType; + } + $variant = $this->productRepository->getModel()->create([ 'parent_id' => $product->id, - 'type' => 'simple', + 'type' => $typeOfVariants, 'attribute_family_id' => $product->attribute_family_id, 'sku' => $data['sku'], ]); diff --git a/packages/Webkul/Sales/src/Repositories/DownloadableLinkPurchasedRepository.php b/packages/Webkul/Sales/src/Repositories/DownloadableLinkPurchasedRepository.php index 8af93c227..84715fdbe 100644 --- a/packages/Webkul/Sales/src/Repositories/DownloadableLinkPurchasedRepository.php +++ b/packages/Webkul/Sales/src/Repositories/DownloadableLinkPurchasedRepository.php @@ -55,7 +55,7 @@ class DownloadableLinkPurchasedRepository extends Repository */ public function saveLinks($orderItem) { - if ($orderItem->type != 'downloadable' || ! isset($orderItem->additional['links'])) + if (stristr($orderItem->type,'downloadable') === false || ! isset($orderItem->additional['links'])) return; foreach ($orderItem->additional['links'] as $linkId) { diff --git a/packages/Webkul/Sales/src/Repositories/OrderRepository.php b/packages/Webkul/Sales/src/Repositories/OrderRepository.php index c5fca17c1..235a0a1a2 100755 --- a/packages/Webkul/Sales/src/Repositories/OrderRepository.php +++ b/packages/Webkul/Sales/src/Repositories/OrderRepository.php @@ -198,22 +198,20 @@ class OrderRepository extends Repository { $config = new CoreConfig(); - foreach ([ - 'Prefix' => 'prefix', - 'Length' => 'length', - 'Suffix' => 'suffix', - ] as $varSuffix => $confKey) { - $var = "invoiceNumber{$varSuffix}"; - $$var = $config - ->where('code', '=', "sales.orderSettings.order_number.order_number_{$confKey}") - ->first() ?: false; - } + foreach ([ 'Prefix' => 'prefix', + 'Length' => 'length', + 'Suffix' => 'suffix', ] as + $varSuffix => $confKey) + { + $var = "invoiceNumber{$varSuffix}"; + $$var = $config->where('code', '=', "sales.orderSettings.order_number.order_number_{$confKey}")->first() ?: false; + } $lastOrder = $this->model->orderBy('id', 'desc')->limit(1)->first(); $lastId = $lastOrder ? $lastOrder->id : 0; if ($invoiceNumberLength && ($invoiceNumberPrefix || $invoiceNumberSuffix)) { - $invoiceNumber = $invoiceNumberPrefix . sprintf("%0{$invoiceNumberLength}d", 0) . ($lastId + 1) . $invoiceNumberSuffix; + $invoiceNumber = ($invoiceNumberPrefix->value) . sprintf("%0{$invoiceNumberLength->value}d", 0) . ($lastId + 1) . ($invoiceNumberSuffix->value); } else { $invoiceNumber = $lastId + 1; } diff --git a/packages/Webkul/Shop/src/DataGrids/DownloadableProductDataGrid.php b/packages/Webkul/Shop/src/DataGrids/DownloadableProductDataGrid.php index 74906ae24..ced3940c6 100644 --- a/packages/Webkul/Shop/src/DataGrids/DownloadableProductDataGrid.php +++ b/packages/Webkul/Shop/src/DataGrids/DownloadableProductDataGrid.php @@ -22,7 +22,7 @@ class DownloadableProductDataGrid extends DataGrid $queryBuilder = DB::table('downloadable_link_purchased') ->leftJoin('orders', 'downloadable_link_purchased.order_id', '=', 'orders.id') ->addSelect('downloadable_link_purchased.*', 'orders.increment_id') - ->addSelect(DB::raw('(downloadable_link_purchased.download_bought - downloadable_link_purchased.download_used) as remaining_downloads')) + ->addSelect(DB::raw('('.DB::getTablePrefix().'downloadable_link_purchased.download_bought - '.DB::getTablePrefix().'downloadable_link_purchased.download_used) as remaining_downloads')) ->where('downloadable_link_purchased.customer_id', auth()->guard('customer')->user()->id); $this->addFilter('status', 'downloadable_link_purchased.status'); @@ -97,7 +97,7 @@ class DownloadableProductDataGrid extends DataGrid 'wrapper' => function ($value) { if (! $value->download_bought) return trans('shop::app.customer.account.downloadable_products.unlimited'); - + return $value->remaining_downloads; }, ]); diff --git a/packages/Webkul/Shop/src/Http/Controllers/OrderController.php b/packages/Webkul/Shop/src/Http/Controllers/OrderController.php index a254c056e..806edee66 100644 --- a/packages/Webkul/Shop/src/Http/Controllers/OrderController.php +++ b/packages/Webkul/Shop/src/Http/Controllers/OrderController.php @@ -60,7 +60,7 @@ class OrderController extends Controller /** * Display a listing of the resource. * - * @return \Illuminate\View\View + * @return \Illuminate\View\View */ public function index() { @@ -71,7 +71,7 @@ class OrderController extends Controller * Show the view for the specified resource. * * @param int $id - * @return \Illuminate\View\View + * @return \Illuminate\View\View */ public function view($id) { diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/onepage.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/onepage.blade.php index b7b243670..0433dbf2a 100755 --- a/packages/Webkul/Shop/src/Resources/views/checkout/onepage.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/onepage.blade.php @@ -296,7 +296,7 @@ else paymentHtml = Vue.compile(response.data.html) - this_this.completed_step = this_this.step_numbers[response.data.jump_to_section] + 1; + this_this.completed_step = this_this.step_numbers[response.data.jump_to_section] - 1; this_this.current_step = this_this.step_numbers[response.data.jump_to_section]; shippingMethods = response.data.shippingMethods; @@ -320,7 +320,7 @@ this_this.disable_button = false; paymentHtml = Vue.compile(response.data.html) - this_this.completed_step = this_this.step_numbers[response.data.jump_to_section] + 1; + this_this.completed_step = this_this.step_numbers[response.data.jump_to_section] - 1; this_this.current_step = this_this.step_numbers[response.data.jump_to_section]; paymentMethods = response.data.paymentMethods; @@ -344,7 +344,7 @@ this_this.disable_button = false; reviewHtml = Vue.compile(response.data.html) - this_this.completed_step = this_this.step_numbers[response.data.jump_to_section] + 1; + this_this.completed_step = this_this.step_numbers[response.data.jump_to_section] - 1; this_this.current_step = this_this.step_numbers[response.data.jump_to_section]; this_this.getOrderSummary(); diff --git a/packages/Webkul/Shop/src/Resources/views/customers/account/reviews/index.blade.php b/packages/Webkul/Shop/src/Resources/views/customers/account/reviews/index.blade.php index 93dbb7c65..0e24927d6 100755 --- a/packages/Webkul/Shop/src/Resources/views/customers/account/reviews/index.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/customers/account/reviews/index.blade.php @@ -19,7 +19,7 @@ @if (count($reviews) > 1)