Answer the question
In order to leave comments, you need to log in
How to add a category name to an image in ALT?
Hello. I need to add a category name to the alt for an online store to get a
category + product name. Now it takes pagetitle which is the title of the product. Please help me understand how to implement this. Thank you. This is a piece that is responsible for displaying imgs from the tpl.msProducts.row.ext chunk.
This thing displays the name of the category. $_modx->resource.pagetitle but they don't link together.
tried to write {$_modx->resource.pagetitle : $pagetitle } was not understood by modx ))
<a href="{$id | url}">
{if $small}
<div class="img_wrap"><img src="{$small}" alt="{$pagetitle}" title="{$pagetitle}"/></div>
{elseif $image?}
<div class="img_wrap"><img src="{'phpThumbOn' | snippet : ['input' => ($image), 'options' => 'wl=200&hp=200&hs=200']}" alt="{$pagetitle}" title="{$pagetitle}"/></div>
{else}
<div class="img_wrap"><img src="{'assets_url' | option}components/minishop2/img/web/ms2_small.png"
srcset="{'assets_url' | option}components/minishop2/img/web/[email protected]2x.png 2x"
alt="{$pagetitle}" title="{$pagetitle}"/></div>
{/if}
<p>{$pagetitle}</p>
</a>
Answer the question
In order to leave comments, you need to log in
What makes you so stormy, sometimes with a hair dryer, then ... not with a hair dryer))
{$_modx->resource.parent | resource : 'pagetitle'}
or
2 - I guess pdoTools is installed once you use MS2.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question