Product Code under Specifications

  • Posts: 129
  • Thank you received: 2
10 years 2 weeks ago #213136

-- HikaShop version -- : Hikashop Business 2.5.0
-- Joomla version -- : 3.4.3
-- Browser(s) name and version -- : Chrome

Hi,
I'm using the tabular design on my shop. Right now, under the specifications tab, it shows me "weight" and "manufacturer". I'd like to add "Product code", but when I enable it on the main System / Display it only shows me the product code just besides the name of the product. Is there any way to make it appear under the specifications tab?

Thank you.

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

  • Posts: 84310
  • Thank you received: 13701
  • MODERATOR
10 years 2 weeks ago #213157

Hi,

Yes, keep the option turned off, and add such line in the file "show_block_dimensions" via the menu Display>Views:
<?php echo $this->element->product_code; ?>

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

  • Posts: 129
  • Thank you received: 2
10 years 2 weeks ago #213193

Thanks for the answer Nicolas. Unfortunetly, I add the line, and nothing appears yet. Here's how I added it (last line):

<?php
/**
 * @package	HikaShop for Joomla!
 * @version	2.5.0
 * @author	hikashop.com
 * @copyright	(C) 2010-2015 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(isset($this->element->main)){
	if($this->element->product_weight==0 && isset($this->element->main->product_weight)){
		$this->element->product_weight = $this->element->main->product_weight;
	}
	if($this->element->product_width==0 && isset($this->element->main->product_width)){
		$this->element->product_width = $this->element->main->product_width;
	}
	if($this->element->product_height==0 && isset($this->element->main->product_height)){
		$this->element->product_height = $this->element->main->product_height;
	}
	if($this->element->product_length==0 && isset($this->element->main->product_length)){
		$this->element->product_length = $this->element->main->product_length;
	}
}
if ($this->config->get('weight_display', 0)) {
	if(isset($this->element->product_weight) && bccomp($this->element->product_weight,0,3)){ ?>
		<span id="hikashop_product_weight_main" class="hikashop_product_weight_main">
			<?php echo JText::_('PRODUCT_WEIGHT').': '.rtrim(rtrim($this->element->product_weight,'0'),',.').' '.JText::_($this->element->product_weight_unit); ?><br />
		</span>
	<?php
	}
}

if ($this->config->get('dimensions_display', 0) && bccomp($this->element->product_width, 0, 3)) {
?>
	<span id="hikashop_product_width_main" class="hikashop_product_width_main">
		<?php echo JText::_('PRODUCT_WIDTH').': '.rtrim(rtrim($this->element->product_width,'0'),',.').' '.JText::_($this->element->product_dimension_unit); ?><br />
	</span>
<?php
}
if ($this->config->get('dimensions_display', 0) && bccomp($this->element->product_length, 0, 3)) {
?>
	<span id="hikashop_product_length_main" class="hikashop_product_length_main">
		<?php echo JText::_('PRODUCT_LENGTH').': '.rtrim(rtrim($this->element->product_length,'0'),',.').' '.JText::_($this->element->product_dimension_unit); ?><br />
	</span>
<?php
}
if ($this->config->get('dimensions_display', 0) && bccomp($this->element->product_height, 0, 3)) {
?>
	<span id="hikashop_product_height_main" class="hikashop_product_height_main">
		<?php echo JText::_('PRODUCT_HEIGHT').': '.rtrim(rtrim($this->element->product_height,'0'),',.').' '.JText::_($this->element->product_dimension_unit); ?><br />
	</span>
<?php
}
if($this->config->get('manufacturer_display', 0) && !empty($this->element->product_manufacturer_id)){
	$class = hikashop_get('class.category');
	$manufacturer = $class->get($this->element->product_manufacturer_id);
	$menuClass = hikashop_get('class.menus');
	$Itemid = $menuClass->loadAMenuItemId('manufacturer','listing');
	if(empty($Itemid)){
		$Itemid = $menuClass->loadAMenuItemId('','');
	}
	$categoryClass = hikashop_get('class.category');
	$categoryClass->addAlias($manufacturer);
	echo JText::_('MANUFACTURER').': '.'<a href="'.hikashop_contentLink('category&task=listing&cid='.$manufacturer->category_id.'&name='.$manufacturer->alias.'&Itemid='.$Itemid,$manufacturer).'">'.$manufacturer->category_name.'</a>';
}
<?php echo $this->element->product_code; ?>

Am I doing anything wrong? (sorry but I'm a noob on coding)

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

  • Posts: 84310
  • Thank you received: 13701
  • MODERATOR
10 years 2 weeks ago #213218

Hi,

Then it probably means that you edited the view file for another template than the template you're using on your frontend.

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

  • Posts: 129
  • Thank you received: 2
10 years 2 weeks ago #213323

I'm using styles. Could it be that?

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

  • Posts: 84310
  • Thank you received: 13701
  • MODERATOR
10 years 1 week ago #213325

No. Did you check that you were editing the view file for the correct template ?
It could also be that you have caching activated in Joomla. So try to flush the cache of Joomla.

I don't see any other reason.

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

  • Posts: 129
  • Thank you received: 2
10 years 1 week ago #213478

Hi Nicolas, thank you very much for your help.

Effectively, I was coding the wrong file (didn't realized there was a fil for every template).

So I added the code to the right template, and it completely destroys the template. I attach 2 screenshots, one with the added code, that as you see looks like a mess and there's loads of missing info, and one with the normal appearance without the code.

Any idea why this happens? Thank you.



Attachments:

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

  • Posts: 84310
  • Thank you received: 13701
  • MODERATOR
10 years 1 week ago #213480

It mean that the code was added in a place of the file which is invalid.
If you turn on the "error reporting" setting of the Joomla configuration, you should get an error message telling you what's worng on the product page.
Also, if you could provide a screenshot of the change you made where exactly in the file, that would help us tell you what is wrong with it.

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

  • Posts: 129
  • Thank you received: 2
10 years 1 week ago #213551

Hi Nicolas, thank you for your help.

Here's how I added the code:

<?php
/**
 * @package	HikaShop for Joomla!
 * @version	2.5.0
 * @author	hikashop.com
 * @copyright	(C) 2010-2015 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
if(isset($this->element->main)){
	if($this->element->product_weight==0 && isset($this->element->main->product_weight)){
		$this->element->product_weight = $this->element->main->product_weight;
	}
	if($this->element->product_width==0 && isset($this->element->main->product_width)){
		$this->element->product_width = $this->element->main->product_width;
	}
	if($this->element->product_height==0 && isset($this->element->main->product_height)){
		$this->element->product_height = $this->element->main->product_height;
	}
	if($this->element->product_length==0 && isset($this->element->main->product_length)){
		$this->element->product_length = $this->element->main->product_length;
	}
}
if ($this->config->get('weight_display', 0)) {
	if(isset($this->element->product_weight) && bccomp($this->element->product_weight,0,3)){ ?>
		<span id="hikashop_product_weight_main" class="hikashop_product_weight_main">
			<?php echo JText::_('PRODUCT_WEIGHT').': '.rtrim(rtrim($this->element->product_weight,'0'),',.').' '.JText::_($this->element->product_weight_unit); ?><br />
		</span>
	<?php
	}
}

if ($this->config->get('dimensions_display', 0) && bccomp($this->element->product_width, 0, 3)) {
?>
	<span id="hikashop_product_width_main" class="hikashop_product_width_main">
		<?php echo JText::_('PRODUCT_WIDTH').': '.rtrim(rtrim($this->element->product_width,'0'),',.').' '.JText::_($this->element->product_dimension_unit); ?><br />
	</span>
<?php
}
if ($this->config->get('dimensions_display', 0) && bccomp($this->element->product_length, 0, 3)) {
?>
	<span id="hikashop_product_length_main" class="hikashop_product_length_main">
		<?php echo JText::_('PRODUCT_LENGTH').': '.rtrim(rtrim($this->element->product_length,'0'),',.').' '.JText::_($this->element->product_dimension_unit); ?><br />
	</span>
<?php
}
if ($this->config->get('dimensions_display', 0) && bccomp($this->element->product_height, 0, 3)) {
?>
	<span id="hikashop_product_height_main" class="hikashop_product_height_main">
		<?php echo JText::_('PRODUCT_HEIGHT').': '.rtrim(rtrim($this->element->product_height,'0'),',.').' '.JText::_($this->element->product_dimension_unit); ?><br />
	</span>
<?php
}
if($this->config->get('manufacturer_display', 0) && !empty($this->element->product_manufacturer_id)){
	$class = hikashop_get('class.category');
	$manufacturer = $class->get($this->element->product_manufacturer_id);
	$menuClass = hikashop_get('class.menus');
	$Itemid = $menuClass->loadAMenuItemId('manufacturer','listing');
	if(empty($Itemid)){
		$Itemid = $menuClass->loadAMenuItemId('','');
	}
	$categoryClass = hikashop_get('class.category');
	$categoryClass->addAlias($manufacturer);
	echo JText::_('MANUFACTURER').': '.'<a href="'.hikashop_contentLink('category&task=listing&cid='.$manufacturer->category_id.'&name='.$manufacturer->alias.'&Itemid='.$Itemid,$manufacturer).'">'.$manufacturer->category_name.'</a>';
}
<?php echo $this->element->product_code; ?>

And when I turn on error reporting it shows the following:

Parse error: syntax error, unexpected '<' in /home/ukxvnfyr/tiendamat.com/shop/templates/shape5_vertex/html/com_hikashop/product/show_block_dimensions.php on line 67

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

  • Posts: 12953
  • Thank you received: 1778
10 years 1 week ago #213558

Hello,
You should replace that line :

<?php echo $this->element->product_code; ?>
By :
echo $this->element->product_code;
Through the file "show_block_dimensions" of the "product" view of your front-end template via "Hikashop->Display->Views".

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

  • Posts: 129
  • Thank you received: 2
10 years 1 week ago #213640

Thank you Mohamed.

It now appears under the specifications tab, but, as you can see in the image attached, it goes right after the manufacturer instead of going behind. Also, is there a way to put "code number:" before the number?

Thank you.


Attachments:

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 1 week ago #213648

Hi,

You can put HTML content and use PHP/Joomla to display translated text.
So yes, for sure you can do it.

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: 129
  • Thank you received: 2
9 years 4 months ago #237688

Hello,
I'm getting back this topic, since I haven't been able to repair this. I'm sorry but I'm totally numbless about php, and don't know how to make appear "code number" in another line to show the code number in the right place and not like it appears. Could you please help me?

Thank you very much

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

  • Posts: 84310
  • Thank you received: 13701
  • MODERATOR
9 years 4 months ago #237689

Hi,

Making it appear on a new line and adding some text before can be done like that:

echo '<br/>code number:'.$this->element->product_code;

The following user(s) said Thank You: vanway

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

  • Posts: 129
  • Thank you received: 2
9 years 4 months ago #237774

Worked amazingly.
Thank you very much Nicolas!

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

Time to create page: 0.075 seconds
Powered by Kunena Forum