Magento – Magento Error report message show in alert box in ajax response

ajaxerrorreportsvirtual-products

I am adding virtual products to cart by my custom ajax function and now virtual products can only be added one in the cart.if i had second one in the cart it is generating error report as Nominal items can only be purchased as standlone.

I want to show this message on the alert box on the add to cart button page which should i get in the ajax response data.

MY code

$j.ajax({
                url: "<?php echo Mage::getUrl('customblocks/ajax/virtualpick2addtocart'); ?>",
                type: "POST",
                data: {pro_id:sel_pro_id,sel_pro_price:sel_pro_price},
                success: function(data){
                    //$j("#spinner1").hide();
                    location.href = checkout_url;
                },
                error: function(){
                }
            });

and my ajax add to cart code

$cart = Mage::getModel('checkout/cart');
    $cart->init();
    $cart->addProduct($_product,$params);
    $cart->save();

Thanks In Advance

Best Answer

virtual != nominal

Nominal products are products with recurring profiles, and in Magento 1.x these must be purchased separately. What you are attempting cannot be done without extensive customization (either with effort by yourself or via a third-party module).

Related Topic