remove prices from certain category listings

  • Posts: 19
  • Thank you received: 0
11 years 10 months ago #83620

Hi all. Read through what I could find and don't think the responses fit my needs.
First, I'm a hypernewb when it comes to hika & php coding - so bare with me.

Ideally, I would like to have some some snippet that would do something like...
... when variants occur on a product, hide price shown in category listing.

But again, hypernewb - so I don't know if this even possible.

I'm currently setting up a store in which some categories will have items with variants, and others will not.
[ Category A ]: Original Paintings (no variants)
[ Category B ]: Prints and Posters (variants)

I would like to list products in Category A with prices.
I would like to list products in Category B without prices until the product has been selected. Then I have different prices for different variations.

Currently I have different descripts/prices for a product in Category B and it works great when changing between the variants.

HikaShop Info: HikaShop Business ver 2.0.0

Thanks for any help. And sorry if I'm missing any important needed info.

Last edit: 11 years 10 months ago by skullboy74.

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

  • Posts: 82817
  • Thank you received: 13360
  • MODERATOR
11 years 10 months ago #83926

Hi,

If you browse your categories via two different menus, in the hikashop options of each menus, you can change the "show prices" option to show the prices or not on the listing.

If you want to have both categories browsable via only one menu, then I'm afraid that you can't do that without PHP modification. But you can do the opposite and with the display price method option of your menu's hikashop options screen, you can set it to display a range of the prices (the lowest and the highest).

If you want to to do it via code change, you can add the code:
<?php if(!empty($this->row->has_options)) return true; ?>
at the beginning of the 'listing_img_title' file of the view "product" via the menu Display->Views.

The following user(s) said Thank You: skullboy74

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

  • Posts: 19
  • Thank you received: 0
11 years 10 months ago #84302

The code snippet worked. Too well.
Took and hid EVERYTHING if I put it at the top.
I tried putting it in the Price section and that worked. But it still hid everything below.
So I then moved the entire Price section to the bottom

<!-- PRODUCT PRICE -->
<?php if(!empty($this->row->has_options)) return true; ?>



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

?>
<!-- EO PRODUCT PRICE -->

to just before
<?php if(!empty($this->row->extraData->bottom)) { echo implode("\r\n",$this->row->extraData->bottom); } ?>

And it works exactly how I invisioned it!!!
Now It shows prices for non-varianted products, and hides the prices on the variented products.
AWESOME!

Thanks so much Nicolas!!!!

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

  • Posts: 19
  • Thank you received: 0
11 years 10 months ago #84304

Scratch the last post. :) (I know I could edit it but it did work)
It worked fine but I got to wondering.
I wondered why I was supposed to put this code in the

beginning of the 'listing_img_title' file of the view "product" via the menu Display->Views.

I removed the code from the listing_img_title.
I instead put it at the beginning of listing_price.php.

Works fine. :)
So for anyone who wants to hide product prices for products with variants:
Display / Views / {Template for the Store } {product} : listing_price.php
Add the code that Nicolas gave:
<?php if(!empty($this->row->has_options)) return true; ?>
to the very beginning of the file and it will work (atleast it did for me).

THANKS AGAIN!!!!! B) :cheer:

Last edit: 11 years 10 months ago by skullboy74.

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

Time to create page: 0.059 seconds
Powered by Kunena Forum