Need help obtaining a SEF URL in PHP view

  • Posts: 639
  • Thank you received: 16
  • Hikashop Business
10 years 8 months ago #183538

-- HikaShop version -- : 2.3.4
-- Joomla version -- : 2.5
-- PHP version -- : 5.5.18

Now to obtain the URL of a product I use this code which was suggested long ago by HikaShop suppor tTema:

<?php echo '<a href="'.JURI::base().'index.php?option=com_hikashop&ctrl=product&task=show&cid='.$this->row->product_id.'&name='.$this->row->product_alias.'">'.$this->row->product_code.'</a>';?>

Now is very necessary for me to obtain the same urls already 'SEFed'.

Please could you suggest me a code to do so?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 8 months ago #183556

Hi,

The best way will be to create a product listing menu, it can be a hidden one, and then use the url

<?php echo '<a href="/menu-alias/'.$this->row->product_id.'-'.$this->row->product_alias.'">'.$this->row->product_code.'</a>";

Please Log in or Create an account to join the conversation.

  • Posts: 639
  • Thank you received: 16
  • Hikashop Business
10 years 8 months ago #183666

I'm trying this inside a product listing_div.

I can't get the value for this expresion:

.$this->row->product_alias.

I get a blank value. I wonder if inside a product listing this should be written slightly different.

Any clue?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 8 months ago #183775

Hi,

In the view "product / listing_div" you have to use "$row" in the foreach instead of "$this->row".
"$this->row" is if you use the code in the view, for example, "product / listing_img_title".

Please Log in or Create an account to join the conversation.

Time to create page: 0.068 seconds
Powered by Kunena Forum