Posted by: james | October 7, 2009

For Calc…

First of all create One Product with no quantity, no price and  all that.. just give sku and name.

$dst = Mage::getBaseDir(‘media’)
so in $dst you will get Directory structure upto media so to get main remoave media from bracket and then use that in this function.

use this under url, if you get success then no prob but if you get any failure then check by default url and generate that random key, because per product its unique, so may be from that you will get it.

or use that function getAddToCartUrl and pass object of product of model class..

onClick = setLocation(‘$dst/checkout/cart/add/product/id’)
Add To Cart == window.location()

so now your product will add to cart and you will redirect to checkout page, so frontend complete…

now for admin panel

public function getAddToCartUrl($product, $additional = array())
{
$additional = array();

if ($this->getRequest()->getParam(‘wishlist_next’)){
$additional[‘wishlist_next’] = 1;
}

return $this->helper(‘checkout/cart’)->getAddUrl($product, $additional);
}
<button onclick=”setLocation(‘<?php echo $this->getAddToCartUrl($_product) ?>’)”><span><?php echo $this->__(‘Add to Cart’) ?></span></button>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: