Closed krestt closed 4 months ago
This Method does not exist enymore in latest Bagisto in "packages\Webkul\Checkout\src\Cart.php"
` /**
Prepare data for order. */ public function prepareDataForOrder(): array { $data = $this->toArray();
$finalData = [
'cart_id' => $this->getCart()->id,
'customer_id' => $data['customer_id'],
'is_guest' => $data['is_guest'],
'customer_email' => $data['customer_email'],
'customer_first_name' => $data['customer_first_name'],
'customer_last_name' => $data['customer_last_name'],
'customer' => auth()->guard()->check() ? auth()->guard()->user() : null,
'total_item_count' => $data['items_count'],
'total_qty_ordered' => $data['items_qty'],
'base_currency_code' => $data['base_currency_code'],
'channel_currency_code' => $data['channel_currency_code'],
'order_currency_code' => $data['cart_currency_code'],
'grand_total' => $data['grand_total'],
'base_grand_total' => $data['base_grand_total'],
'sub_total' => $data['sub_total'],
'base_sub_total' => $data['base_sub_total'],
'tax_amount' => $data['tax_total'],
'base_tax_amount' => $data['base_tax_total'],
'coupon_code' => $data['coupon_code'],
'applied_cart_rule_ids' => $data['applied_cart_rule_ids'],
'discount_amount' => $data['discount_amount'],
'base_discount_amount' => $data['base_discount_amount'],
'billing_address' => Arr::except($data['billing_address'], ['id', 'cart_id']),
'payment' => Arr::except($data['payment'], ['id', 'cart_id']),
'channel' => core()->getCurrentChannel(),
];
if ($this->getCart()->haveStockableItems()) {
$finalData = array_merge($finalData, [
'shipping_method' => $data['selected_shipping_rate']['method'],
'shipping_title' => $data['selected_shipping_rate']['carrier_title'].' - '.$data['selected_shipping_rate']['method_title'],
'shipping_description' => $data['selected_shipping_rate']['method_description'],
'shipping_amount' => $data['selected_shipping_rate']['price'],
'base_shipping_amount' => $data['selected_shipping_rate']['base_price'],
'shipping_address' => Arr::except($data['shipping_address'], ['id', 'cart_id']),
'shipping_discount_amount' => $data['selected_shipping_rate']['discount_amount'],
'base_shipping_discount_amount' => $data['selected_shipping_rate']['base_discount_amount'],
]);
}
foreach ($data['items'] as $item) {
$finalData['items'][] = $this->prepareDataForOrderItem($item);
}
if ($finalData['payment']['method'] === 'paypal_smart_button') {
$finalData['payment']['additional'] = request()->get('orderData');
}
return $finalData;
} `
Ok, I found the solution.... I will post it here: I took the success function from Paypal payment Method, so all I had to do is:
Hi
you should use their github version not the one which they are giving from installation.
Call to undefined method Webkul\Checkout\Cart::prepareDataForOrder()
Tasted on latest version of Bagisto