hide the price

  • Posts: 142
  • Thank you received: 3
  • Hikashop Business
11 years 7 months ago #94505

Hi there

I bought the business version of Hikashop and wonder if there is a way to hide the price automatically as soon the product is sold out?

thanks
Raphael

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

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #94531

Hi,

Yes it's possible, you have to edit the view "product / show_default" and check if the current date (timestamp, you can use the php function time()) is greater than the "product_sale_end", don't display the "listing_price" layout.

A code like the following should work:

<?php if(time() > $this->element->product_sale_end){ ?>
	<span id="hikashop_product_price_main" class="hikashop_product_price_main">
		<?php
		//LAYOUT listing_price
		if ($this->params->get('show_price')) {
			$this->row = & $this->element;
			$this->setLayout('listing_price');
			echo $this->loadTemplate();
		}
		?>
	</span>
<?php } ?>

You have to do a similar thing in the view "product / listing_img_title".

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

  • Posts: 142
  • Thank you received: 3
  • Hikashop Business
11 years 7 months ago #94939

Hi Xavier

Thank you very much for your quick respond!

I tried several times to add this code and it did not work. I guess it's my poor understanding of php programming :blush: .

could you tell me, where exactly, to put this php code and what code is needed in the "product / listing_img_title"

many thanks in advance
Raphael

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

  • Posts: 2334
  • Thank you received: 403
11 years 7 months ago #95001

Hi Raphael,

First of all I'd like to be sure the code Xavier gave you is what you really need.
This code will hide the price one the limit date is passed, is this what you want? Because reading you I think you may want to hide the price when the quantity of product is equal to zero.
Anyway, if you want the first solution, you have to add the xavier code in show_default (display>views, make sure to edit your tempalte) instead of these lines:

<span id="hikashop_product_price_main" class="hikashop_product_price_main">
		<?php
		//LAYOUT listing_price
		if ($this->params->get('show_price')) {
			$this->row = & $this->element;
			$this->setLayout('listing_price');
			echo $this->loadTemplate();
		}
		?>
	</span>

If you want to hide the price once the product is sold out, please use this code instead:
<?php if($this->element->product_quantity!=0){ ?>
	<span id="hikashop_product_price_main" class="hikashop_product_price_main">
		<?php
		//LAYOUT listing_price
		if ($this->params->get('show_price')) {
			$this->row = & $this->element;
			$this->setLayout('listing_price');
			echo $this->loadTemplate();
		}
		?>
	</span>
<?php } ?>

This should do the job :)

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

  • Posts: 142
  • Thank you received: 3
  • Hikashop Business
11 years 7 months ago #95175

Hi Eliot

You are right I need to hide the price as soon it is sold out.

The second code workes well for the product page, but on the product listing (small photos when choosing the category) there is the price still showing plus at the top where the products are moving the price is still showing.
have a look at this link.
www.shop.epower.jp/index.php/whisky/vintage-malt-whisky the bottles with 0yen are sold out.

Could you let me know what I need to change to get this price hidden too?

Thanks
Raphael

Last edit: 11 years 7 months ago by ePower2007.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #95205

Hi,

You have to edit the view "product / listing_img_title" and add the previous if condition around the code like:

if($this->element->product_quantity!=0){
if($this->params->get('show_price')){
	$this->setLayout('listing_price');
	echo $this->loadTemplate();
}
}

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

  • Posts: 142
  • Thank you received: 3
  • Hikashop Business
11 years 7 months ago #95232

Hi Xavier

I tried this one but it does not work.

If I put in this code then in the top slider there is no price on any product anymore and in the small images there is still the price of the sold out items.

looking forward to hear from you.

Thanks
Raphael

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

  • Posts: 2334
  • Thank you received: 403
11 years 7 months ago #95235

Hi Raphael,

The first line of Xavier's code is actually

