Home page featured products link to actual page

  • Posts: 191
  • Thank you received: 5
11 years 2 months ago #163608

Hello,

I have added some featured products to the home page. When you click on a product it is not a page that is in the menu so I cannot add modules to it.

Example:
Link from home page:
www.fsfightgear.com.au/website/index.php...3-bad-boy-mma-shorts

Link from shop page (how the page should be):
www.fsfightgear.com.au/website/index.php...3-bad-boy-mma-shorts

The ideal would be to remove the 'component' and the 'hikashop' in the home page link url. Also, is there a way of removing 'shop-categories' and 'product' from the url? And if you click on category the 'shop-categories' and 'category'. The url's are very long.

Thank you
Regards
Lene

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

  • Posts: 13201
  • Thank you received: 2322
11 years 2 months ago #163615

Hi,

In the HikaShop settings of your related product module, you have to select another value for the option "Menu".
Just select a categories listing menu with a better url.

For the long urls, you can edit the settings in Configuration > Features > SEF in order to use smaller urls.

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

  • Posts: 191
  • Thank you received: 5
11 years 2 months ago #163760

Hello,

That is great, that was an easy fix.

Thank you!
Regards
Lene

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

  • Posts: 191
  • Thank you received: 5
11 years 1 month ago #165650

Hello,

I just discovered that the the featured products links to two different url's depending on where you click.

If you click on the image or the title it will take you to this page:
www.fsfightgear.com.au/website/index.php...3-bad-boy-mma-shorts

If you click on the 'choose options' it takes you to this page:
www.fsfightgear.com.au/website/index.php...3-bad-boy-mma-shorts

How can i make the 'choose options' go to the first link?

www.fsfightgear.com.au/website/

Thank you
Regards
Lene

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

  • Posts: 13201
  • Thank you received: 2322
11 years 1 month ago #165671

Hi,

Thanks to edit the view "product / quantity" and replace:

				if($this->params->get('add_to_cart',1)) echo $this->cart->displayButton(JText::_('CHOOSE_OPTIONS'),'choose_options',$this->params,hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$url_itemid.$this->category_pathway),'window.location = \''.str_replace("'","\'",hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$url_itemid.$this->category_pathway)).'\';return false;','');
By:
				if($this->params->get('add_to_cart',1)) echo $this->cart->displayButton(JText::_('CHOOSE_OPTIONS'),'choose_options',$this->params,hikashop_contentLink('product&task=show&cid='.$this->row->product_id.'&name='.$this->row->alias.$this->itemid.$this->category_pathway,$this->element),'window.location = \''.str_replace("'","\'",hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$url_itemid.$this->category_pathway)).'\';return false;','');

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

  • Posts: 191
  • Thank you received: 5
11 years 1 month ago #165941

Hi,

I tried the change for the home page template and the default template, in line 95, 117, 145 and 157 but it did not change the link (I hope changing the code in all those listed is not going to cause other issues??).

Anything I am doing wrong?

Thank you
Regards
Lene

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

  • Posts: 12953
  • Thank you received: 1778
11 years 1 month ago #165973

Hello,
Did you modified the code of the quantity file of the product view of your front-end template through "Hikashop->Display->Views" ?

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

  • Posts: 191
  • Thank you received: 5
11 years 1 month ago #166331

Hello,

Yes, I changed the front-end template -> product / quantity.php file. This is for the default template used on the home page, but I also changed it for the website default template (picked the wrong template first).

Regards
Lene

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

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

Hi,

You actually need to change the code:

echo $this->cart->displayButton(JText::_('CHOOSE_OPTIONS'),'choose_options',$this->params,hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$url_itemid.$this->category_pathway),'window.location = \''.str_replace("'","\'",hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$url_itemid.$this->category_pathway)).'\';return false;','');
to:
echo $this->cart->displayButton(JText::_('CHOOSE_OPTIONS'),'choose_options',$this->params,hikashop_contentLink('product&task=show&cid='.$this->row->product_id.'&name='.$this->row->alias.$this->itemid.$this->category_pathway,$this->row),'window.location = \''.str_replace("'","\'",hikashop_contentLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$url_itemid.$this->category_pathway,$this->row)).'\';return false;','');
Then it should work better.

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

  • Posts: 191
  • Thank you received: 5
