How I can create pricing tab add to cart url ?

I have create 1 product for add to cart url and my product id is 86 and my Purchase Button url is /checkout/cart/add/product/id/86 but when I click to button my cart show no product in cart please tell me how I can create add to cart button url ?

image of pricing tabimage of checkout


As per your screenshot and this snap /checkout/cart/add/product/id/86 , one way to add this product into cart is this, you need add manually add product to cart.

For example click on purchase button , on this click you get product id and pass this id on one controller action through ajax call something like.

<?php $sucessUrl = Mage::getUrl('yourmodule/controller/action'); ?>
            dataType : 'json',
            type: "POST",
            url: "<?php echo $sucessUrl; ?>",
            data: {product_id: id},
            success: function(data) {
                if(data.success == "1"){
                    alert('Error !! In Process');

now in your controller,

$productId = $_POST['product_id'];

        //echo "<pre>";print_r($productIds);die;
        $cart = Mage::getSingleton('checkout/cart');

            $product = new Mage_Catalog_Model_Product();
            $params = array(
                'product' => $productId,
                'qty' =>1,
                'sku' => ($product->getSku()) ? $product->getSku() : ''
            $cart->addProduct($product, $params);

            $message = $this->__('%s was successfully added to your shopping cart.', $product->getName());


            $response = array();
            $response['success'] = 1;
            $response['checkout_url'] = Mage::helper('checkout/cart')->getCartUrl();


so after ajax call complete you redirect to checkout cart page. This is custom addtocart process for your example.

Hop it's help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.