Page 1 of 1

Showing the alias in the frontend (Help Please)

Posted: 02 Aug 2021, 11:42
by s4evision
Hi Jan and Everyone

I want to know is it possible to display the alias in the item view of a product in the frontend.

Please let me know and thanks in advance. :idea:

Re: Showing the alias in the frontend (Help Please)

Posted: 05 Aug 2021, 16:30
by Jan
Hi, the alias is not displayed in item view but it is loaded there. The product object includes this value:

Image

so if you need to display it, you can create template override of the item output view:

components\com_phocacart\views\item\tmpl\default.php

The variable is included in foreach as $x->alias

Jan

Re: Showing the alias in the frontend (Help Please)

Posted: 27 Oct 2021, 09:01
by s4evision
Hi Everyone

if added this code to show the alias in item view.

if (isset($x->alias) && $x->alias != '') {
echo '<div class="ph-item-alias-box">';
echo '<div class="ph-alias-txt">'.JText::_('COM_PHOCACART_alias').':</div>';
echo '<div class="ph-alias">';
echo PhocacartRenderFront::displayLink($x->alias, $x->aliaslink);
echo '</div>';
echo '</div>';
echo '<div class="ph-cb"></div>';
}

in public_html/components/com_phocacart/views/item/tmpl/default.php

And it works fine but it shows it incorrectly.

Alias:
99210

My question is how can I get the code or alias to appear next to it like this. :idea:

Alias: 99210

Please let me know
Thanks in advance

Re: Showing the alias in the frontend (Help Please)

Posted: 03 Nov 2021, 15:35
by Jan
Hi, I don't understand your code? I don't see any:

echo $x->alias;

in your code?