11 years 1 month ago #166428

Hello,

Sorry, but it is still not working. This is what I have:

<div class="hikashop_product_stock">
<?php
if(!empty($this->row->has_options)){
if($this->params->get('add_to_cart',1)) echo $this->cart->displayButton(JText::_('CHOOSE_OPTIONS'),'choose_options',$this->params,hikashop_contentLink('product&task=show&cid='.$this->row->product_id.'&name='.$this->row->alias.$this->itemid.$this->category_pathway,$this->row),'window.location = \''.str_replace("'","\'",hikashop_contentLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$url_itemid.$this->category_pathway,$this->row)).'\';return false;','');
}else{

This is from: view -> front-end -> fsfightergear-homepage -> product -> quantity.php

Website: www.fsfightgear.com.au/website/

Thanks
Regards
Lene

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

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

Hi,

Did you change it everywhere ?
Here is the complete code of the file:

<?php
global $Itemid;
$url_itemid = '';
if(!empty($Itemid))
	$url_itemid = '&Itemid='.$Itemid;
if($this->config->get('show_quantity_field')==-2){
	$this->params->set('show_quantity_field',$this->row->product_display_quantity_field);
}

$config =& hikashop_config();

$wishlistEnabled = $config->get('enable_wishlist', 1);
$hideForGuest = 1;
if(($config->get('hide_wishlist_guest', 1) && hikashop_loadUser() != null) || !$config->get('hide_wishlist_guest', 1)){
	$hideForGuest = 0;
}

if(!isset($this->cart)) $this->cart = hikashop_get('helper.cart');

$this->cart = hikashop_get('helper.cart');
$url = '';
$module_id = $this->params->get('from_module',0);
if(empty($this->ajax)){
	$this->ajax = 'return hikashopModifyQuantity(\''.$this->row->product_id.'\',field,1,0,\'cart\','.$module_id.')';
}
if(@$this->row->product_sale_start || empty($this->element->main)){
	$start_date = @$this->row->product_sale_start;
}else{
	$start_date = $this->element->main->product_sale_start;
}
if(@$this->row->product_sale_end || empty($this->element->main)){
	$end_date = @$this->row->product_sale_end;
}else{
	$end_date = $this->element->main->product_sale_end;
}
$formName = ',0';
if (!$this->config->get('ajax_add_to_cart', 0) || ($this->config->get('show_quantity_field')>=2 && !@$this->element->product_id)) {
	if(empty($this->formName)) {
		if(@$this->row->product_id)
			$formName = ',\'hikashop_product_form_'.$this->row->product_id.'_'.$this->params->get('main_div_name').'\'';
		else
			$formName = ',\'hikashop_product_form_'.$this->params->get('main_div_name').'\'';
	} else {
		$formName = $this->formName;
	}
}
if($end_date && $end_date<time()){
	?>
	<span class="hikashop_product_sale_end">
		<?php echo JText::_('ITEM_NOT_SOLD_ANYMORE'); ?>
	</span>
	<?php
}elseif($start_date && $start_date>time()){
	?>
	<span class="hikashop_product_sale_start">
		<?php
		echo JText::sprintf('ITEM_SOLD_ON_DATE',hikashop_getDate($start_date,$this->params->get('date_format','%d %B %Y')));
		//TODO echo $this->cart->displayButton(JText::_('Pre-order and add to cart'),'add',$this->params,$url,$ajax);
		?>
	</span>
	<?php
}elseif(!$this->params->get('catalogue') && ($this->config->get('display_add_to_cart_for_free_products') || !empty($this->row->prices))){
	if(@$this->row->product_min_per_order || empty($this->element->main)){
		$min = @$this->row->product_min_per_order;
	}else{
		$min = @$this->element->main->product_min_per_order;
	}
	if(@$this->row->product_max_per_order || empty($this->element->main)){
		$max = @$this->row->product_max_per_order;
	}else{
		$max = @$this->element->main->product_max_per_order;
	}
	if($min<=0){
		$min=1;
	}
	$wishlistAjax =	'if(hikashopCheckChangeForm(\'item\''.$formName.')){ return hikashopModifyQuantity(\'' . (int)@$this->row->product_id . '\',field,1' . $formName . ',\'wishlist\','.$module_id.'); } else { return false; }';

	if($this->row->product_quantity == -1 && !empty($this->element->main) && $this->element->main->product_quantity != -1){
		$this->row->product_quantity = $this->element->main->product_quantity;
	}
	$btnType = 'add';
	if($this->row->product_quantity==-1){
	?>
	<div class="hikashop_product_stock">
	<?php
		if(!empty($this->row->has_options)){
			if($this->params->get('add_to_cart',1)) echo $this->cart->displayButton(JText::_('CHOOSE_OPTIONS'),'choose_options',$this->params,hikashop_contentLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$url_itemid.$this->category_pathway,$this->row),'window.location = \''.str_replace("'","\'",hikashop_contentLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$url_itemid.$this->category_pathway,$this->row)).'\';return false;','');
		}else{
			if($this->params->get('add_to_cart',1)){
				echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$max,$min);
				$btnType = 'wish';
			}
			if(hikashop_level(1) && $this->params->get('add_to_wishlist') && $wishlistEnabled && !$hideForGuest && $this->config->get('display_add_to_wishlist_for_free_products','1')){
				echo '<div id="hikashop_add_wishlist">';
					echo $this->cart->displayButton(JText::_('ADD_TO_WISHLIST'),$btnType,$this->params,$url,$wishlistAjax,'',$max,$min,'',false);
				echo '</div>';
			}
		}
	}elseif($this->row->product_quantity>0){
	?>
	<div class="hikashop_product_stock">
	<?php
		if($this->row->product_quantity==1){
			if(JText::_('X_ITEM_IN_STOCK')=='X_ITEM_IN_STOCK'){
				$text = JText::sprintf('X_ITEMS_IN_STOCK',$this->row->product_quantity);
			}else{
				$text = JText::sprintf('X_ITEM_IN_STOCK',$this->row->product_quantity);
			}
		}else{
			$text = JText::sprintf('X_ITEM_IN_STOCK',$this->row->product_quantity);
		}
		echo '<span class="hikashop_product_stock_count">'.$text.'<br/></span>';
		if($config->get('button_style','normal')=='css'){
			echo '<br />';
		}
		if($max<=0 || $max>$this->row->product_quantity) $max = $this->row->product_quantity;
		if(!empty($this->row->has_options)){
			if($this->params->get('add_to_cart',1)) echo $this->cart->displayButton(JText::_('CHOOSE_OPTIONS'),'choose_options',$this->params,hikashop_contentLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$url_itemid.$this->category_pathway,$this->row),'window.location = \''.str_replace("'","\'",hikashop_contentLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$url_itemid.$this->category_pathway,$this->row)).'\';return false;','');
		}else{
			if($this->params->get('add_to_cart',1)){
				echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$max,$min);
				$btnType = 'wish';
			}
			if(hikashop_level(1) && $this->params->get('add_to_wishlist')  && $wishlistEnabled && !$hideForGuest && $this->config->get('display_add_to_wishlist_for_free_products','1')){
				echo '<div id="hikashop_add_wishlist">';
					echo $this->cart->displayButton(JText::_('ADD_TO_WISHLIST'),$btnType,$this->params,$url,$wishlistAjax,'',$max,$min,'',false);
				echo '</div>';
			}
		}
	}else{
		?>
	<div class="hikashop_product_no_stock">
	<?php
		echo JText::_('NO_STOCK').'<br/>';
		$waitlist = $this->config->get('product_waitlist',0);
		if(hikashop_level(1) && ($waitlist==2 || ($waitlist==1 && (!empty($this->element->main->product_waitlist) || !empty($this->element->product_waitlist))))){ ?>
			</div><div id="hikashop_product_waitlist_main" class="hikashop_product_waitlist_main">
			<?php
			$empty='';
			jimport('joomla.html.parameter');
			$params = new HikaParameter($empty);
			echo $this->cart->displayButton(JText::_('ADD_ME_WAITLIST'),'add_waitlist',$params,hikashop_completeLink('product&task=waitlist&cid='.$this->row->product_id.$url_itemid),'window.location=\''.str_replace("'","\'",hikashop_completeLink('product&task=waitlist&cid='.$this->row->product_id.$url_itemid)).'\';return false;');
		}
		if(hikashop_level(1) && $this->params->get('add_to_wishlist')  && $wishlistEnabled  && !$hideForGuest && $this->config->get('display_add_to_wishlist_for_free_products','1')){
			if(!empty($this->row->has_options)){
				if($this->params->get('add_to_cart',1)) echo $this->cart->displayButton(JText::_('CHOOSE_OPTIONS'),'choose_options',$this->params,hikashop_contentLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$url_itemid.$this->category_pathway,$this->row),'window.location = \''.str_replace("'","\'",hikashop_contentLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$url_itemid.$this->category_pathway,$this->row)).'\';return false;','');
			}else{
				echo '<div id="hikashop_add_wishlist">';
					echo $this->cart->displayButton(JText::_('ADD_TO_WISHLIST'),'add',$this->params,$url,$wishlistAjax,'',@$this->row->product_max_per_order,1,'',false);
				echo '</div>';
			}
		}
	}?>
	</div>
<?php
}elseif(hikashop_level(1) && $wishlistEnabled && $this->params->get('add_to_wishlist','1') && $this->config->get('display_add_to_wishlist_for_free_products','1') && !$hideForGuest && !$this->config->get('display_add_to_cart_for_free_products')){
	if(!empty($this->row->has_options)){
		if($this->params->get('add_to_cart',1)) echo $this->cart->displayButton(JText::_('CHOOSE_OPTIONS'),'choose_options',$this->params,hikashop_contentLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$url_itemid.$this->category_pathway,$this->row),'window.location = \''.str_replace("'","\'",hikashop_contentLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$url_itemid.$this->category_pathway,$this->row)).'\';return false;','');
	}else{
		$wishlistAjax =	'if(hikashopCheckChangeForm(\'item\''.$formName.')){ return hikashopModifyQuantity(\'' . (int)@$this->row->product_id . '\',field,1' . $formName . ',\'wishlist\','.$module_id.'); } else { return false; }';
		echo '<div id="hikashop_add_wishlist">';
			echo $this->cart->displayButton(JText::_('ADD_TO_WISHLIST'),'add',$this->params,$url,$wishlistAjax,'',@$this->row->product_max_per_order,1,'',false);
		echo '</div>';
	}
}

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

  • Posts: 191
  • Thank you received: 5
