Add to Cart API in Magento - php

I need to know how can I add products into cart using API. I have a list of products with details, I am trying to call the API from outside Magento. In which Magento's core class implements this function??
Thanks in Advance..

magento uses MVC and by looking at the cart link you can extract the path to the module, however
Mage_Checkout_CartController::addAction()
is the method you are looking for , remember that it is depending on session

In order to add to the cart you're going to have to implement your own API. That can be difficult because as Anton mentioned, it depends on session.
There was a project out there at one time, Mammoth Web Services, by some guys in the UK, but the project has gone silent.

If you have magento id's for your products this is fairly simple
http://yoursite.com/index.php/checkout/cart/add?product=product_id&qty=qty

http://www.magentocommerce.com/download/release_notes#Release%20Notes%20-%20Magento%201.4.2.0%20%28December%208,%202010%29
included in 1.4.2.0 apparently, though not on the official API documentation yet

Related

how to execute a query in magento when order is successfull

Im new to magento,
I need to execute a query to insert a flag into orders table of magento when an order is successful (i.e returned from payment page), Ive found the front end files, but not sure where to place the code to execute this simple query, Im not comfortable with folder structure of magento.
Im using magento 1.7 currently
Please help me if you know where is the controller file to achieve this, if you can give me the file paths and class names it will be much helpful for me to uderstand this.
You need to get the event for OrderAfterSave, In observer file, you will get the last order id by using that you could insert flag.
Here is the link to tutorial. Hope this will help
http://blog.decryptweb.com/event-observer-magento/
You should use an Observer for this as it is the cleanest method as you do not have to rewrite any core files.
See http://www.nicksays.co.uk/magento-events-cheat-sheet-1-7/ for a full list of observers in Magento 1.7
See http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/customizing_magento_using_event-observer_method for more information about using observers.
If you want to observer the order success action I would use checkout_onepage_controller_success_action there are many others regarding orders, something like checkout_type_onepage_save_order_after as it will give you access to the order object which you will not have to reinitialize.

Magento backend shipping selection

Heyhey,
I made a pretty kickass Magento 1.6 module to select a store and time to come pick stuff up at the shop, and it works fine in the front end. It doesn´t however appear in the backend, and the backend order creation system needs to have the same functionality.
How do I enable my module for backend order creation?
I'll supply any details needed!
Kind regards,
Alex
in the file:
/app/design/adminhtml/default/default/layout/sales.xml
around line 497 (on my version, which is Enterprise 1.10.0.1)
you should find
<adminhmtl_sales_order_create_index>
I strongly believe that has the information on what you want. Your module will need it's own layout xml file that references these areas to insert its own content. Then, you will need to hook into the order create event with an observer to run your own code to deal with the data. This may already be happening, as I'm not sure if the backend code creating the order is any different from the front end.
Hope this helps as a jumping off point.

Creating list from queries (Shopping cart like)

I need your help to get to the right direction on tackling this problem. I have a list of products from different vendors stored in the database. I wanted to be able to search through it and be able to add specific products and create a "Parts Order List". I was thinking of it like a shopping cart. The user should be able to browse/search through the product list and add certain products to the "cart" and then later view and print it. I'm stuck on what language to use. I'm familiar with PHP but from reading online this is mostly possible using CGI. What do you guys think? Any other Ideas? (Hope I make sense.)
Thanks in advance!!
If you're familiar with PHP why not use PHP then? Is there some reason you want to abandon what you know already to try something else?
EDIT
This beginner php tutorial on how to build a cart will teach you all you need to know about creating a similar system for your needs using sessions: http://v3.thewatchmakerproject.com/journal/276/building-a-simple-php-shopping-cart

Add my own shipping methods in oscommerece

I want to add an own shipping method during checkout_shipping.php. Something like a dropdown list, from that the customer will select his shipping method and enter his own account no in a textbox. How should I implement this?
Hey, I'm currently working on a project that involves OScommerce. I agree with Keyo, but I know that sometimes is not that it easy to migrate ;)
The payment methods are contribution, if you would like to build your own you have to build two files (at least, because there is one of the files that is the language)
Here you have direct access to a payment module made for mercadopago Argentina (like PayPal)
http://addons.oscommerce.com/info/6504
If you check the zip file you are going to see that the files have to be added in the catalog - include
then you have the one I already told (language)
and modules - payment.
I made a few payment methods my self, it's not hard, but you have to remember that OScommerce is like 6 years old, so the code is not the best ;)
I hope this helps.
P.S. If you want more payment methods you can look here:
addons.oscommerce.com/category/Payment_Modules

php product browser

I was wondering if anyone knows of a good script to manage a catalog of products. Just need basic stuff, like being able to browse by category and or tags and search. Without many extras, as I'd like to have it working inside a CMS.
softpedia has a few scripts, but I'm also considering creating it from scratch. Ideal would be something in between that allows a bit of customization and control of layout, but takes care of the backend. So adding editing and managing items should be simple.
any ideas?
--- edit ---
has anyone worked with http://www.oscommerce.com and can shed some light?
CubeCart is quite simplistic and easy to use, there's also osCommerce and Magento if your looking for a more advanced ecommerce system.
ZenCart is a popular solution, and free. Of course any (good) product listing app is going to be a shopping cart.
virtuemart may work out for you as well.. you can add it on top of joomla .. that way you would have a CMS to create and change the custom pages as well.. the other solutions are good too but they are more cart oriented.

Categories