Showing the alias in the frontend (Help Please)

Phoca Cart - complex e-commerce extension
s4evision
Phoca Member
Phoca Member
Posts: 30
Joined: 07 Jan 2021, 15:41

Showing the alias in the frontend (Help Please)

Post by s4evision » 02 Aug 2021, 11:42

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:

User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 44438
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

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

Post by Jan » 05 Aug 2021, 16:30

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
If you find Phoca extensions useful, please support the project

s4evision
Phoca Member
Phoca Member
Posts: 30
Joined: 07 Jan 2021, 15:41

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

Post by s4evision » 27 Oct 2021, 09:01

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

User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 44438
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

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

Post by Jan » 03 Nov 2021, 15:35

Hi, I don't understand your code? I don't see any:

echo $x->alias;

in your code?
If you find Phoca extensions useful, please support the project

Post Reply