Hiding Price when an item is out of stock only?

  • Posts: 108
  • Thank you received: 0
9 years 10 months ago #208734

-- url of the page with the problem -- : www.lotuswithingallery.com
-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.3
-- PHP version -- : 5.3.28
-- Browser(s) name and version -- : Safari 8.0.5

Salut, Nicolas, Xavier etc,

I have a client who is more like a gallery and wants to hide the price of an item when the item has sold but YET show that it is sold.

So I can change the 'No Stock' language string to 'SOLD', but that doesn't solve the part about removing/hiding the price.... HELP?

To be clear, this is only supposed to hide the price WHEN the item has a stock of 0.

I tried looking in the forums or in the configuration for such a feature/idea but no luck ;(

I'd really like to do this WITHOUT modifying a Hikashop View if possible.

Merci,

Emmanuel

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

  • Posts: 83860
  • Thank you received: 13579
  • MODERATOR
9 years 10 months ago #208764

Salut,

There is no setting to display/hide prices based on the stock of the product.
That will have to be done with a view override.
You can edit the file "listing_price" of the view "product" and add such code at the beginning:
<?php if($this->row->product_quantity==0) return; ?>

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

  • Posts: 108
  • Thank you received: 0
9 years 10 months ago #208788

Salut Nicolas,

And what does the Master of Hikashop ;) think of adding this option so that Galleries can still show off a piece of art that they 'had' but Sold successfully.

For a Gallery, 'hiding' the product is a detriment/bad thing because then the possible client doesn't see what sort of pieces
the Gallery collects. But pricing is something that is typically removed after the sale.

Ideally the option to do this would be at the product level so that there is the most flexibility - next to the Quantity Box perhaps? [This 'could' allow someone to also hide the price even when there is a quantity and if you were to go to that level [crossing double-fingers] THEN the next functionality would be a 'Ask for Price' feature just like you see on so many sites like NewEgg or Best Buy and others for those items for which they can not advertise the price but if you put it in your cart the price displays or you email them you find out the price

(crossing-fingers) that it will be in v2.5.1 ;)

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

  • Posts: 83860
  • Thank you received: 13579
  • MODERATOR
9 years 10 months ago #208793

Hi,

I don't see the point of having an option to remove the display of the price after a sale.
In that case, simply delete the price from the product and you won't see it on the product page. You don't need it anyway once you sold the product.

And there is already a "ask for price" feature. You can turn it on with the option "Display a contact button on the product page" of the HikaShop configuration.

See, you don't even have to wait for the next version ;)

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

  • Posts: 108
  • Thank you received: 0
9 years 10 months ago #208808

Salut Nicolas,

Without trying to sound mean or anything - HOW does that solve the problem?

Removing the price from an item does NOT solve the problem requested - as the item becomes 'Free'...

The only way around this would be to change Free to SOLD but then if the client wants to have SOLD items AND Free ones this method does not work :(

As for the Ask for a Price feature - Awesome - I hadn't understood that to be what Display a contact button on the product page but I guess it makes sense now :) thanks!

Cheers,

Emmanuel

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

  • Posts: 83860
  • Thank you received: 13579
  • MODERATOR
9 years 10 months ago #208816

Hi,

I see what you mean, but I don't think that there is so much use for it that an option would be useful for enough people compare to the fact that there are already too many options.
Basically, from that discussion, it would only have an application when you have products with a limited quantity that you can replenish, that you don't want to display the price of the product after the sale, but that you still want to display the sold products, and that you also have free products.
On the other end, we have so much options that even though the contact feature has been there for years, and you've been using HikaShop for years, you didn't notice it.
In such rare cases, I would recommend to just add that one line of code in the listing_price view file. It's not like this view file is going to change much in the future anyway and we already have too many options so such option would just make it more confusing.

Also, note that there are several ways to make view overrides. The way you do, where you modify the code in the override file is not the best for forward compatibility. The best is actually to remove the whole code in the override and just include the original file. That way, you can add your condition at the top of the override in order to use or not the standard listing_price view file. So you get the updates to the view file and you still have that extra condition to it.

Last edit: 9 years 10 months ago by nicolas.

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

  • Posts: 108
  • Thank you received: 0
9 years 10 months ago #208857

Salut Nicolas,

" The way you do, where you modify the code in the override file is not the best for forward compatibility. The best is actually to remove the whole code in the override and just include the original file. That way, you can add your condition at the top of the override in order to use or not the standard listing_price view file. So you get the updates to the view file and you still have that extra condition to it."

I was doing it this way because that's what you guys had recommended years ago :( so if there is a new enter way AWESOME, the only problem is I didn't understand the explanation that you just gave for the better way?

Si c'est plus facile une explication en Français que je peux traduire?

Thanks as always,

Emmanuel

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

  • Posts: 83860
  • Thank you received: 13579
  • MODERATOR
9 years 10 months ago #208861

Hi,

That's what we recommended because it's the simplest to understand ;)

Basically, you remove all the content of the file when you edit it via the menu Display>Views, and instead, you add:

<?php if($this->row->product_quantity==0) return;
include(HIKASHOP_ROOT.DS.'components'.DS.'com_hikashop'.DS.'views'.DS.'product'.DS.'tmpl'.DS.'listing_price.php');

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

  • Posts: 108
  • Thank you received: 0
9 years 10 months ago #208883

Salut Nicolas,

I did exactly as you described but it is not really matching expectation...

The product image is there, the description is but now the ENTIRE price/quantity block is gone.

So there is no SOLD or Free wording - it's all gone and if I look in the generated code:

<div id="hikashop_product_right_part" class="hikashop_product_right_part ">
<div id="hikashop_product_vote_mini" class="hikashop_product_vote_mini">
</div>
<span id="hikashop_product_price_main" class="hikashop_product_price_main">
</span>
<br>
<br>
<span id="hikashop_product_price_with_options_main" class="hikashop_product_price_with_options_main">
</span>
<div id="hikashop_product_quantity_main" class="hikashop_product_quantity_main">
</div>
<div id="hikashop_product_contact_main" class="hikashop_product_contact_main">
</div>
<div id="hikashop_product_tags_main" class="hikashop_product_tags"></div>
<span id="hikashop_product_id_main" class="hikashop_product_id_main">
<input type="hidden" name="product_id" value="372">
</span>
</div>

it doesn't seem to have been generated at all... [no errors or warnings either]

[See screenshot]

Any idea?

Attachments:

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

  • Posts: 83860
  • Thank you received: 13579
  • MODERATOR
9 years 10 months ago #208897

Hi,

Would it be possible that you didn't edit the file "listing_price" but another one ?

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

  • Posts: 108
  • Thank you received: 0
9 years 10 months ago #208975

Hi Nicolas,

I wish...

You made me doubt so I checked but it was the right template and Product ---> listing_price, wasn't it?

If so --- :(

Cheers,

Emmanuel.

Attachments:

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

  • Posts: 83860
  • Thank you received: 13579
  • MODERATOR
9 years 10 months ago #208976

Hi,

I don't see why it would delete anything else besides the price area on the product page.
If you remove the change, does it display the other areas ?

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

  • Posts: 108
  • Thank you received: 0
9 years 10 months ago #209008

Salut Nicolas,

If I remove the change and bring back the file to the original version [no modifications],
then it shows Free (I have set the price to 0 for this item) as you had suggested.

but doesn't help.

Cheers,

Emmanuel.

Attachments:
Last edit: 9 years 10 months ago by exlemor.

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

  • Posts: 83860
  • Thank you received: 13579
  • MODERATOR
9 years 10 months ago #209027

Hi,

Wait I'm not following you.
You want to remove the price when the quantity of the product is 0:
www.hikashop.com/forum/product-category-...ock-only.html#208734

That's what this modification does.
So it's normal that you don't see the word "free" if you have that modification and a stock of 0, regardless of whether you have a price or not for the product.
And it's normal that you see the word free if you remove that modification and that you don't have a price for that product.

What is the problem then ?

The following user(s) said Thank You: exlemor

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

  • Posts: 108
  • Thank you received: 0
9 years 10 months ago #209140

Salut Nicolas,

I guess this is a case of not 100% understanding each other...

I will try to explain it better.

This is for a Gallery type website [but they do have a physical store as well FYI], the aim is to have it still say SOLD
YET no ability to buy the product and still have it SHOW the product AND still give us the ability to have Free products for other products.

This ideally can be achieved by this new method of overriding that you showed me AND changing a couple of language strings
like FREE_PRICE="Free" or other language strings if need be...

I hope this helps!

Cheers, Emmanuel.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 10 months ago #209162

Hi,

So you can use the code given by Nicolas previously with a little modification, so add the following code at the top of the view "product / listing_price" (between php tags):

if($this->row->product_quantity==0){
	echo JText::_('SOLD');
	return;
}

This way if the product is sold so the quantity is set to "0", so the "SOLD" message will be displayed and not the price, and the "Free" text will still be displayed for the free products.

The following user(s) said Thank You: exlemor

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

  • Posts: 108
  • Thank you received: 0
9 years 10 months ago #209242

Salut Xavier et Nicolas,

EUREKA - je crois bien! :)

Merci...

Cheers,

Emmanuel.

Last edit: 9 years 10 months ago by exlemor.

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

  • Posts: 6
  • Thank you received: 0
8 years 2 months ago #264718

Hello,

I did this, it works but and now the cart total value is missing!
Is there a way to hide the price of the sold out products AND show the total?

Regards,
Eric

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

  • Posts: 26240
  • Thank you received: 4036
  • MODERATOR
8 years 2 months ago #264797

Hello,

Please open a new thread for your question and provide basic details.

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.

Time to create page: 0.138 seconds
Powered by Kunena Forum