开发者

Add image or file to Cart using code Magento [duplicate]

This question already exists: Closed 11 years ago.

Possible Duplicate:

开发者_如何学编程Magento attach a file to order or product in cart

How to do I add image to Cart The image will be on the host sever. I know this can be done through custom option on the product page. Is it possible to add it through Querystring.

require_once \'app/Mage.php\';
umask(0);
Mage::app();

Mage::getSingleton(\'core/session\', array(\'name\'=>\'frontend\'));

$cart = Mage::getSingleton(\'checkout/cart\');
cart->addProduct(108, array(\'qty\' => 1,\'super_attribute\'=>array(\'502\'=>\'46\')));

$cart->save();
$cart_count = $cart->getItemsCount();


If I'm understanding your question correctly you want to be able to add a product to the cart with an option:

http://your.site.com/checkout/cart/add/product/29/?super_attribute[502]=46&qty;=1

Reference: http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/catalog/adding_a_product_to_the_cart_via_querystring

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