Change layout to table

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
10 years 9 months ago #181880

-- HikaShop version -- : 2.3.3
-- Joomla version -- : 2.5.27
-- PHP version -- : 5.4

Hi ! Is it possible to add a custom field is this layout as in screenshots?

Attachments:

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 9 months ago #181905

Hi,

Yes it is possible.
You have to create an override of the product listing you're currently using and display the custom fields you want to display.
In the product listing, the product object will give you all product data, custom field including.

This documentation will help you for the basic steps of layout customization:
www.hikashop.com/support/support/documen...ize-the-display.html

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
10 years 9 months ago #182070

Can you tell me which template to edit?
And the code to show the description trimmed for greek language (without ?? if the word is cutted) .
I managed to do it before for a custom field, but I never did this for this layout (as in prntscr) and for a part of my description

Thanks!

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

  • Posts: 13201
  • Thank you received: 2322
10 years 9 months ago #182079

Hi,

You have to edit the view "product / listing_table" of your template.
To show trimmed description, you can use the code :

echo mb_substr($this->row->product_description),0,300);
To display the custom field value the code to use is:
echo $this->row->CUSTOMFIELD_NAME;

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

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
10 years 9 months ago #182233

It doesn t work for me.
I tried
<th class="hikashop_product_name title" align="center">
<?php echo JText::_( 'PRODUCT' );?>
<span class="hikashop_product_desc-cris">
<?php echo $this->row->short_desc_cris; ?> </span>
</th>


but I get nothing.
I tested its the right template. I wrote aaaa and I saw it.

Part of the message is hidden for the guests. Please log in or register to see it.

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

  • Posts: 13201
  • Thank you received: 2322
10 years 9 months ago #182238

Hi,

Are you sure that you have set a value in the custom field on the product edition page ?
Is the custom field a custom product field ?

Please set the Joomla error reporting level to "maximum" in order to see if the value is found or not.

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

  • Posts: 1115
  • Thank you received: 12
  • Hikashop Business
10 years 9 months ago #182446

I get this


Notice: Undefined property: ProductViewProduct::$row in /home/mpelis/public_html/templates/1b/html/com_hikashop/product/listing_table.php on line 43

Notice: Trying to get property of non-object in /home/mpelis/public_html/templates/1b/html/com_hikashop/product/listing_table.php on line 43

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 9 months ago #182495

Hi,

Depending where you place your code in the "listing_table" view "$this->row" might not be defined.
The code you pasted should be placed in the table header ; but you don't want to display the content of the line in the table header, you want to display it in the table body.

Header (where you do not have access to the products)

<th class="hikashop_product_name title" align="center">
	<?php echo JText::_( 'PRODUCT' );?>
</th>

Body (lines which are duplicated for each displayed product)
foreach($this->rows as $row){
	$this->row =& $row;
	/* content of the rows */
Where you find the display of the content, like the product name:
<td class="hikashop_product_name_row">
	<span class="hikashop_product_name">
		<?php if($this->params->get('link_to_product_page',1)){ ?>
			<a href="<?php echo $link;?>">
		<?php }
			echo $this->row->product_name;
		if($this->params->get('link_to_product_page',1)){ ?>
			</a>
		<?php } ?>
	</span>
	<?php if(!empty($this->row->extraData->afterProductName)) { echo implode("\r\n",$this->row->extraData->afterProductName); } ?>
</td>

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: verzevoul

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

Time to create page: 0.072 seconds
Powered by Kunena Forum