@devansh-webkul Thanks ! It is not causing an exception but unless this is set the inventory of configurable products will not work properly. We don't need a resolution as we have resolved as per the screenshot but we thought it would be a good idea to share it.
thanks!
ps: configurable products need to reach the bloc of which takes the quantity from the parent and this does just that (otherwise the quantity of configurable products will always be zero within the original logic which nullifies the ordered inventories for configurable products).
nessuno
@nessuno
Posts made by nessuno
-
RE: OrderItemRepository.php / product_ordered_inventories on configurable products.
-
OrderItemRepository.php / product_ordered_inventories on configurable products.
Hi Bagisto Team !
in packages/Webkul/Sales/src/Repositories/OrderItemRepository.php
at line 127
where
if (isset($item->qty_ordered)shouldn't it be:
if (isset($item->qty_ordered) && ($item->qty_ordered>0)) instead ?
Because for configurable products, the qty ends up as zero in product_ordered_inventories and as such it will never prevent anyone from adding to the cart even though the reserve has surpassed the inventory qty.
Try checking out a configurable product using both versions of the if statement.
The reserve works for single products but not for configurable ones unless I set this additional condition.Please feel free to correct me if I am wrong ?
Thanks in advance for your time,
-
RE: Inventory subtraction at the time of the Order
@nessuno I found the answer for this from the kind answer of @devansh-webkul from this post https://forums.bagisto.com/topic/1692/inventory-deducted-on-order
Thank you Bagisto friends. -
RE: Inventory deducted on order
@devansh-webkul and @otheriz Thank you this quite useful as I need to custom to the same thing ( Inventory subtracted at Order creation ). Thanks !!!!!!!
-
Inventory subtraction at the time of the Order
Hi Bagisto Friends,
Thanks in advance for your time.
My question is simple, we need for some of our channels, the ability to subtract from the inventory at the time the order is done, so if an order is created, the inventory would be subtracted regardless of payment and deliverance. The context of this is that some shops have vip and elite clients that are able to order without paying, and often they are offered 'Hot Items' ( usually with a very limited quantity ) but since these customers don't need to invoice or delivery for approval, the quantity should be taken at that point otherwise the inventory in this channel will never go down as it may take 3 or 4 days for them to get the delivery and meanwhile the Hot Item might have run out of inventory but these customers are still able to order which creates a bit of problem as you can imagine ( these are rare items in the inventory, like 4 or 5 times a year), these customers have special free delivery (based on loyalty)... In any case I was wondering if you could point me to the where in the code where I should be aware that I might have missed or maybe there is an option for this already and I am missing ? In any case your advice is very appreciated.
Thank You !
s -
RE: Prettus mismatch when issuing invoice via Tinker ( Prettus/Repository/Eloquent/BaseRepository::__construct() must be an instance of Illuminate/Container/Container )
@devansh-webkul
I did go deeper, but your solution is better ...
I ended up doing this:Route::get('custom_issue_invoice_by_order/{id}', '[email protected]_invoice')->defaults('_config', [
'repository' => 'Webkul\Sales\Repositories\OrderRepository',
'resource' => 'Webkul\API\Http\Resources\Sales\Order',
'authorization_required' => true
]);( Which works, [email protected]_invoice_by_order is a custom version of [email protected]; which essentially matches Interac / E-Transfers resulting in auto-payments without fees for the customers ... )
But I like your solution better as with your way I might be able to get it via Tinker which is neat for interacting instead of APIing like I did ... Thanks @devansh-webkul you are a prince ! much appreciated.
have a great day/night !
s -
RE: Prettus mismatch when issuing invoice via Tinker ( Prettus/Repository/Eloquent/BaseRepository::__construct() must be an instance of Illuminate/Container/Container )
@devansh-webkul
Thanks for your reply.
I am trying to issue invoice based on order via tinker ( or via cli or post api ) ...
Yes, the above commands were issued in Tinker as also per below:- use Webkul\Sales\Repositories\OrderRepository;
OK in Tinker - $this_order = Webkul\Sales\Models\Order::where('id',262);
OK in Tinker ( replies => Illuminate\Database\Eloquent\Builder {#3862} ) - But when I try to initiate the repository using:
$a=new OrderItemRepository($this_order);
then Tinker replies:
TypeError: Argument 1 passed to Prettus/Repository/Eloquent/BaseRepository::__construct() must be an instance of Illuminate/Container/Container, instance of Illuminate/Database/Eloquent/Builder given on line 1
But I can't iterate with the repository ...
Thanks for your help, appreciated !
s - use Webkul\Sales\Repositories\OrderRepository;
-
RE: Prettus mismatch when issuing invoice via Tinker ( Prettus/Repository/Eloquent/BaseRepository::__construct() must be an instance of Illuminate/Container/Container )
For example ( I am actually trying to issue an invoice via tinker), as this:
use Webkul\Sales\Repositories\OrderRepository; ( OK ! )
$this_order = Webkul\Sales\Models\Order::where('id',262);
=> Illuminate\Database\Eloquent\Builder {#3862} ( OK ! )$a=new OrderItemRepository($this_order);
TypeError: Argument 1 passed to Prettus/Repository/Eloquent/BaseRepository::__construct() must be an instance of Illuminate/Container/Container, instance of Illuminate/Database/Eloquent/Builder given on line 1My final goal is to reach the Invoice Controller method ( create/store ) to custom the invoice issuance flow ...
any help appreciated !!
thanks -
Prettus mismatch when issuing invoice via Tinker ( Prettus/Repository/Eloquent/BaseRepository::__construct() must be an instance of Illuminate/Container/Container )
Hi All,
Please, trying to find an example of interacting with bagisto using Tinker ?
Say opening an order ... ?
Thanks in advance for your time!
best,
s