11 years 1 month ago #166547

Hi Nicolas,

I tried replacing the code with the code you posted, cleared browser history, no changes.

The images and title directs you to: .../index.php/shop/mma-products/...

The choose option button directs you to: .../index.php/component/hikashop/mma-products/...

mma-products being the 'Product SEF name' in Hikashop.

Thanks
Regards
Lene

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

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

Hi,
That's strange. Are you sure that you're editing the view file for your frontend template and not another template ?
Because you'll only see the change if you modify the view file for your frontend template.
Also, make sure that the cache is turned off on your website or you won't see the change.

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

  • Posts: 191
  • Thank you received: 5
11 years 3 weeks ago #167842

Hi Nicolas,

Yes, I have been editing the front-end template that is set for the home page. I must be doing something wrong.....

The website is live now, so no longer i a sub-directory: www.fsfightgear.com.au/ .

It looks a bit incomplete when you click on this link from the home page.

Regards
Lene

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

  • Posts: 84301
  • Thank you received: 13697
  • MODERATOR
11 years 3 weeks ago #167860

Hi,

I checked the modification with the access you provided and it was indeed correct.
I've had to also add the code:
if(!empty($this->itemid)){
$url_itemid = $this->itemid;
}
else

before the code:
if(!empty($Itemid))
$url_itemid = '&Itemid='.$Itemid;

in the same view file and it's working now.

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

  • Posts: 191
  • Thank you received: 5
11 years 3 weeks ago #167925

Hi Nicolas,

That is great :) !

Thank you!
Regards
Lene

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

Time to create page: 0.114 seconds
Powered by Kunena Forum