Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Split quote item for Backorder quantity #41

Open
m-canziani opened this issue Aug 12, 2020 · 2 comments
Open

Split quote item for Backorder quantity #41

m-canziani opened this issue Aug 12, 2020 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@m-canziani
Copy link

I am trying to use your Module to separate the products that are ordered in backorders mode.
I ask you if you know the most correct method to separate the same Item Quote into two different orders, with the quantities divided by backorders.
Ex:
Product 1 -> Stock = Qty: 3, Min_Qty: -10(Out-of-Stock Threshold)
Custumer Cart: Product 1 -> Qty: 8
So 3 real Stock and 5 Backorders

i want 2 orders:
Order 1: Product 1 -> Qty: 3
Order 2: Product 1 -> Qty: 5

Now i've modified (in Magestat/SplitOrder/Model/ExtensionAttributes.php) your function quantityAndStockStatus
if ($this->helperData->getBackorder() && ($attributes->getStockItem()->getQty() - $item->getQty() < 0) ) { return 'out'; }
So i can get if Quote Item have Backorders.
Then in normalizeQuote function:

        if($attribute === 'out'){
            $qtyIn = $product->getExtensionAttributes()->getStockItem()->getQty();
            $qtyOut = $item->getQty() - $qtyIn;

            $itemCopy = clone $item;

            $groups["in"][] = $item->setQty($qtyIn);
            $this->writeLog("getQty() before > " . $item->getQty() );
            $groups[$attribute][] = $itemCopy->setQty($qtyOut);
            $this->writeLog("itemCopy() after > " . $itemCopy->getQty() );
            $item->save();
            $itemCopy->save();
        } else {
            $groups[$attribute][] = $item;
        }

Additional context
Now the order is split correctly but tax_amount for the 2 Quotes isn't changed and the Stock statud of Product 1 is set -8 quantity so the stockInventory decurted 3 more quantity than the orders placed.

I did a lot of research and found nothing about dividing the same Item into two orders.
Have you any suggestion or feature to implement?

@williankeller williankeller added the enhancement New feature or request label Dec 9, 2020
@williankeller
Copy link
Owner

Thank you for opening this issue. We will align to move this change to our next release.

@williankeller williankeller added this to the 1.1.0 milestone Dec 9, 2020
@jg-development
Copy link

We are in need of this feature too ... are there any updates for the new version 1.1.0?
Greetings

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants