Same product description for all products!

  • Posts: 177
  • Thank you received: 1
11 years 1 month ago #166290

Hi All,
i would like to create the same product description for all products (i'm selling just one kind of product but with more options)
How can i do this?
Obviously, for each language.

Thanks in advance
Andrea

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

  • Posts: 84301
  • Thank you received: 13697
  • MODERATOR
11 years 1 month ago #166296

Hi,

The simplest is to edit the file "show" of the view "product" via the menu Display>Views and add at the beginning something like that:

<?php
$lang = JFactory::getLanguage();
switch($lang ->getTag()){
 default:
 case 'en-GB':
  $this->element->product_description = 'My description in english';
  break;
 case 'fr-FR':
  $this->element->product_description = 'Ma description en francais';
  break;
}
?>

Last edit: 11 years 1 month ago by Jerome. Reason: code fix

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

  • Posts: 177
  • Thank you received: 1
11 years 1 month ago #166334

Thanks Nicolas,
but, in 'My description in english? can i put a HTML code?

Because, description has a table and image inside.

Thanks

Andrea

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
11 years 1 month ago #166352

Hi,

Yes, you can.
And you can also use Joomla tags.

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: 177
  • Thank you received: 1
11 years 1 month ago #166487

Hi All,
i've tried to put at the beginning the code, but it dosn't work.

<?php
$lang = JFactory::getLanguage();
switch($language->getTag()){
 default:
 case 'en-GB':
  $this->element->product_description = 'English Test';
  break;
 case 'it-IT':
  $this->element->product_description = 'Prova Italiano';
  break;
}
?>
<?php
/**
 * @package	HikaShop for Joomla!
 * @version	2.3.1
 * @author	hikashop.com
 * @copyright	(C) 2010-2014 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div id="hikashop_product_top_part" class="hikashop_product_top_part">
<?php if(!empty($this->element->extraData->topBegin)) { echo implode("\r\n",$this->element->extraData->topBegin); } ?>
	<h1>
		<span id="hikashop_product_name_main" class="hikashop_product_name_main">
			<?php
			if (hikashop_getCID('product_id')!=$this->element->product_id && isset ($this->element->main->product_name))
				echo $this->element->main->product_name;
			else
				echo $this->element->product_name;
			?>
		</span>
		<?php if ($this->config->get('show_code')) { ?>
		<span id="hikashop_product_code_main" class="hikashop_product_code_main">
			<?php
			echo $this->element->product_code;
			?>
		</span>
		<?php } ?>
	</h1>
<?php if(!empty($this->element->extraData->topEnd)) { echo implode("\r\n",$this->element->extraData->topEnd); } ?>
<?php
	$pluginsClass = hikashop_get('class.plugins');
	$plugin = $pluginsClass->getByName('content', 'hikashopsocial');
	if(!empty($plugin) && (@$plugin->published || @ $plugin->enabled)) {
		echo '{hikashop_social}';
	}
?>
</div>
<?php if(HIKASHOP_RESPONSIVE){ ?>
	<div class="row-fluid">
<?php } ?>
<div id="hikashop_product_left_part" class="hikashop_product_left_part span6">
	<?php
	if(!empty($this->element->extraData->leftBegin)) { echo implode("\r\n",$this->element->extraData->leftBegin); }

	$this->row = & $this->element;
	$this->setLayout('show_block_img');
	echo $this->loadTemplate();

	if(!empty($this->element->extraData->leftEnd)) { echo implode("\r\n",$this->element->extraData->leftEnd); }
	?>
</div>

<div id="hikashop_product_right_part" class="hikashop_product_right_part span6">
	<?php
	if(!empty($this->element->extraData->rightBegin))
		echo implode("\r\n",$this->element->extraData->rightBegin);
	?>
	<div id="hikashop_product_vote_mini" class="hikashop_product_vote_mini">
		<?php
		$config =& hikashop_config();
		if($this->params->get('show_vote_product') == '-1'){
			$this->params->set('show_vote_product',$config->get('show_vote_product'));
		}
		if($this->params->get('show_vote_product')){
			$js = '';
			$this->params->set('vote_type','product');
			if(isset($this->element->main)){
				$product_id = $this->element->main->product_id;
			}else{
				$product_id = $this->element->product_id;
			}
			$this->params->set('vote_ref_id',$product_id);
			echo hikashop_getLayout('vote', 'mini', $this->params, $js);
		}
		?>
	</div>
	<span id="hikashop_product_price_main" class="hikashop_product_price_main">
		<?php
		if ($this->params->get('show_price')) {
			$this->row = & $this->element;
			$this->setLayout('listing_price');
			echo $this->loadTemplate();
		}
		?>
	</span>
	<?php
	if(!empty($this->element->extraData->rightMiddle))
		echo implode("\r\n",$this->element->extraData->rightMiddle);
	?>
	<?php
		$this->setLayout('show_block_dimensions');
		echo $this->loadTemplate();
	?><br />
	<?php
	if($this->params->get('characteristic_display')!='list'){
		$this->setLayout('show_block_characteristic');
		echo $this->loadTemplate();
		?>
		<br />
	<?php
	}

	$form = ',0';
	if (!$this->config->get('ajax_add_to_cart', 1)) {
		$form = ',\'hikashop_product_form\'';
	}
	if (hikashop_level(1) && !empty ($this->element->options)) {
	?>
		<div id="hikashop_product_options" class="hikashop_product_options">
			<?php
			$this->setLayout('option');
			echo $this->loadTemplate();
			?>
		</div>
		<br />
		<?php
		$form = ',\'hikashop_product_form\'';
		if ($this->config->get('redirect_url_after_add_cart', 'stay_if_cart') == 'ask_user') {
		?>
			<input type="hidden" name="popup" value="1"/>
		<?php
		}
	}
	if (!$this->params->get('catalogue') && ($this->config->get('display_add_to_cart_for_free_products') || !empty ($this->element->prices))) {
		if (!empty ($this->itemFields)) {
			$form = ',\'hikashop_product_form\'';
			if ($this->config->get('redirect_url_after_add_cart', 'stay_if_cart') == 'ask_user') {
			?>
				<input type="hidden" name="popup" value="1"/>
			<?php
			}
			$this->setLayout('show_block_custom_item');
			echo $this->loadTemplate();
		}
	}
	$this->formName = $form;
	if($this->params->get('show_price')){ ?>
		<span id="hikashop_product_price_with_options_main" class="hikashop_product_price_with_options_main">
		</span>
	<?php }
	if(empty ($this->element->characteristics) || $this->params->get('characteristic_display')!='list'){ ?>
		<div id="hikashop_product_quantity_main" class="hikashop_product_quantity_main">
			<?php
			$this->row = & $this->element;
			$this->ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form\')){ return hikashopModifyQuantity(\'' . $this->row->product_id . '\',field,1' . $form . ',\'cart\'); } else { return false; }';
			$this->setLayout('quantity');
			echo $this->loadTemplate();
			?>
		</div>
	<?php } ?>
	<div id="hikashop_product_contact_main" class="hikashop_product_contact_main">
		<?php
		$contact = $this->config->get('product_contact',0);
		if (hikashop_level(1) && ($contact == 2 || ($contact == 1 && !empty ($this->element->product_contact)))) {
			$empty = '';
			$params = new HikaParameter($empty);
			global $Itemid;
			$url_itemid='';
			if(!empty($Itemid)){
				$url_itemid='&Itemid='.$Itemid;
			}
			echo $this->cart->displayButton(JText :: _('CONTACT_US_FOR_INFO'), 'contact_us', $params, hikashop_completeLink('product&task=contact&cid=' . $this->element->product_id.$url_itemid), 'window.location=\'' . hikashop_completeLink('product&task=contact&cid=' . $this->element->product_id.$url_itemid) . '\';return false;');
		}
		?>
	</div>
	<?php
	if(!empty($this->fields)){
		$this->setLayout('show_block_custom_main');
		echo $this->loadTemplate();
	}
	?>
	<span id="hikashop_product_id_main" class="hikashop_product_id_main">
		<input type="hidden" name="product_id" value="<?php echo $this->element->product_id; ?>" />
	</span>
	<?php
	if(!empty($this->element->extraData->rightEnd))
		echo implode("\r\n",$this->element->extraData->rightEnd);
	?>
</div>
<?php if(HIKASHOP_RESPONSIVE){ ?>
	</div>
<?php } ?>
<div id="hikashop_product_bottom_part" class="hikashop_product_bottom_part">
	<?php
	if(!empty($this->element->extraData->bottomBegin))
		echo implode("\r\n",$this->element->extraData->bottomBegin);
	?>
	<div id="hikashop_product_description_main" class="hikashop_product_description_main">
		<?php
		echo JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$this->element->product_description));
		?>
	</div>
	<span id="hikashop_product_url_main" class="hikashop_product_url_main">
		<?php
		if (!empty ($this->element->product_url)) {
			echo JText :: sprintf('MANUFACTURER_URL', '<a href="' . $this->element->product_url . '" target="_blank">' . $this->element->product_url . '</a>');
		}
		?>
	</span>
	<?php
	$this->setLayout('show_block_product_files');
	echo $this->loadTemplate();
	?>
	<?php
	if(!empty($this->element->extraData->bottomMiddle))
		echo implode("\r\n",$this->element->extraData->bottomMiddle);
	?>
	<?php
	if(!empty($this->element->extraData->bottomEnd))
		echo implode("\r\n",$this->element->extraData->bottomEnd);
	?>
</div>

Where is the issue?

Thanks

Andrea

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

  • Posts: 84301
  • Thank you received: 13697
  • MODERATOR
11 years 1 month ago #166492

Hi,

If you don't see any change, then it means that you're not editing the view file for the current template on your frontend. Please make sure that you're editing the view for the template you're using when you're in the menu Display>Views.

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

  • Posts: 177
  • Thank you received: 1
11 years 1 month ago #166556

Yes, i'm sure. The template is correct and also the file.
Nothing happened.

Can you help me?

Thanks

Andrea

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

  • Posts: 84301
  • Thank you received: 13697
  • MODERATOR
11 years 1 month ago #166574

Hi,

Please provide a backend access via our contact form so that we can check your settings and the change:
www.hikashop.com/contact-us.html
Please provide a link to this thread in your message

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

  • Posts: 177
  • Thank you received: 1
11 years 1 month ago #166650

i did it.

Thanks

Andrea

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
11 years 1 month ago #166897

Hi,

I checked the code and there was a PHP misspelling in the code that Nicolas provided you which made an error.
I fixed the code in the Nicolas post and I put it in your "show" view in order to provide you a working sample.

I saw that you're using some variants. Please note that if you put a description in the variant, it won't be override by the code we provided you (it will require other kind of code to override the variants' descriptions)

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: 177
  • Thank you received: 1
11 years 1 month ago #166918

Hi Jerome,
thanks for reply and your help. Don't worry about variants because i'd like to write the options in main description.

Many thanks!!

Andrea

Last edit: 11 years 1 month ago by andreasuriani. Reason: solved

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

  • Posts: 177
  • Thank you received: 1
11 years 4 weeks ago #167131

Hi All,
is it possible include in this code another code? I mean, the code works perfectly, but i'd like to create 2 kinds of description 1of all products (called global) and 1 of single product.:
Example:

Product 1
Description (Input on product insert) : Bla Bla Bla (Ita) and bu bu bu (Eng)

Show product on FrontEnd:
Product 1 (ITA)
Bla Bla Bla
Description global

Is it possible?
Thanks
Andrea

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
11 years 4 weeks ago #167134

Hi,

I don't understand your message or what your want to achieve exactly but : Yes, it's possible.
You can use a product custom field in order to know if it's "global" or not "global".
It will require some PHP/development skills.

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: 177
  • Thank you received: 1
11 years 4 weeks ago #167192

Can you help me with the code ?

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

  • Posts: 84301
  • Thank you received: 13697
  • MODERATOR
11 years 4 weeks ago #167195

Hi,

We already are far from standard user support here.
If you need someone to do custom development for you, I would recommend that you request a quote to our partners ( www.hikashop.com/home/our-partners.html ) and/or via our commercial jobs forum so that a third party developer can do that for you.

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

Time to create page: 0.081 seconds
Powered by Kunena Forum