Magento 1.9 Ajax Cart – Add a Text or Variable

ajaxcartmagento-1.9

please can you help to add a custom variable in the ajax popup cart?

I want to show a custom text under "Your product is added to the cart"

example: your product price is 45€, if you buy another item your shipping it will be free !

i tried to add a variable in cartcontroller.php but doesn't work,…what can I do?

thanks in advance

Alberto

Update

if (!$this->_getSession()->getNoCartRedirect(true)) {
                if (!$cart->getQuote()->getHasError()){
                    $message = $this->__( $this->__('%s was added to your shopping cart.') .'<br/><br/> <button class="button" onclick="setLocation(\''.Mage::getUrl('checkout/cart').'\');"><span><span>'. $this->__('View Cart') .'</span></span></button><button class="button" onclick="setLocation(\''.Mage::helper('checkout/url')->getCheckoutUrl().'\');"><span><span>'. $this->__('Checkout') .'</span></span></button>', Mage::helper('core')->escapeHtml($product->getName()));
                    $response['status'] = 'SUCCESS';
                    $response['message'] = $message;

                    $this->loadLayout();

this is the original part of cartcontroller.php,in this part of code after "%s was added to your shopping cart" i want to add a variable with the text inside.

i tried

$message = $this->__( $this->__('%s was added to your shopping cart.') echo"text";

or simply

    $mytext="mytext";    
$message = $this->__('%s was added to your shopping cart.'); echo $mytext;

Best Answer

Try

$mytext="mytext";
$productName = Mage::helper('core')->htmlEscape($product->getName());
$message = $this->__('%s was added to your shopping cart.', $productName) . ' ' . $this->__($mytext);

$message = $this->__('%s was added to your shopping cart.'); - assign a string to a variable.

echo $mytext; - Output info to screen