Created
September 2, 2011 17:11
-
-
Save rsanchez/1189187 to your computer and use it in GitHub Desktop.
CartThrob add to cart outside of CT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$this->EE =& get_instance(); | |
$this->EE->load->add_package_path(PATH_THIRD.'cartthrob/'); | |
$this->EE->load->library('cartthrob_loader'); | |
$params = array( | |
'product_id' => 37, //your entry_id | |
'item_options' => array(), //ie, 'product_size' => 'L', | |
'quantity' => 1, | |
'class' => 'product', | |
); | |
$item = $this->EE->cartthrob->cart->add_item($params); | |
//do this if you are in your own module action, as opposed to a cartthrob extension | |
$this->EE->cartthrob->cart->save(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!