Modify an Order via the API prior to Invoicing? - magento

In the default Magento 1.7 install is it possible to modify an order via the API prior to it being invoiced? I know there is no mechanism to do this in the Admin without a module but wasn't sure if the new API connections may allow this to happen.
To clarify, the idea here is someone places an order and then decided that they want to add something else to the order. Ideally I would like to push this change via the API from our other inventory system as our CSRs do not use the Magento interface to handle invoicing or shipment details.

I'm afraid this is not possible with the default Magento API. See the Sales Order API documentation. You may hold or cancel the order but not edit its information.
If you edit an order in the Magento backend and save it, the old order is cancelled and a new order is created. These orders are recognisable by a special number format ("-[versionnumber]" is appended to the order number), see the Managing and Editing Orders documentation.
You may want to mimic this behaviour using the default Magento API.
Get the information from the current order.
Create a new cart, fill it with the corrected information and create a new order for this cart (see the Checkout/Cart API documentation for necessary methods).
Cancel the old order.
It won't be trivial, but it should be possible.

Related

Magento 2 - Transfer cart items from API to web store

I am creating a complex shopping configurator app that allows a user to customize and visualize a product which consists of multiple store items. Once they confirm their purchase, I iterate and add all of the selected products to a guest cart using the .../rest/V1/guest-carts API endpoint.
I would now like to forward the user to the store checkout to continue the purchasing process from the web store, e.g. https://store.url/checkout/cart. Of course, that basket needs to be populated with the items that were added via the API. I've looked through the documentation but not been able to find
anything relevant but I wonder if I can pass over the store_id or the quote_id and the relevant products be inserted accordingly?
Not sure if this is still relevant for you but, I was also working on a similar problem and came across this plugin for Magento 2. Basically what this plugin does is use a customer's token and a quote_id and creates a temporary session on the Magento2 Store and then redirect the user to the checkout page. This was a starting point for me, as I had to customize this plugin further to suit my requirements.
Hope this helps.

Magento Hooks - Will Magento allow me to do this?

I'm going to be starting a E-Commerce project and the client is interested in using Magento. In this project, when a customer adds something to the cart, I'll need to pull them out of the flow, where they'll proceed through a custom wizard-esque area.
They basically design a document using a drag and drop interface. After they finish, that document will be saved as a PDF, and I want them redirected to checkout
So my questions are
Does Magento have hooks available for after an item is added to the
cart ?
If I pull them away to this other section of the site (Wizard
portion), changes they make will potentially add costs to
their cart. Would I still have access to products, prices, and the
cart so that I can continue to modify their cart until they return
to checkout ?
Magento users Event-Observer pattern, where you can hook into virtually any action which is performed and execute your custom code,
Refer to below links,
http://inchoo.net/category/ecommerce/magento/events-observers/
https://gist.github.com/peterjaap/6973324
http://huztechbuzz.wordpress.com/2014/04/26/complete-list-of-all-events-in-magento/
http://www.nicksays.co.uk/magento-events-cheat-sheet-1-7/
So you have to figure out which event you can use and plugin your custom code.
As long as i remember all the cart info ( products/prices ) is stored in the $_SESSION. So you can get all the information from there you need, modify it via your so-called wizzard and udpate the session information after that!
Cheers! :)

Magento not creating order for M2Epro Orders

