- Posts: 281
- Thank you received: 3
show "Product available" when quantity is unlimited
-- Joomla version -- : 3.6.4
Hello
In the product quantity I setted unlimited, but in this case in the product page it doesn't show "Product available"
I know there is the possibility to set a quantity of the produt and than ovverride the language setting what I want it shows when the produc quantity is more than 1.
But There is the possibility to show " "Product available"" also when the product quntity is unlimited??
Thanks
FRank
Please Log in or Create an account to join the conversation.
There is no option for that.
You can edit the file "quantity" via the menu Display>Views and add such code:
echo "product available";
after the line:
if($this->row->product_quantity == -1) {
Please Log in or Create an account to join the conversation.
Thanks
Frank
Please Log in or Create an account to join the conversation.
i would like to do the same here but i can't make it work, could you please write me a little more detailed code for quantity view?
Thank you
Please Log in or Create an account to join the conversation.
You have to create an override on quantity view :
For this :
- Go to Components => HikaShop => Configuration
- Then on Display tab select Views
- Use the three drop-down filter with Product/Your Template/frontend
"Custom" your view by clicking on Quantity, maybe you can copy the code, to past it on a code editor like notepad.
Then look for this line code :
You will see that :
Add ' echo "product available"; ' to have this :
Hope this will help you.
Regards
Please Log in or Create an account to join the conversation.
i tried to edit quantity view but the code i see it's alittle different from the example of yours!
That's why i m a bit confused.
Here is the code i see
Thank you
Please Log in or Create an account to join the conversation.
You can add the code:
elseif(($this->row->product_quantity == -1) echo "my text";
before the code:
elseif(!$in_stock)
in your view file.
Please Log in or Create an account to join the conversation.
i added the code but nothing changed!
Thank you
Please Log in or Create an account to join the conversation.
I process some test from your code view, and do like Nicolas told you, but in Nicolas' code there was a little mistake.
There were 2 "(" to start the elseif condition.
That error leads to an error page, then you told nothing happen, so there is only one solution : you don't edit the right view.
Check please your three dropdown filters, like this :
Edit the Quantity view like I told you in my previous message
But use this code around line 88 (on your code view) or look for this
add
Regards
Please Log in or Create an account to join the conversation.
As youcan see in my answer, i tried to edit quantity view but the code i see it's a little different from the example of yours!Edit the Quantity view like I told you in my previous message
I don't understand, my default template is yoothemehat error leads to an error page, then you told nothing happen, so there is only one solution : you don't edit the right view.
However, i tried your latest solution in both protostar AND yootheme template but still no result. Could you please send me the whole view code in case i have made any mistakes? I will send you joomla account details if you want to check.
Thank you
Please Log in or Create an account to join the conversation.
I just have a look on your website, and that's didn't work because your quantity view isn't display because you don't display price.
And so you can process your custom code in your product general view, in your case show_tabular.
I make a custom test and comment it (in order to hide it on the frontend) around line 83.
of course, you can place it where you want, hope this will fit your needs, see this tutorial .
Regards
Please Log in or Create an account to join the conversation.
i display prices but only for logged users. However i saw your code in show_tabular view and uncomment it and it works now!
Thank you Philip!
Please Log in or Create an account to join the conversation.
I have another issue here, as we discused before i added this code in show_default view file
it shows product available but i also have a badge for -1 quantity to write product unavailable, so if the product quantity is -1 the product shows available BUT if quantity is -2 it shows both the available and unavailable text. I don't understand!!
Thank you
Please Log in or Create an account to join the conversation.
The point I don't understand is why you have a -2 value ?...
You have to know that to customize HikaShop, you must understand how HikaShop code is build.
Here, quantity value in classical process have 3 value "group".
- 0 => No quantity
- 1 to 9999 (and more...) => Product available in this specific quantity number
- -1 => Is a quantity to notice HikaShop that this product isn't stock limited, and so is infinite, like for download software, wallpaper etc...
And so now, why do you have a -2 ?... I don't understand if it's your will (via custom) or else...
Plus, please note, that this forum's aim is to help people to configure and solve issue.
We can adviced people for their customization needs but that's all.
Awaiting more details from you.
Regards
Please Log in or Create an account to join the conversation.
i used -2 value as a test. I tried now 0 for not available and it works you are right.
Sorry to bother you so much!
Thank you
Please Log in or Create an account to join the conversation.
I just want to ask if somthing like this
elseif(($this->row->product_quantity == -1) echo "my text";
is possible to do on product listing page?
Please Log in or Create an account to join the conversation.
Yes, it's possible !
First, I advice you to have a look on this tutorial .
second, I'm drawing your attention to this "Display view files" option from Main HikaShop option in Advanced tab & Advanced settings.
This option will help you to get the good required view to customize.
Then, html & php knowledge to create an override to customize your product listing page.
In Display dropdown => Views, use the 3 filter dropdown with Product/ Your Template/ Frontend, and find your required view to edit it.
Hope this will help you.
Regards
Please Log in or Create an account to join the conversation.