diff --git a/packages/Webkul/Product/src/Models/Product.php b/packages/Webkul/Product/src/Models/Product.php index 86acea5a1..be98c2cf8 100755 --- a/packages/Webkul/Product/src/Models/Product.php +++ b/packages/Webkul/Product/src/Models/Product.php @@ -2,11 +2,15 @@ namespace Webkul\Product\Models; +use Exception; +use Webkul\Product\Type\AbstractType; use Illuminate\Database\Eloquent\Model; -use Webkul\Attribute\Models\AttributeFamilyProxy; use Webkul\Category\Models\CategoryProxy; use Webkul\Attribute\Models\AttributeProxy; +use Webkul\Product\Database\Eloquent\Builder; +use Webkul\Attribute\Models\AttributeFamilyProxy; use Webkul\Inventory\Models\InventorySourceProxy; +use Webkul\Attribute\Repositories\AttributeRepository; use Webkul\Product\Contracts\Product as ProductContract; class Product extends Model implements ProductContract @@ -59,7 +63,8 @@ class Product extends Model implements ProductContract } /** - * Get the product variants that owns the product. + * Get the product flat entries that are associated with product. + * May be one for each locale and each channel. */ public function product_flats() { @@ -220,8 +225,8 @@ class Product extends Model implements ProductContract public function inventory_source_qty($inventorySourceId) { return $this->inventories() - ->where('inventory_source_id', $inventorySourceId) - ->sum('qty'); + ->where('inventory_source_id', $inventorySourceId) + ->sum('qty'); } /** @@ -237,6 +242,12 @@ class Product extends Model implements ProductContract $this->typeInstance = app(config('product_types.' . $this->type . '.class')); + if (! $this->typeInstance instanceof AbstractType) { + throw new Exception( + "Please ensure the product type '{$this->type}' is configured in your application." + ); + } + $this->typeInstance->setProduct($this); return $this->typeInstance; @@ -283,6 +294,7 @@ class Product extends Model implements ProductContract * * @param Group $group * @param bool $skipSuperAttribute + * * @return Collection */ public function getEditableAttributes($group = null, $skipSuperAttribute = true) @@ -293,7 +305,8 @@ class Product extends Model implements ProductContract /** * Get an attribute from the model. * - * @param string $key + * @param string $key + * * @return mixed */ public function getAttribute($key) @@ -305,8 +318,8 @@ class Product extends Model implements ProductContract if (isset($this->id)) { $this->attributes[$key] = ''; - $attribute = core()->getSingletonInstance(\Webkul\Attribute\Repositories\AttributeRepository::class) - ->getAttributeByCode($key); + $attribute = core()->getSingletonInstance(AttributeRepository::class) + ->getAttributeByCode($key); $this->attributes[$key] = $this->getCustomAttributeValue($attribute); @@ -327,8 +340,9 @@ class Product extends Model implements ProductContract $hiddenAttributes = $this->getHidden(); if (isset($this->id)) { - $familyAttributes = core()->getSingletonInstance(\Webkul\Attribute\Repositories\AttributeRepository::class) - ->getFamilyAttributes($this->attribute_family); + $familyAttributes = core() + ->getSingletonInstance(AttributeRepository::class) + ->getFamilyAttributes($this->attribute_family); foreach ($familyAttributes as $attribute) { if (in_array($attribute->code, $hiddenAttributes)) { @@ -377,12 +391,13 @@ class Product extends Model implements ProductContract /** * Overrides the default Eloquent query builder * - * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $query + * * @return \Illuminate\Database\Eloquent\Builder */ public function newEloquentBuilder($query) { - return new \Webkul\Product\Database\Eloquent\Builder($query); + return new Builder($query); } /** diff --git a/packages/Webkul/Velocity/src/Resources/lang/en/app.php b/packages/Webkul/Velocity/src/Resources/lang/en/app.php index 45bab1d0d..c595338cc 100644 --- a/packages/Webkul/Velocity/src/Resources/lang/en/app.php +++ b/packages/Webkul/Velocity/src/Resources/lang/en/app.php @@ -90,27 +90,28 @@ return [ ] ], 'meta-data' => [ - 'footer' => 'Footer', - 'title' => 'Velocity meta data', - 'activate-slider' => 'Activate Slider', - 'home-page-content' => 'Home Page Content', - 'footer-left-content' => 'Footer Left Content', - 'subscription-content' => 'Subscription bar Content', - 'sidebar-categories' => 'Sidebar Categories', - 'footer-left-raw-content' => '
We love to craft softwares and solve the real world problems with the binaries. We are highly committed to our goals. We invest our resources to create world class easy to use softwares and applications for the enterprise business with the top notch, on the edge technology expertise.
', - 'slider-path' => 'Slider Path', - 'category-logo' => 'Category logo', - 'product-policy' => 'Product Policy', - 'update-meta-data' => 'Update Meta Data', - 'product-view-image' => 'Product View Image', - 'advertisement-two' => 'Advertisement Two Images', - 'advertisement-one' => 'Advertisement One Images', - 'footer-middle-content' => 'Footer Middle Content', - 'advertisement-four' => 'Advertisement Four Images', - 'advertisement-three' => 'Advertisement Three Images', - 'images' => 'Images', - 'general' => 'General', - 'add-image-btn-title' => 'Add Image' + 'footer' => 'Footer', + 'title' => 'Velocity meta data', + 'activate-slider' => 'Activate Slider', + 'home-page-content' => 'Home Page Content', + 'footer-left-content' => 'Footer Left Content', + 'subscription-content' => 'Subscription bar Content', + 'sidebar-categories' => 'Sidebar Categories', + 'header_content_count' => 'Header Content Count', + 'footer-left-raw-content' => 'We love to craft softwares and solve the real world problems with the binaries. We are highly committed to our goals. We invest our resources to create world class easy to use softwares and applications for the enterprise business with the top notch, on the edge technology expertise.
', + 'slider-path' => 'Slider Path', + 'category-logo' => 'Category logo', + 'product-policy' => 'Product Policy', + 'update-meta-data' => 'Update Meta Data', + 'product-view-image' => 'Product View Image', + 'advertisement-two' => 'Advertisement Two Images', + 'advertisement-one' => 'Advertisement One Images', + 'footer-middle-content' => 'Footer Middle Content', + 'advertisement-four' => 'Advertisement Four Images', + 'advertisement-three' => 'Advertisement Three Images', + 'images' => 'Images', + 'general' => 'General', + 'add-image-btn-title' => 'Add Image' ], 'category' => [ 'save-btn-title' => 'Save Menu', @@ -194,9 +195,11 @@ return [ 'compare' => [ 'text' => 'Compare', 'compare_similar_items' => 'Compare Similar Items', + 'add-tooltip' => 'Add product to compare list', 'added' => 'Item successfully added to compare list', 'already_added' => 'Item already added to compare list', 'removed' => 'Item successfully removed from compare list', + 'removed-all' => 'All Items successfully removed from compare list', 'empty-text' => "You don't have any items in your compare list", 'product_image' => 'Product Image', 'actions' => 'Actions', @@ -264,10 +267,12 @@ return [ 'orders' => 'Orders', 'update' => 'Update', 'reviews' => 'Reviews', + 'download' => 'Download', 'currencies' => 'Currencies', 'addresses' => 'Addresses', 'top-brands' => 'Top Brands', 'new-password' => 'New password', + 'no-file-available' => 'No File Available!', 'downloadables' => 'Downloadable Products', 'confirm-new-password' => 'Confirm new password', 'enter-current-password' => 'Enter your current password', diff --git a/packages/Webkul/Velocity/src/Resources/views/admin/meta-info/meta-data.blade.php b/packages/Webkul/Velocity/src/Resources/views/admin/meta-info/meta-data.blade.php index 9f6cbac7a..f809714b8 100644 --- a/packages/Webkul/Velocity/src/Resources/views/admin/meta-info/meta-data.blade.php +++ b/packages/Webkul/Velocity/src/Resources/views/admin/meta-info/meta-data.blade.php @@ -6,6 +6,7 @@ @php $locale = request()->get('locale') ?: app()->getLocale(); + $channel = request()->get('channel') ?: core()->getCurrentChannelCode(); @endphp @section('content') @@ -29,12 +30,25 @@ + + +