Merge branch 'master' into s-4

This commit is contained in:
devansh bawari 2021-03-09 11:29:59 +05:30
commit eabeaa4314
13 changed files with 61 additions and 28 deletions

View File

@ -115,7 +115,7 @@ class SmartButtonController extends Controller
'phone_type' => 'MOBILE',
'phone_number' => [
'national_number' => $cart->billing_address->phone,
'national_number' => $this->smartButton->formatPhone($cart->billing_address->phone),
],
],
],
@ -127,28 +127,28 @@ class SmartButtonController extends Controller
'purchase_units' => [
[
'amount' => [
'value' => (float) $cart->sub_total + $cart->tax_total + ($cart->selected_shipping_rate ? $cart->selected_shipping_rate->price : 0) - $cart->discount_amount,
'value' => $this->smartButton->formatCurrencyValue((float) $cart->sub_total + $cart->tax_total + ($cart->selected_shipping_rate ? $cart->selected_shipping_rate->price : 0) - $cart->discount_amount),
'currency_code' => $cart->cart_currency_code,
'breakdown' => [
'item_total' => [
'currency_code' => $cart->cart_currency_code,
'value' => (float) $cart->sub_total,
'value' => $this->smartButton->formatCurrencyValue((float) $cart->sub_total),
],
'shipping' => [
'currency_code' => $cart->cart_currency_code,
'value' => (float) ($cart->selected_shipping_rate ? $cart->selected_shipping_rate->price : 0),
'value' => $this->smartButton->formatCurrencyValue((float) ($cart->selected_shipping_rate ? $cart->selected_shipping_rate->price : 0)),
],
'tax_total' => [
'currency_code' => $cart->cart_currency_code,
'value' => (float) $cart->tax_total,
'value' => $this->smartButton->formatCurrencyValue((float) $cart->tax_total),
],
'discount' => [
'currency_code' => $cart->cart_currency_code,
'value' => (float) $cart->discount_amount,
'value' => $this->smartButton->formatCurrencyValue((float) $cart->discount_amount),
],
],
],
@ -190,7 +190,7 @@ class SmartButtonController extends Controller
$lineItems[] = [
'unit_amount' => [
'currency_code' => $cart->cart_currency_code,
'value' => (float) $item->price,
'value' => $this->smartButton->formatCurrencyValue((float) $item->price),
],
'quantity' => $item->quantity,
'name' => $item->name,

View File

@ -75,4 +75,29 @@ abstract class Paypal extends Payment
{
return true;
}
/**
* Format a currency value according to paypal's api constraints
*
* @param float|int $long
* @return float
*/
public function formatCurrencyValue($number): float
{
return round((float) $number, 2);
}
/**
* Format phone field according to paypal's api constraints
*
* Strips non-numbers characters like '+' or ' ' in
* inputs like "+54 11 3323 2323"
*
* @param mixed $phone
* @return string
*/
public function formatPhone($phone): string
{
return preg_replace('/[^0-9]/', '', (string) $phone);
}
}

View File

@ -299,19 +299,19 @@
changeProductImages: function () {
galleryImages.splice(0, galleryImages.length)
this.galleryImages.forEach(function(image) {
galleryImages.push(image)
});
if (this.simpleProduct) {
this.config.variant_images[this.simpleProduct].forEach(function(image) {
galleryImages.unshift(image)
galleryImages.push(image)
});
this.config.variant_videos[this.simpleProduct].forEach(function(video) {
galleryImages.unshift(video)
galleryImages.push(video)
});
}
this.galleryImages.forEach(function(image) {
galleryImages.push(image)
});
},
changeStock: function (productId) {

View File

@ -20,7 +20,7 @@ class ThemeViewFinder extends FileViewFinder
// Extract the $view and the $namespace parts
list($namespace, $view) = $this->parseNamespaceSegments($name);
if (request()->route() !== null && ! Str::contains(request()->route()->uri, 'admin/')) {
if (request()->route() !== null && ! Str::contains(request()->route()->uri, config('app.admin_url') . '/')) {
$paths = $this->addThemeNamespacePaths($namespace);
try {

View File

@ -43,7 +43,7 @@ class Themes
*/
public function __construct()
{
if (request()->route() !== null && Str::contains(request()->route()->uri, 'admin/')) {
if (request()->route() !== null && Str::contains(request()->route()->uri, config('app.admin_url') . '/')) {
$this->defaultThemeCode = Config::get('themes.admin-default', null);
} else {
$this->defaultThemeCode = Config::get('themes.default', null);

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=88772f0049a360a2c02e",
"/js/velocity.js": "/js/velocity.js?id=7f7a5e0de640a40550e1",
"/css/velocity-admin.css": "/css/velocity-admin.css?id=4322502d80a0e4a0affd",
"/css/velocity.css": "/css/velocity.css?id=ab692d526032812a7666"
"/css/velocity.css": "/css/velocity.css?id=0625cac8a65cc7c4a9e2"
}

View File

@ -25,6 +25,8 @@
@media only screen and (max-width: 992px) {
.image-container {
margin: 0 auto;
.magnifier {
> img {
height: 100%;

View File

@ -11,7 +11,7 @@
<div class="row" :class="localeDirection">
<div
class="col-md-12 no-padding carousel-products"
:class="showRecentlyViewed ? 'with-recent-viewed col-lg-9' : 'without-recent-viewed col-lg-12'">
:class="showRecentlyViewed === 'true' ? 'with-recent-viewed col-lg-9' : 'without-recent-viewed col-lg-12'">
<carousel-component
:slides-per-page="slidesPerPage"
navigation-enabled="hide"
@ -39,7 +39,7 @@
:add-class="`col-lg-3 col-md-12 ${localeDirection}`"
quantity="3"
add-class-wrapper=""
v-if="showRecentlyViewed">
v-if="showRecentlyViewed === 'true'">
</recently-viewed>
</div>
</template>
@ -50,7 +50,7 @@
export default {
props: {
count: {
type: Number,
type: String,
default: 10
},
productId: {
@ -61,8 +61,8 @@
productRoute: String,
localeDirection: String,
showRecentlyViewed: {
type: Boolean,
default: false
type: String,
default: 'false'
},
recentlyViewedTitle: String,
noDataText: String,
@ -145,7 +145,9 @@
/* get window class */
getWindowClass: function () {
return this.showRecentlyViewed ? '.with-recent-viewed' : '.without-recent-viewed';
return this.showRecentlyViewed === 'true'
? '.with-recent-viewed'
: '.without-recent-viewed';
},
/* on resize set window width */

View File

@ -75,6 +75,10 @@
top: -48px;
}
.sticky-header {
display: none !important;
}
.vc-full-screen {
display: none !important;
}

View File

@ -12,7 +12,7 @@
product-title="{{ __('shop::app.home.new-products') }}"
product-route="{{ route('velocity.category.details', ['category-slug' => 'new-products', 'count' => $count]) }}"
locale-direction="{{ $direction }}"
show-recently-viewed="{{ (Boolean) $showRecentlyViewed }}"
show-recently-viewed="{{ (Boolean) $showRecentlyViewed ? 'true' : 'false' }}"
recently-viewed-title="{{ __('velocity::app.products.recently-viewed') }}"
no-data-text="{{ __('velocity::app.products.not-available') }}">
</product-collections>

View File

@ -319,11 +319,11 @@
if (this.simpleProduct) {
this.config.variant_images[this.simpleProduct].forEach(function(image) {
galleryImages.unshift(image)
galleryImages.push(image)
});
this.config.variant_videos[this.simpleProduct].forEach(function(video) {
galleryImages.unshift(video)
galleryImages.push(video)
});
}