if($this->row->product_quantity!=0){

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

  • Posts: 142
  • Thank you received: 3
  • Hikashop Business
11 years 7 months ago #96956

Hi Eliot

Now it is working on te top slider and on the product page, but still the price is showing in the small photos when chosing the category and in the last seen products on the left side.
On the left side I did temporarly take away the price, but on the photos when choosing the category there is the price still showing.....can I set somthing there too or is still something missig in the programming :blink: ?

Looking forward to hear from you
Raphael

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

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #97270

Hi,

I think that you are not editing the correct view, but to hide the price in the listing, you have an option in the menu/module configuration page.
To hide it via php, thanks to check if you are editing the good view in the good template.

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

  • Posts: 142
  • Thank you received: 3
  • Hikashop Business
11 years 7 months ago #97808

Hi

I don't want to hide generally the price of the listing module, only when it is sold out I like the price not to be shown anymore.
As told before it works on the top slider and on the product page itself. but not in the listing when choosing the category and not in the last seen products on the left side.

I did edit the correct view in the correct template, as I do have only one template for front end.

looking forward to hear from you.
thanks for your effort
Raphael

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

  • Posts: 82760
  • Thank you received: 13347
  • MODERATOR
11 years 7 months ago #97950

Hi,

On these listings, you're not using the "image and title" layout but the "list" layout and the "pane" layout.
So you will need to do the same modification for the "listing_list" and the "listing_img_pane" view files.

Last edit: 11 years 7 months ago by nicolas.

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

  • Posts: 142
  • Thank you received: 3
  • Hikashop Business
11 years 7 months ago #98007

Hi Nicolas

I got it for the listing_list but it will not work for the listing_img_pane. I tried several times but it is not working.

Is there a different coding used to make it work?
I can't program in PHP and therefore I need detailed description if coding changes.

Thanks
Raphael

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

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #98147

Hi,

I just tried on my end and it's working fine. Are you editing this view in the good template ?

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

  • Posts: 142
  • Thank you received: 3
  • Hikashop Business
11 years 6 months ago #98304

Hi

Thanks for your help!

As told before I have only my template activated therfore only my template is shown.

that's where I go and change the code:

client Template View file
Front end vorlage_blau product listing_img_pane

I put in the same code as in the other views file that I changed. That's the only one that the code is not working. Does it has something to do that I use Joomla for the vertical Menu? Do I need to change something there?

looking forward to hear from you
Raphael

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

  • Posts: 13201
  • Thank you received: 2322
11 years 6 months ago #98379

Hi,

Can you give us a backend access ?

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

  • Posts: 142
  • Thank you received: 3
  • Hikashop Business
11 years 6 months ago #98439

Hi Xavier

I prefer not to give access to my back end. Hope you can understand.

I can copy php codes or serverl other things you like to see. Let me know waht information you need and I'll give it to you.

Thanks
Raphael

Last edit: 11 years 6 months ago by ePower2007.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 6 months ago #98497

Ok no problems.

Could you give the content of your edited "listing_img_pane" view ?

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

  • Posts: 142
  • Thank you received: 3
  • Hikashop Business
11 years 6 months ago #98605

Here it is:

<?php
/**
* @package HikaShop for Joomla!
* @version 2.1.1
* @author hikashop.com
* @copyright (C) 2010-2012 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php
$height=$this->image->main_thumbnail_y;
$width=$this->image->main_thumbnail_x;
$duration=$this->params->get('product_effect_duration');
if(empty($duration)){ $duration=400; }

$pane_percent_height=$this->params->get('pane_height');
$link = hikashop_completeLink('product&task=show&cid='.$this->row->product_id.'&name='.$this->row->alias.$this->itemid.$this->category_pathway);
$htmlLink="";
$cursor="";
if($this->params->get('link_to_product_page',1)){
$htmlLink='onclick = "window.location.href = \''.$link.'\'';
$cursor="cursor:pointer;";
}

if(!empty($this->row->extraData->top)) { echo implode("\r\n",$this->row->extraData->top); }
?>
<div id="window_<?php echo $this->row->product_id; ?>" style="margin: auto; <?php echo $cursor; ?> height:<?php echo $height; ?>px; width:<?php echo $width; ?>px; overflow:hidden; position:relative" <?php echo $htmlLink; ?>" >
<div id="product_<?php echo $this->row->product_id; ?>" style="height:<?php echo $height; ?>px; width:<?php echo $width; ?>px;">

<!-- PRODUCT IMG -->
<div style="height:<?php echo $height;?>px;text-align:center;clear:both;" class="hikashop_product_image">
<div style="position:relative;text-align:center;clear:both;width:<?php echo $width;?>px;margin: auto;" class="hikashop_product_image_subdiv">
<?php if($this->params->get('link_to_product_page',1)){ ?>
<a href="<?php echo $link;?>" title="<?php echo $this->escape($this->row->product_name); ?>">
<?php }
echo $this->image->display(@$this->row->file_path,false,$this->escape($this->row->product_name), '' , '' , $width, $height);
$main_thumb_x = $this->image->main_thumbnail_x;
$main_thumb_y = $this->image->main_thumbnail_y;
$this->classbadge->placeBadges($this->image, $this->row->badges, -10, 0);
$this->image->main_thumbnail_x = $main_thumb_x;
$this->image->main_thumbnail_y = $main_thumb_y;
if($this->params->get('link_to_product_page',1)){ ?>
</a>
<?php } ?>
</div>
</div>
<!-- EO PRODUCT IMG -->
<?php
$paneHeight='';
if(!empty($pane_percent_height)){
$paneHeight='height:'.$pane_percent_height.'px;';
}
?>
<div class="hikashop_img_pane_panel" style="width:<?php echo $width; ?>px; <?php echo $paneHeight; ?>">
<!-- PRODUCT NAME -->
<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>
<!-- EO PRODUCT NAME -->
<!-- PRODUCT CODE -->
<span class='hikashop_product_code_list'>
<?php if ($this->config->get('show_code')) { ?>
<a href="<?php echo $link;?>">
<?php
echo $this->row->product_code;
?>
</a>
<?php } ?>
</span>
<!-- EO PRODUCT CODE -->
<?php if(!empty($this->row->extraData->afterProductName)) { echo implode("\r\n",$this->row->extraData->afterProductName); } ?>

<!-- PRODUCT PRICE -->
<?php
if($this->params->get('show_price','-1')=='-1'){
$config =& hikashop_config();
$this->params->set('show_price',$config->get('show_price'));
}
if($this->row->product_quantity!=0){
if($this->params->get('show_price')){
$this->setLayout('listing_price');
echo $this->loadTemplate();
}
}
?>
<!-- EO PRODUCT PRICE -->

<!-- PRODUCT VOTE -->
<?php
if($this->params->get('show_vote_product')){
$this->setLayout('listing_vote');
echo $this->loadTemplate();
}
?>
<!-- EO PRODUCT VOTE -->

<!-- ADD TO CART BUTTON AREA -->
<?php
if($this->params->get('add_to_cart') || $this->params->get('add_to_wishlist')){
$this->setLayout('add_to_cart_listing');
echo $this->loadTemplate();
}?>
<!-- EO ADD TO CART BUTTON AREA -->

<!-- COMPARISON AREA -->
<?php
if(JRequest::getVar('hikashop_front_end_main',0) && JRequest::getVar('task')=='listing' && $this->params->get('show_compare')) { ?>
<br/><?php
if( $this->params->get('show_compare') == 1 ) {
?>
<a class="hikashop_compare_button" href="<?php echo $link;?>" onclick="setToCompareList(<?php echo $this->row->product_id;?>,'<?php echo $this->escape($this->row->product_name); ?>',this); return false;"><?php echo JText::_('ADD_TO_COMPARE_LIST'); ?></a>
<?php } else { ?>
<input type="checkbox" class="hikashop_compare_checkbox" id="hikashop_listing_chk_<?php echo $this->row->product_id;?>" onchange="setToCompareList(<?php echo $this->row->product_id;?>,'<?php echo $this->escape($this->row->product_name); ?>',this);"><label for="hikashop_listing_chk_<?php echo $this->row->product_id;?>"><?php echo JText::_('ADD_TO_COMPARE_LIST'); ?></label>
<?php }
} ?>
<!-- EO COMPARISON AREA -->
</div>
</div>
</div>
<?php if(!empty($this->row->extraData->bottom)) { echo implode("\r\n",$this->row->extraData->bottom); } ?>

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

  • Posts: 13201
  • Thank you received: 2322
11 years 6 months ago #98684

That must work, I tried on my end, and when the products have a stock of 0, the price is not displayed.

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

Time to create page: 0.120 seconds
Powered by Kunena Forum