I have implemented M2Epro with magento.
I have used Ebay_Available_quantity attribute to set ebay available quantity.
But there are time where website normal stock is zero and product is out of stock and its still listing on ebay.
When someone buys it on ebay. It does make an order on M2Epro. But does not allow to make order as a magento order.
Is it because it is out of stock or quantity is zero ?
Can we have exceptions for third party sales ?
Thanks
Abhi
We also encountered this issue some time ago and this is what M2e answered on an email:
Thank you for provided details.
I checked your FBA order XXXX and I understand that you
want Magento order creation for FBA orders do not depend on stock
availability.
Let me please explain the logic how Magento orders are created. When
a channel order is imported in M2e Pro, M2e Pro checks settings
provided in Account settings > Orders tab. If corresponding settings
for Magento order creation are provided - M2E Pro sends a request to
Magento to create a Magento order for the channel order.
Magento orders are created due to Standard Magento functionality and
Core Models. Magento does not let to create an order if the product is
out of stock or 'disabled' or does not have available qty in Magento.
These requirements should be met so that the order was successfully
created.
M2e Pro cannot affect the logic of Magento orders creation process.
You can temporarily set 'in stock' status and qty available if you
want Magento order to be created at one for FBA order.
Hope this explanation will be helpful. Please let me know if I can
assist you with something else.
Next email:
Other our customers use backorders feature. As a possible workaround
for creation orders when product quantity is 0, you can allow for
needed products (product should be in stock, manage quantity - "yes".
This will allow Magento order creation for corresponding FBA order if
qty=0. You can set this parameter in Magento product inventory.
I have consulted with our development department on your case. As a
possible workaround, we can provide you with a part of the code which
is responsible for orders functionality. If your developers would be
able to adjust the needed changes, we would be glad to assist you.
Please also note, that we will not guarantee the proper work when some
custom modifications to the code are applied. In case this suggestion
is approved by your developers, please send us your confirmation and I
will send you a part of the code.
The code they wanted to provide was useless, it was just a hint that the magic happens in
app/code/community/Ess/M2ePro/Model/Order.php
public function createMagentoOrder()
which is quite obvious.
Please consider that backorders feature will bring other issues, so we do not use this and currently live with this situation as it is.
For me it is a quite important and standard situation to have FBA stock but no magento stock, so I don't understand why they don't fix the problem.
When time is available we will do a fix ourselves.

How to find which admin user posted the product?

Currently Im working on a magento project and it have a plugin developed by another team. This project have merchant logins also. But the issue I am facing now is. When I add a product from merchant panel, it is not getting displayed in his product list. It is shown in admin product list. I want to track down what userid is entering corresponding to that record inserting from merchant login.
In which table I have look? After searching a lot I believe they are not storing any userid corresponding to each product. But I am not sure about that. How can I confirm that?
Please help me
Thanks in advance
There is no such functionality in magento admin, as far as I know. But you can write your own module to controller_action_predispatch or to core_abstract_model_save_after(or something like this) events. And you will be able to see who did what.
UPDATE 1
If I am right, meaning this is not implemented, then you should your own custom logging module.
Module should use Observer functionality. If you want particullarly catch the product save, then you should catch the events of product saving.
here.
To compare product data you can see an example here.
Well to get current user you can read this example.
Moreover in case it is not enough, you may watch here, something might be interestring for you.

Magento Multiple Authorize.net Gateways

I have a CAD and USD gateway accounts for processing credit card payments, both from a payment provider with support for the Authorize.net API. I've successfully configured one using Magento's built-in Authorize.net support... but how can I configure a second Authorize.net Gateway for use in my store?
You can reuse the existing authorize.net gateway if you assign separate websites to each currency. They don't need to be actually separate websites with their own domain, just to be designated as websites in the System > Manage Stores menu. Then in Configuration change the Configuration Scope drop down box in the top left to select each website in turn, on the Currency Setup section allow just one currency and in Payment Methods section you can have your specific gateway accounts to match.
This way lets you continue to use the same products for all stores and as long as the base currency is unchanged then it will also continue to convert between currencies automatically.
This can be done, but basically requires you to duplicate the Authorize module and change all the namespaces. This will take some fiddling, but start by copying the app/code/core/Mage/Paygate module to somewhere like app/code/local/Yourcompany/Paygatecad and proceed to rename the classes (Mage_Paygate_Model_Authorizenet becomes Yourcompany_Paygatecad_Model_Authorizenet, etc). Be careful of case-sensitive file and class names, I suggest you use all leading capital followed by lowercase.
Create a Yourcompany_Paygatecad.xml module declaration in app/etc/modules, and duplicate the layout and template files in adminhtml and frontend to use your new module name. You'll also need to edit the system.xml and config.xml so that the config values don't conflict in namespace. grep is your friend.
After all that, you should get a new Payment Method in the System>Config>Payment Methods that you can configure with your CAD details, and the blocks should render in the Checkout flow.
As you've probably gathered from what I've said, there's a fair few changes to be made to avoid conflicts, and you'll need to test this really well. But it should work. I'm not aware of any alternative approach to achieve this... I've done this successfully when I've wanted two different set of options for another payment method and it worked, but that was for a community extension, not Magento core, not that it should really matter where you're copying it from.
--------EDIT-----
Ideally, what you should do is copy and modify only the etc and sql files. That way the
original Mage_Paygate Models and controllers will still be used (gives you best protection for upgrades/patches) and you just update the config values to point to the CAD instance. I can't confirm whether this will work, but I would try that if at all possible.
HTH,
JD

Resources