Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Making custom scripts
 
Bob Lorentz
Jr. Member
 
Total Posts:  1
Joined:  2009-01-25
 

Hi everybody,

I’m new to Magento.

I’d like to make some PHP script that can add products to a magento cart, specifying qty and attributes. I have a site that collects user information and puts the right combination op products in a cart, working on OsCommerce right now.

I’ve looked about everywhere, and I find thousands of threads and code snippets, but not a tutorial with a general approach.
I guess the way to go is to make a script beginning with

1. require_once ‘app/Mage.php’;
2. umask(0);
3. 
4. $app = Mage::app(’default’);

At that point I’m stuck, because I don’t know what sessions to initiate, what functions to call etc.
Is there some sort of reference or even a hello world-level tutorial ?

Cheers,

Bob

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageParts
Guru
 
Avatar
Total Posts:  415
Joined:  2007-11-18
 

Magento is built on the Zend framework, which can make it a bit confusing to begin with. But as you are making a call to the Magento from an outside source I would recommend you to have a look at the API documentation.

Magento’s API
http://www.magentocommerce.com/support/magento_core_api

(You can create your own API functions if necessary)

How to build a custom module with a custom table in the database
http://www.magentocommerce.com/wiki/custom_module_with_custom_database_table

I’m not 100% sure of which files you might be looking for, but you can start your search in app/code/core/Mage/Checkout, app/code/core/Mage/Catalog and app/code/core/Mage/Sales. Good luck smile

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top