Move Configurable Item To Cart From Wishlist Bug Removed and Storefront UI Fix
This commit is contained in:
parent
e59f5a775b
commit
b55720244c
|
|
@ -309,6 +309,7 @@ class Cart {
|
|||
* @return Booleans
|
||||
*/
|
||||
public function createNewCart($id, $data, $prepared = false, $preparedData = []) {
|
||||
// dd($id, $data, $prepared,$preparedData);
|
||||
if($prepared == false) {
|
||||
if(isset($data['selected_configurable_option'])) {
|
||||
$canAdd = $this->canAdd($data['selected_configurable_option'], $data['quantity']);
|
||||
|
|
@ -368,8 +369,6 @@ class Cart {
|
|||
//parent item entry
|
||||
if($prepared == false) {
|
||||
$itemData['parent']['additional'] = json_encode($data);
|
||||
} else {
|
||||
$itemData['parent']['additional'] = json_encode($preparedData);
|
||||
}
|
||||
|
||||
if($parent = $this->cartItem->create($itemData['parent'])) {
|
||||
|
|
@ -1140,11 +1139,12 @@ class Cart {
|
|||
$result = $this->moveConfigurableFromWishlistToCart($product->parent_id, $product->id);
|
||||
|
||||
if(is_array($result)) {
|
||||
$data['_token'] = 'null';
|
||||
$data['quantity'] = 1;
|
||||
$data['product'] = $product->parent_id;
|
||||
$data['selected_configurable_option'] = $product->id;
|
||||
|
||||
$data['selected_configurable_option'] = $product->parent_id;
|
||||
|
||||
$moved = $this->add($data['selected_configurable_option'], $data, true, $result);
|
||||
$moved = $this->add($product->parent_id, $data, true, $result);
|
||||
|
||||
if($moved) {
|
||||
return true;
|
||||
|
|
@ -1161,7 +1161,7 @@ class Cart {
|
|||
* @return mixed
|
||||
*/
|
||||
public function moveConfigurableFromWishlistToCart($configurableproductId, $productId) {
|
||||
// dd('moving configurable');
|
||||
// dd($configurableproductId, $productId);
|
||||
$product = $this->product->find($configurableproductId);
|
||||
|
||||
$canAdd = $this->product->find($productId)->haveSufficientQuantity(1);
|
||||
|
|
@ -1177,7 +1177,7 @@ class Cart {
|
|||
$child = $this->product->findOneByField('id', $productId);
|
||||
|
||||
$childData = [
|
||||
'product_id' => $configurableproductId,
|
||||
'product_id' => $productId,
|
||||
'sku' => $child->sku,
|
||||
'name' => $child->name,
|
||||
'type' => 'simple'
|
||||
|
|
@ -1190,21 +1190,15 @@ class Cart {
|
|||
|
||||
unset($productAddtionalData['html']);
|
||||
|
||||
// $additional = [
|
||||
// 'request' => $childData,
|
||||
// 'variant_id' => $productId,
|
||||
// 'attributes' => $productAddtionalData
|
||||
// ];
|
||||
$additional['_token'] = null;
|
||||
$additional['product'] = $product->id;
|
||||
$additional['quantity'] = 1;
|
||||
$additional['is_configurable'] = true;
|
||||
$additional['selected_configurable_option'] = $child->id;
|
||||
$additional['super_attributes'] = $productAddtionalData;
|
||||
$additional = [
|
||||
'request' => $childData,
|
||||
'variant_id' => $productId,
|
||||
'attributes' => $productAddtionalData['attributes']
|
||||
];
|
||||
|
||||
$parentData = [
|
||||
'sku' => $product->sku,
|
||||
'product_id' => $productId,
|
||||
'product_id' => $configurableproductId,
|
||||
'quantity' => 1,
|
||||
'type' => $product->type,
|
||||
'name' => $product->name,
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class Product extends Model
|
|||
*/
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(self::class);
|
||||
return $this->belongsTo(self::class, 'parent_id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -133,10 +133,10 @@ class Product extends Model
|
|||
{
|
||||
if(!$this->status)
|
||||
return false;
|
||||
|
||||
|
||||
if($this->haveSufficientQuantity(1))
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -247,5 +247,5 @@ class Product extends Model
|
|||
{
|
||||
return new \Webkul\Product\Database\Eloquent\Builder($query);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -621,10 +621,15 @@ section.slider-block {
|
|||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: white;
|
||||
color: $font-color;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
top: 0px;
|
||||
|
||||
// * {
|
||||
// color: blue;
|
||||
// font-size: 112px;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -928,6 +933,10 @@ section.slider-block {
|
|||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
|
||||
.btn {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown-footer .btn {
|
||||
|
|
@ -2873,7 +2882,7 @@ section.review {
|
|||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue