Merge pull request #4337 from rahulshukla-webkul/development

enhancement #4321 done with all required changes
This commit is contained in:
Jitendra Singh 2020-12-04 15:57:48 +05:30 committed by GitHub
commit 963191b3fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 58 additions and 21 deletions

View File

@ -218,6 +218,10 @@ return [
],
],
'channel_based' => true,
], [
'name' => 'buy_now_button_display',
'title' => 'admin::app.admin.system.buy-now-button-display',
'type' => 'boolean',
]
],
], [

View File

@ -1379,7 +1379,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -1353,7 +1353,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
],
],
];

View File

@ -1379,7 +1379,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -1335,7 +1335,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -1371,7 +1371,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -1376,7 +1376,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -1371,7 +1371,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -1360,7 +1360,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -1374,7 +1374,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -1357,7 +1357,8 @@ return [
'client-secret' => 'Client Secret',
'client-secret-info' => 'Add your secret key here',
'accepted-currencies' => 'Accepted currencies',
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...'
'accepted-currencies-info' => 'Add currency code comma seperated e.g. USD,INR,...',
'buy-now-button-display' => 'Allow customers to directly buy products'
]
]
];

View File

@ -102,11 +102,9 @@ class ProductFlatRepository extends Repository
foreach ($products as $key => $product) {
foreach ($filterAttributes as $attribute) {
if ($attribute->code <> 'price') {
if (isset($product[$attribute->code])) {
if (! in_array($product[$attribute->code], $allProductAttributeOptionsCode)) {
array_push($allProductAttributeOptionsCode, $product[$attribute->code]);
}
if ($attribute->code <> 'price' && isset($product[$attribute->code])) {
if (! in_array($product[$attribute->code], $allProductAttributeOptionsCode)) {
array_push($allProductAttributeOptionsCode, $product[$attribute->code]);
}
}
}

View File

@ -1,6 +1,11 @@
{!! view_render_event('bagisto.shop.products.add_to_cart.before', ['product' => $product]) !!}
<button type="submit" class="btn btn-lg btn-primary addtocart" {{ ! $product->isSaleable() ? 'disabled' : '' }}>
@php
$width = (core()->getConfigData('catalog.products.storefront.buy_now_button_display') == 1) ? '49' : '95';
@endphp
<button type="submit" class="btn btn-lg btn-primary addtocart" {{ ! $product->isSaleable() ? 'disabled' : '' }}
style="width: <?php echo $width.'%';?>;">
{{ ($product->type == 'booking') ? __('shop::app.products.book-now') : __('shop::app.products.add-to-cart') }}
</button>

View File

@ -3,7 +3,9 @@
<div class="add-to-buttons">
@include ('shop::products.add-to-cart', ['product' => $product])
@include ('shop::products.buy-now')
@if (core()->getConfigData('catalog.products.storefront.buy_now_button_display'))
@include ('shop::products.buy-now')
@endif
</div>
{!! view_render_event('bagisto.shop.products.view.product-add.after', ['product' => $product]) !!}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
{
"/js/velocity.js": "/js/velocity.js?id=7667f0ec09b600fb38fc",
"/js/velocity.js": "/js/velocity.js?id=45f7f05ff7e9c16e73e5",
"/css/velocity-admin.css": "/css/velocity-admin.css?id=4322502d80a0e4a0affd",
"/css/velocity.css": "/css/velocity.css?id=e41e400c39a3cb5bc551"
"/css/velocity.css": "/css/velocity.css?id=735a971d8d35f29b420a"
}

View File

@ -349,6 +349,11 @@ body {
> h2, div {
padding-right: 0px;
}
.buynow {
float: left;
margin-right: 10px;
}
}
}

View File

@ -0,0 +1,7 @@
{!! view_render_event('bagisto.shop.products.buy_now.before', ['product' => $product]) !!}
<button type="submit" class="theme-btn text-center buynow" {{ ! $product->isSaleable(1) ? 'disabled' : '' }}>
{{ __('shop::app.products.buy-now') }}
</button>
{!! view_render_event('bagisto.shop.products.buy_now.after', ['product' => $product]) !!}

View File

@ -124,6 +124,12 @@
</div>
<div class="product-actions">
@if (core()->getConfigData('catalog.products.storefront.buy_now_button_display'))
@include ('shop::products.buy-now', [
'product' => $product,
])
@endif
@include ('shop::products.add-to-cart', [
'form' => false,
'product' => $product,