|
@@ -214,8 +214,13 @@ class FlexibleVariantController extends Controller
|
|
|
*/
|
|
*/
|
|
|
public function getProductOptions(int $productId): JsonResponse
|
|
public function getProductOptions(int $productId): JsonResponse
|
|
|
{
|
|
{
|
|
|
- $options = $this->flexibleVariantHelper->getProductOptions($productId);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ $this->initProduct($productId);
|
|
|
|
|
+ $options = $this->_product->options()
|
|
|
|
|
+ ->with('values', function ($query) {
|
|
|
|
|
+ $query->whereHas('variants', function ($relation) {
|
|
|
|
|
+ $relation->whereIn($relation->getModel()->getTable().'.id', $this->_product->variants()->pluck('id'));
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
return response()->json([
|
|
return response()->json([
|
|
|
'success' => true,
|
|
'success' => true,
|
|
|
'data' => $options,
|
|
'data' => $options,
|