How low count inventory and out of stock works in Merchello?
Hi there, i would like to know how low inventory works in Merchello, what is it used for? does it send an email when the inventory count is lower than this count? if so, how can i configured? i havent found anything in the documentation...
And how can i configure if i would like users could buy an out of stock item?
ATM, it is simply a record in the database that is not wired to anything but can be used by individual implementations. If you wanted an email to be sent to you when an item in inventory falls below the low count, you could pretty easily wire it up when the inventory is decremented or in maybe add a check in the shipment status changed ....
There is a setting on the products to "Allow Out Of Stock Purchase" which is wired up ...
Thanks Rusty, could you elaborate on how is it wired?
By the way , i need to modify the inventory when the invoice is paid. I have read that i need to delete this task:
Sorry, I used the term wired to mean coded - "hooked up"
Tasks are executed in order listed in the config file. If you create a new class that inherits from the base class that is used by other tasks in the same chain, you can add it.
Depending on your configuration (but by default) the order is created after the invoice has been paid so you could probably use the OrderCreation task chain.
It executes and lowers the inventory as expected. The problem is, the task executes when order is created, at the start of the payment process (when confirming) not when the invoice is paid. I would need to attach to an event of invoice paid. How could i do it?
What payment provider are you using? The invoice status should be unpaid at the beginning of the transaction, through Authorized, and then only marked Paid after the payment has been collected (which would by default return a value of true for ApproveOrderCreation). It is possible to force this value to be true all the time via the merchello.config as mentioned earlier.
Another option would be to use the Invoice.StatusChanging and Invoice.StatusChanged events to see the before and after statuses. I did not mention this before as you would have to watch for voiding payments, partial payments and refunds.
But order is created as soon as i confirm (before redirecting to payment).
Im using as an example Paypal payment.
I believe that the process go like this:
Checkout -> Order creating -> Invoice creation -> Redirects to payment -> payment ok -> invoice marked as collected (paid).
I dont understand how it could create the order after payment, as i thought that invoicing is afterwards order creating.
Using the InvoiceService.StatusChanged how could i track the variants inventory? only when a total or partial payment has ocurred...
I think that may have been a error in the PayPal plugin. I'm currently moving an updated version of it into the Core (started yesterday actually).
What should happen:
Customer opts to pay with PayPal.
Merchello does an Authorize transaction (which returns ApproveOrderCreation = false by default which does respect the merchello.config setting you showed above - meaning if the merchello.config setting was try, the ApproveOrderCreation property in the IPaymentResult from the Authorize transaction would be overriden which would not work for you).
The customer is redirected off to PayPal
On successful payment, Merchello Captures the payment which should set the ApproveOrderCreation.
One thing to note, is inventory is not actually decremented until a shipment is created - so if you are looking for inventory values AFTER this order has been sent, you would need to check even later in the back office process (dealing with shipment creation, statuses). But I think you are wanting the inventory values as they relate to the current "checkout" snapshot in time ... right?
Thanks Rusty, i need to decrement inventory as soon the invoice is paid. So i dont know where to do it.
Some items are paid through bank transfer, so the invoice is pending until the admin goes to the backoffice and collect the invoice. In that case i have to decrement inventory as soon as the order is confirmed. Only when a credit card or paypal is used it needs to be decremented on payment ok.
The invoice is created before the order creation? i think i am misundertanding the process.
The invoice is the only thing that is always created during the checkout process as it stores the record of the sale.
An invoice "can" contain 1 or more orders. This is an extension point, but normally you will wind up with a single order once an invoice is marked paid during a Capture payment (or AuthorizeCapturePayment operation). The result of that operation (IPaymentResult) has a property ApproveOrderCreation.
If this property is true, an Order is created and associated with the invoice.
You can think of it as the Invoice is the record used by the Accounts Receivable department and the Order is the record used by the fulfillment or warehouse personnel.
An order is essentially an invoice with only products that need to be fulfilled in some manner (i.e. no tax, discount or adjustment line items).
An order can have 1 or more shipments, which is how Merchello is able to ship items in an order at different times (e.g. back order situations).
From what you described in your last post, I think you want to comment out the inventory task when creating the shipment and create a similar task in the order creation chain (which again should happen once the ApproveOrderCreation = true in a payment result ... which again should only happen once the invoice is marked paid in a payment gateway method unless overridden in the merchello.config).
I'm currently moving and refactoring the PayPal provider and moving it into the Core for Merchello version 2.0.0. It will be a bit different than the one that is out there at them moment (using the updated REST API). It's about 2 or 3 weeks out but it'll work as described above.
That being said, I have not gotten to the point where I've looked at the existing plugin solution to see when they are setting ApproveOrderCreation. If your stuck, one thing you could do is write a handler for the PaymentGatewayProviderBase.AuthorizeAttempted event checking the sender for the Provider type and looking at the ApproveOrderCreation value before it is returned to see if the value is what is expected. If it's not, you could probably fix the issue in the controller that handles the response from PayPal ...
I'll know more over the next couple of days as I continue the refactor but it would be helpful if you keep me in the loop as to how you are getting on so that I can make certain that any mistakes are not repeated.
Thanks @Rusty, now i believe i understand it.
So checking the PayPalPaymentProcessor class the authorize and initialize methods returned this payment result:
return new PaymentResult(Attempt<IPayment>.Succeed(payment), invoice, true);
So changed it to:
return new PaymentResult(Attempt<IPayment>.Succeed(payment), invoice, false);
Only in the CapturePayment method i return true. Now it works. What should i return on the RefundPayment method?
Yes, that is the way I'm doing it in the refactor.
The refund payment is a bit trickier since Merchello is not looking at that property at all since the order has already been created.
It is also store specific. Refunds can be partial refunds, total refunds ... etc for any number of reasons. Maybe the customer was unhappy with something or the product was damaged but the item was not returned.
This is also the case with void transactions, where their might have been a mistake or the back office staff wants to "void" a payment (say they went to PayPal and canceled there) but then calls in and wants to pay with a credit card.
A return workflow is something that is being planned - but as you can see it needs to be a completely different set of steps.
I have completed one merchello project and now 2 more in the process, each with its own custom approaches and now i am glad to have chosen Merchello, good job!
I have changed a lot of the bazaar controllers to make my own in order to make the site totally angularjs driven (one page checkout process, cart and account management). I havent used the extended product content as i find it trickier to use.
Yes, IProductContent would be trickier to use in angular. The display models are what is used in the back office of Merchello, that's really their main reason for there.
Merchello 2.0.0 does have some pretty big new features.
Notification emails can be based off a razor view located /Views/Merchello/Notification.
This allows for much easier email formatting and razor code in the view. By default the view itself inherits from a the new MerchelloHelperViewPage<T> which itself inherits from UmbracoViewPage<t> which gives you all the normal Umbraco goodies and an instantiated MerchelloHelper accessed via the Merchello property.
The Braintree payment provider (already added) and PayPal ExpressCheckout provider (wip) are being added to the Core install.
We've added the ability to adjust an invoice total with one or more "Adjustment" line items. This allows for giving a partial refund through the back office and adjusting the invoice balance so that the invoice can still have a zero balance. An adjustment can also be used for increasing the invoice total if that is needed for some reason.
We've extended the (what were sales) notes, to allow for marking them public or private and also record the user who authored the note.
The new notes mechanic was then to supersede the original Customer notes so that a thread of customer notes can be managed.
We've added the ability to checkout for a customer through the back office. The back office user can create a customer, go to the customers back office page and start adding items to their basket. A checkout button then appears at the bottom of the customer cart directive in the back office which opens a model to create an invoice. Payments are accepted on the SalesOverview page as they were before.
Another feature we added is a new logger that allows for logging to the standard Umbraco logs and also drop in a remote logger (I've done one for Sentry https://docs.getsentry.com/hosted/clients/csharp/) that can be configured in the merchello.config via a Pluggable object.
Other than that, there are some little bug fixes we've found or that have been reported.
Thats great!! i like the razor based notification emails (could you add more triggers in the default plugin?) and the checkout through the back office.
About the IProductContent, I dont use Product Detached Content as i think is hard to use for my clients, the create product work flow i think is something Merchello has to improve. So i use Umbraco content and create or update the merchello product behind the scenes. Only my client has to go to Merchello backoffice to create options and set inventory and to manage sales.
Think of a product related to categories, brands, manufacturers, etc.... is easy to manage that in Umbraco, and to query using the umbraco api. I think it is hard to make this inside Merchello.
Some things i would like to have in Merchello 2 would be:
Backoffice translation: as an spanish user there are lots of info not abled to be translated: Merchello tree, some headers in the listing tables (products: available, shippable, etc; sales, etc), and the most importand, inside a sale invoice there are lots of english words that i have to explain to my clients.
Hope there will be lots of enhancements in future versions of Merchello!
A definite priority is always to make things easier for the end user and we're always looking for ideas.
With regards to the back office localization, I've been pecking at them as I find them. It's pretty easy to clean up as I come across them, but the back office is extensive and I don't hit every view we have on every sprint so it is a bit of a "piece meal" process. If you have time when you come across them, take a quick screen shot and post them as issues in the issue tracker - it would be very helpful.
It is more difficult to localize some of the error messages and things that are hard coded in the c# - these have to be done in stages (especially if they are in base classes people have used to derive their own extensions). Still it would be great to get them on the radar as I really only look at the back office in English.
Also, one of the things that I do, that you may be encountering, is to "try" add new keys to other language files (es-ES for example) in English as I add them with hopes the speakers of that language will update the files and submit them as pull requests.
As for the Bazaar, I'm hoping to start a refactoring soon. I was actually going to write a forum post on that. I'd really love to replace it with something a lot more generic, perhaps relying more on Umbraco macros that can be placed directly on templates in certain cases. All views and partials would also be moved to the Umbraco views folder and the themes engine would be removed.
Another initiative is to get rid of the Bazaar specific view models and use the new models builder now include in the Umbraco core (Umbraco 7.4.0). These are partial classes which, we think will be easier for people to extend and more feel even more like Umbraco.
The biggest problem is the portability of the existing Bazaar to a new version so the discussion is currently, do we simply make a new starter kit. There are a lot of people using the Bazaar so my feeling is that would also need to be maintained - and I don't have the bandwidth to maintain two starters, continue Merchello core improvements and do the extra project work I have going on that I have to do to keep the project going funding wise.
One idea, is to move the Bazaar into a separate project that community could help maintain. This has not worked so well in the past with other starter kits, but perhaps the Bazaar has enough traction that the community will be motivated at least enough nudge the platform in the direction to be an easy port to a new starter kit.
We would love your thoughts on this!
Keep the comments coming and we'll continue to work with the suggestions and get them into the core =)
About the localization, if i find keys in english in my es-ES xml file i will translate it. The problem is some words/phrases are now hard coded and dont have keys. I find them in the main screens in the backoffice, so i think they are easy to find.
For Bazaar i find a good solution to move for the partial views solution. Its what i have done in my projects. I have a Merchello folder in my partial views folder, as a "merchello" folder in my scripts folder. When i make a new project I copy this folders and i can use them as they are. This partial views are very generic and follow bootstrap 3, so they make the job and are easy to integrate. I have about 18 partial views. I dont mind sending a basic example project to you if you want to see my implementation, may be it will throw some ideas to you.
The idea is my main views dont know about merchello, so i could integrate merchello in a normal umbraco site.
I think current Bazaar project is now on github so people using it can mantain it while new starter kits goes in new directions.
It would be great to see you solution to give me an idea as to how you are working with it. If you would, send me a ping me on twitter so we can coordinate over DM.
It does sound like the direction we are considering is consistent with what you are already doing.
At the moment, the Bazaar solution is in the main Merchello repository. If we decide to do a completely new starter, the Bazaar itself would be moved to a separate public repository on GitHub.
How low count inventory and out of stock works in Merchello?
Hi there, i would like to know how low inventory works in Merchello, what is it used for? does it send an email when the inventory count is lower than this count? if so, how can i configured? i havent found anything in the documentation...
And how can i configure if i would like users could buy an out of stock item?
Hey Tito,
ATM, it is simply a record in the database that is not wired to anything but can be used by individual implementations. If you wanted an email to be sent to you when an item in inventory falls below the low count, you could pretty easily wire it up when the inventory is decremented or in maybe add a check in the shipment status changed ....
There is a setting on the products to "Allow Out Of Stock Purchase" which is wired up ...
Thanks Rusty, could you elaborate on how is it wired? By the way , i need to modify the inventory when the invoice is paid. I have read that i need to delete this task:
And add a custom task. Where do i have to add my custom task? i cant see the paid invoice task/chain
Sorry, I used the term wired to mean coded - "hooked up"
Tasks are executed in order listed in the config file. If you create a new class that inherits from the base class that is used by other tasks in the same chain, you can add it.
Depending on your configuration (but by default) the order is created after the invoice has been paid so you could probably use the OrderCreation task chain.
Thanks Rusty, i have write my task as pointed here:
https://our.umbraco.org/projects/collaboration/merchello/merchello/63357-Inventory-tracking#comment-226082
And added here:
It executes and lowers the inventory as expected. The problem is, the task executes when order is created, at the start of the payment process (when confirming) not when the invoice is paid. I would need to attach to an event of invoice paid. How could i do it?
Hey Tito,
What payment provider are you using? The invoice status should be unpaid at the beginning of the transaction, through Authorized, and then only marked Paid after the payment has been collected (which would by default return a value of true for ApproveOrderCreation). It is possible to force this value to be true all the time via the merchello.config as mentioned earlier.
Another option would be to use the Invoice.StatusChanging and Invoice.StatusChanged events to see the before and after statuses. I did not mention this before as you would have to watch for voiding payments, partial payments and refunds.
I have in merchello.config this setting:
But order is created as soon as i confirm (before redirecting to payment). Im using as an example Paypal payment. I believe that the process go like this:
Checkout -> Order creating -> Invoice creation -> Redirects to payment -> payment ok -> invoice marked as collected (paid).
I dont understand how it could create the order after payment, as i thought that invoicing is afterwards order creating.
Using the InvoiceService.StatusChanged how could i track the variants inventory? only when a total or partial payment has ocurred...
I think that may have been a error in the PayPal plugin. I'm currently moving an updated version of it into the Core (started yesterday actually).
What should happen:
Merchello does an Authorize transaction (which returns
ApproveOrderCreation = false
by default which does respect the merchello.config setting you showed above - meaning if the merchello.config setting was try, theApproveOrderCreation
property in theIPaymentResult
from the Authorize transaction would be overriden which would not work for you).The customer is redirected off to PayPal
One thing to note, is inventory is not actually decremented until a shipment is created - so if you are looking for inventory values AFTER this order has been sent, you would need to check even later in the back office process (dealing with shipment creation, statuses). But I think you are wanting the inventory values as they relate to the current "checkout" snapshot in time ... right?
Thanks Rusty, i need to decrement inventory as soon the invoice is paid. So i dont know where to do it. Some items are paid through bank transfer, so the invoice is pending until the admin goes to the backoffice and collect the invoice. In that case i have to decrement inventory as soon as the order is confirmed. Only when a credit card or paypal is used it needs to be decremented on payment ok.
The invoice is created before the order creation? i think i am misundertanding the process.
Hey Tito,
The invoice is the only thing that is always created during the checkout process as it stores the record of the sale.
An invoice "can" contain 1 or more orders. This is an extension point, but normally you will wind up with a single order once an invoice is marked paid during a Capture payment (or AuthorizeCapturePayment operation). The result of that operation (IPaymentResult) has a property ApproveOrderCreation.
If this property is true, an Order is created and associated with the invoice.
You can think of it as the Invoice is the record used by the Accounts Receivable department and the Order is the record used by the fulfillment or warehouse personnel.
An order is essentially an invoice with only products that need to be fulfilled in some manner (i.e. no tax, discount or adjustment line items).
An order can have 1 or more shipments, which is how Merchello is able to ship items in an order at different times (e.g. back order situations).
From what you described in your last post, I think you want to comment out the inventory task when creating the shipment and create a similar task in the order creation chain (which again should happen once the ApproveOrderCreation = true in a payment result ... which again should only happen once the invoice is marked paid in a payment gateway method unless overridden in the merchello.config).
I'm currently moving and refactoring the PayPal provider and moving it into the Core for Merchello version 2.0.0. It will be a bit different than the one that is out there at them moment (using the updated REST API). It's about 2 or 3 weeks out but it'll work as described above.
That being said, I have not gotten to the point where I've looked at the existing plugin solution to see when they are setting ApproveOrderCreation. If your stuck, one thing you could do is write a handler for the
PaymentGatewayProviderBase.AuthorizeAttempted
event checking the sender for the Provider type and looking at the ApproveOrderCreation value before it is returned to see if the value is what is expected. If it's not, you could probably fix the issue in the controller that handles the response from PayPal ...I'll know more over the next couple of days as I continue the refactor but it would be helpful if you keep me in the loop as to how you are getting on so that I can make certain that any mistakes are not repeated.
Hi Tito, I have the same requirement to decrement the inventory at the point of sale did you do this via a new task in the end?
Thanks, Simon
Thanks @Rusty, now i believe i understand it. So checking the PayPalPaymentProcessor class the authorize and initialize methods returned this payment result:
So changed it to:
Only in the CapturePayment method i return true. Now it works. What should i return on the RefundPayment method?
Yes, that is the way I'm doing it in the refactor.
The refund payment is a bit trickier since Merchello is not looking at that property at all since the order has already been created.
It is also store specific. Refunds can be partial refunds, total refunds ... etc for any number of reasons. Maybe the customer was unhappy with something or the product was damaged but the item was not returned.
This is also the case with void transactions, where their might have been a mistake or the back office staff wants to "void" a payment (say they went to PayPal and canceled there) but then calls in and wants to pay with a credit card.
A return workflow is something that is being planned - but as you can see it needs to be a completely different set of steps.
OK, i am looking forward that 2.0 version!!
Could you advance what new features will bring?
I have completed one merchello project and now 2 more in the process, each with its own custom approaches and now i am glad to have chosen Merchello, good job!
I have changed a lot of the bazaar controllers to make my own in order to make the site totally angularjs driven (one page checkout process, cart and account management). I havent used the extended product content as i find it trickier to use.
Hey Tito,
Yes, IProductContent would be trickier to use in angular. The display models are what is used in the back office of Merchello, that's really their main reason for there.
Merchello 2.0.0 does have some pretty big new features.
Notification emails can be based off a razor view located /Views/Merchello/Notification.
This allows for much easier email formatting and razor code in the view. By default the view itself inherits from a the new
MerchelloHelperViewPage<T>
which itself inherits fromUmbracoViewPage<t>
which gives you all the normal Umbraco goodies and an instantiated MerchelloHelper accessed via theMerchello
property.The Braintree payment provider (already added) and PayPal ExpressCheckout provider (wip) are being added to the Core install.
We've added the ability to adjust an invoice total with one or more "Adjustment" line items. This allows for giving a partial refund through the back office and adjusting the invoice balance so that the invoice can still have a zero balance. An adjustment can also be used for increasing the invoice total if that is needed for some reason.
We've extended the (what were sales) notes, to allow for marking them public or private and also record the user who authored the note.
The new notes mechanic was then to supersede the original Customer notes so that a thread of customer notes can be managed.
We've added the ability to checkout for a customer through the back office. The back office user can create a customer, go to the customers back office page and start adding items to their basket. A checkout button then appears at the bottom of the customer cart directive in the back office which opens a model to create an invoice. Payments are accepted on the SalesOverview page as they were before.
Another feature we added is a new logger that allows for logging to the standard Umbraco logs and also drop in a remote logger (I've done one for Sentry https://docs.getsentry.com/hosted/clients/csharp/) that can be configured in the merchello.config via a Pluggable object.
Other than that, there are some little bug fixes we've found or that have been reported.
Thats great!! i like the razor based notification emails (could you add more triggers in the default plugin?) and the checkout through the back office.
About the IProductContent, I dont use Product Detached Content as i think is hard to use for my clients, the create product work flow i think is something Merchello has to improve. So i use Umbraco content and create or update the merchello product behind the scenes. Only my client has to go to Merchello backoffice to create options and set inventory and to manage sales. Think of a product related to categories, brands, manufacturers, etc.... is easy to manage that in Umbraco, and to query using the umbraco api. I think it is hard to make this inside Merchello. Some things i would like to have in Merchello 2 would be:
Better Bazaar template integration inside Umbraco templates
Backoffice translation: as an spanish user there are lots of info not abled to be translated: Merchello tree, some headers in the listing tables (products: available, shippable, etc; sales, etc), and the most importand, inside a sale invoice there are lots of english words that i have to explain to my clients.
Hope there will be lots of enhancements in future versions of Merchello!
Thanks for the ideas.
A definite priority is always to make things easier for the end user and we're always looking for ideas.
With regards to the back office localization, I've been pecking at them as I find them. It's pretty easy to clean up as I come across them, but the back office is extensive and I don't hit every view we have on every sprint so it is a bit of a "piece meal" process. If you have time when you come across them, take a quick screen shot and post them as issues in the issue tracker - it would be very helpful.
It is more difficult to localize some of the error messages and things that are hard coded in the c# - these have to be done in stages (especially if they are in base classes people have used to derive their own extensions). Still it would be great to get them on the radar as I really only look at the back office in English.
Also, one of the things that I do, that you may be encountering, is to "try" add new keys to other language files (es-ES for example) in English as I add them with hopes the speakers of that language will update the files and submit them as pull requests.
As for the Bazaar, I'm hoping to start a refactoring soon. I was actually going to write a forum post on that. I'd really love to replace it with something a lot more generic, perhaps relying more on Umbraco macros that can be placed directly on templates in certain cases. All views and partials would also be moved to the Umbraco views folder and the themes engine would be removed.
Another initiative is to get rid of the Bazaar specific view models and use the new models builder now include in the Umbraco core (Umbraco 7.4.0). These are partial classes which, we think will be easier for people to extend and more feel even more like Umbraco.
The biggest problem is the portability of the existing Bazaar to a new version so the discussion is currently, do we simply make a new starter kit. There are a lot of people using the Bazaar so my feeling is that would also need to be maintained - and I don't have the bandwidth to maintain two starters, continue Merchello core improvements and do the extra project work I have going on that I have to do to keep the project going funding wise.
One idea, is to move the Bazaar into a separate project that community could help maintain. This has not worked so well in the past with other starter kits, but perhaps the Bazaar has enough traction that the community will be motivated at least enough nudge the platform in the direction to be an easy port to a new starter kit.
We would love your thoughts on this!
Keep the comments coming and we'll continue to work with the suggestions and get them into the core =)
About the localization, if i find keys in english in my es-ES xml file i will translate it. The problem is some words/phrases are now hard coded and dont have keys. I find them in the main screens in the backoffice, so i think they are easy to find.
For Bazaar i find a good solution to move for the partial views solution. Its what i have done in my projects. I have a Merchello folder in my partial views folder, as a "merchello" folder in my scripts folder. When i make a new project I copy this folders and i can use them as they are. This partial views are very generic and follow bootstrap 3, so they make the job and are easy to integrate. I have about 18 partial views. I dont mind sending a basic example project to you if you want to see my implementation, may be it will throw some ideas to you.
The idea is my main views dont know about merchello, so i could integrate merchello in a normal umbraco site.
I think current Bazaar project is now on github so people using it can mantain it while new starter kits goes in new directions.
It would be great to see you solution to give me an idea as to how you are working with it. If you would, send me a ping me on twitter so we can coordinate over DM.
It does sound like the direction we are considering is consistent with what you are already doing.
At the moment, the Bazaar solution is in the main Merchello repository. If we decide to do a completely new starter, the Bazaar itself would be moved to a separate public repository on GitHub.
Great, i will make an empty project and send it to you. You can follow me on twitter (@teeto) so i can send you pms!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.