0

I wanted to link from a cms block within a product page to its corresponding amazon product which can be identified via an custom attribute called "asin".

So I have put the link like

<a href="https://www.amazon.de/gp/product/{{block type="core/template" template="amz/asinlinkinject.phtml"}}">...</a> 

and the idea was, that this injects the asin, stored in the repsective product...

But whats happening; it replaces the

{{...}}

with somwething like

"...ms_wysiwyg/directive/___directive/e3tibG9jayB0eXBlPSJjb..."

after I exit html mode and go back in wysiwig....

So I guess I am doing something totaly wrong here. How could i get the asin in the link?

{{block type="core/template" template="amz/asinlinkinject.phtml"}}

which is doing

<?php
  echo Mage::registry('current_product')->getasin();
 ?>

and it works fine as text outside the tag .

1 Answer 1

0

Move the whole A tag in the template file.

Your CMS block:

{{block type="some/customblock" template="amz/asinlinkinject.phtml"}}}

Your template amz/asinlinkinject.phtml:

<a href="https://www.amazon.de/gp/product/<?php echo Mage::registry('current_product')->getAsin(); ?>">...</a>

Add some/customblock as Allowed in Admin > System > Permissions > Blocks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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