Configrable Default Bug Fixed
This commit is contained in:
parent
0e43ad62c9
commit
cf9d21f030
|
|
@ -2,15 +2,13 @@
|
|||
|
||||
namespace Webkul\Product\Helpers;
|
||||
|
||||
use Webkul\Product\Models\Product;
|
||||
use Webkul\Product\Models\ProductAttributeValue;
|
||||
use Webkul\Product\Facades\ProductImage;
|
||||
use Webkul\Product\Facades\ProductVideo;
|
||||
|
||||
class ConfigurableOption extends AbstractProduct
|
||||
{
|
||||
/**
|
||||
* Returns the allowed variants
|
||||
* Returns the allowed variants.
|
||||
*
|
||||
* @param \Webkul\Product\Contracts\Product|\Webkul\Product\Contracts\ProductFlat $product
|
||||
* @return array
|
||||
|
|
@ -33,21 +31,27 @@ class ConfigurableOption extends AbstractProduct
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the allowed variants JSON
|
||||
* Returns the allowed variants JSON.
|
||||
*
|
||||
* @param \Webkul\Product\Contracts\Product|\Webkul\Product\Contracts\ProductFlat $product
|
||||
* @return array
|
||||
*/
|
||||
public function getConfigurationConfig($product)
|
||||
{
|
||||
$productTypeInstance = $product->getTypeInstance();
|
||||
|
||||
$options = $this->getOptions($product, $this->getAllowedProducts($product));
|
||||
|
||||
$config = [
|
||||
'attributes' => $this->getAttributesData($product, $options),
|
||||
'index' => isset($options['index']) ? $options['index'] : [],
|
||||
'regular_price' => [
|
||||
'formated_price' => $product->getTypeInstance()->haveOffer() ? core()->currency($product->getTypeInstance()->getOfferPrice()) : core()->currency($product->getTypeInstance()->getMinimalPrice()),
|
||||
'price' => $product->getTypeInstance()->haveOffer() ? $product->getTypeInstance()->getOfferPrice() : $product->getTypeInstance()->getMinimalPrice(),
|
||||
'formated_price' => $productTypeInstance->haveOffer()
|
||||
? core()->currency($productTypeInstance->getOfferPrice())
|
||||
: core()->currency($productTypeInstance->evaluatePrice($productTypeInstance->getMinimalPrice())),
|
||||
'price' => $productTypeInstance->haveOffer()
|
||||
? $productTypeInstance->getOfferPrice()
|
||||
: $productTypeInstance->evaluatePrice($productTypeInstance->getMinimalPrice()),
|
||||
],
|
||||
'variant_prices' => $this->getVariantPrices($product),
|
||||
'variant_images' => $this->getVariantImages($product),
|
||||
|
|
@ -59,7 +63,7 @@ class ConfigurableOption extends AbstractProduct
|
|||
}
|
||||
|
||||
/**
|
||||
* Get allowed attributes
|
||||
* Get allowed attributes.
|
||||
*
|
||||
* @param \Webkul\Product\Contracts\Product|\Webkul\Product\Contracts\ProductFlat $product
|
||||
* @return \Illuminate\Support\Collection
|
||||
|
|
@ -70,7 +74,7 @@ class ConfigurableOption extends AbstractProduct
|
|||
}
|
||||
|
||||
/**
|
||||
* Get Configurable Product Options
|
||||
* Get configurable product options.
|
||||
*
|
||||
* @param \Webkul\Product\Contracts\Product|\Webkul\Product\Contracts\ProductFlat $currentProduct
|
||||
* @param array $allowedProducts
|
||||
|
|
@ -108,7 +112,7 @@ class ConfigurableOption extends AbstractProduct
|
|||
}
|
||||
|
||||
/**
|
||||
* Get product attributes
|
||||
* Get product attributes.
|
||||
*
|
||||
* @param \Webkul\Product\Contracts\Product|\Webkul\Product\Contracts\ProductFlat $product
|
||||
* @param array $options
|
||||
|
|
@ -116,8 +120,6 @@ class ConfigurableOption extends AbstractProduct
|
|||
*/
|
||||
public function getAttributesData($product, array $options = [])
|
||||
{
|
||||
$defaultValues = [];
|
||||
|
||||
$attributes = [];
|
||||
|
||||
$allowAttributes = $this->getAllowAttributes($product);
|
||||
|
|
@ -143,6 +145,8 @@ class ConfigurableOption extends AbstractProduct
|
|||
}
|
||||
|
||||
/**
|
||||
* Get attribute options data.
|
||||
*
|
||||
* @param \Webkul\Attribute\Contracts\Attribute $attribute
|
||||
* @param array $options
|
||||
* @return array
|
||||
|
|
@ -169,7 +173,7 @@ class ConfigurableOption extends AbstractProduct
|
|||
}
|
||||
|
||||
/**
|
||||
* Get product prices for configurable variations
|
||||
* Get product prices for configurable variations.
|
||||
*
|
||||
* @param \Webkul\Product\Contracts\Product|\Webkul\Product\Contracts\ProductFlat $product
|
||||
* @return array
|
||||
|
|
@ -192,7 +196,7 @@ class ConfigurableOption extends AbstractProduct
|
|||
}
|
||||
|
||||
/**
|
||||
* Get product images for configurable variations
|
||||
* Get product images for configurable variations.
|
||||
*
|
||||
* @param \Webkul\Product\Contracts\Product|\Webkul\Product\Contracts\ProductFlat $product
|
||||
* @return array
|
||||
|
|
@ -215,7 +219,7 @@ class ConfigurableOption extends AbstractProduct
|
|||
}
|
||||
|
||||
/**
|
||||
* Get product videos for configurable variations
|
||||
* Get product videos for configurable variations.
|
||||
*
|
||||
* @param \Webkul\Product\Contracts\Product|\Webkul\Product\Contracts\ProductFlat $product
|
||||
* @return array
|
||||
|
|
@ -236,4 +240,4 @@ class ConfigurableOption extends AbstractProduct
|
|||
|
||||
return $videos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue