How to put PHP inside an echo?

0

How do I instead:

elseif ( $qtd == 1000 ) {
    echo $this->__('<b>produto customizável</b><br><span class="product-name">ENTRE EM CONTATO</span><div style="backgroud:#333">');    
}

Make this work:

elseif ( $qtd == 1000 ) {
    echo $this->__('<a class="askproduct popup" href="<?php echo Mage::getUrl('askfordetails/askfordetails', array('product_id' => $_product->getId())) ?>"><?php echo Mage::helper('askfordetails')->__('ENTRE EM CONTATO') ?></a>');  
}

Does anyone know if this is possible?

    
asked by anonymous 02.12.2014 / 03:03

1 answer

12

Just use concatenation. If you want to display dynamic content within the echo, use concatenation. In your case it would be:

elseif ( $qtd == 1000 ) {
    echo $this->__('<a class="askproduct popup" href="'.Mage::getUrl("askfordetails/askfordetails", array("product_id" => $_product->getId())).'">'.Mage::helper("askfordetails")->__("ENTRE EM CONTATO").'</a>');  
}

What was used there is simple to understand, instead of doing:

echo '<a href="<?php echo $variavel?>">Clique aqui</a>';

We do this:

echo '<a href="'.$variavel.'">Clique aqui</a>';
    
02.12.2014 / 05:35