- Posts: 37
- Thank you received: 2
How to change the text of availability of product
- Poukamisas
-
Topic Author
- Offline
-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.4.45
-- Browser(s) name and version -- : Firefox 46.0.1
Hi,
I was able to display the text "Available in 3 to 5 days" when I put nothing in the field quantity (on product), as I have change the code in file “quantity” as I have found the line : if($this->row->product_quantity == -1) {“
and I have put the code :
$text = JText::_('Παράδοση σε 3 με 5 μέρες');
echo '<span class="hikashop_product_stock_count">'.$text.'<br/></span>';
But I don't know how to make a code which will display the text "Available in 1 to 15 days" when the value in field "quantity" of the product is "-2"
Could you help me;
Thanks in Advances
Please Log in or Create an account to join the conversation.
It's quite similar:
Please Log in or Create an account to join the conversation.
- Poukamisas
-
Topic Author
- Offline
- Posts: 37
- Thank you received: 2
Please Log in or Create an account to join the conversation.
Turn on the "error reporting" setting of the Joomla configuration and you'll get the error message with the line number where the problem is.
I would guess that it might be coming from JText.
Try:
$text = 'Παράδοση σε 3 με 5 μέρες';
instead of:
$text = JText::_('Παράδοση σε 3 με 5 μέρες');
(and same for the other quantity)
Please Log in or Create an account to join the conversation.
- Poukamisas
-
Topic Author
- Offline
- Posts: 37
- Thank you received: 2
I have turn on the "error reporting" and when I change the code as you said to me display the follow message:
"Parse error: syntax error, unexpected '}' in /var/www/vhosts/kosmima-gkiotli.gr/httpdocs/templates/protostar/html/com_hikashop/product/quantity.php on line 186"
Could you take a look?
If you want I could send you the username and the password of the site.
Please Log in or Create an account to join the conversation.
As there error says, there is a problem with what you wrote on line 186.
Please provide the full file content and we can tell you what's wrong.
Please Log in or Create an account to join the conversation.
- Poukamisas
-
Topic Author
- Offline
- Posts: 37
- Thank you received: 2
I have attached the full file content .
Please Log in or Create an account to join the conversation.
The problem is that you removed the line:
if($this->row->product_quantity == -1) {
that should be just before the code:
?>
<div class="hikashop_product_stock"><?php
in that file, as it is by default.
Add it back and it will work.
Please Log in or Create an account to join the conversation.
- Poukamisas
-
Topic Author
- Offline
- Posts: 37
- Thank you received: 2
Ok now it works correct with the above code:
if($this->row->product_quantity == -1) {
$text = JText::_('Διαθέσιμο σε 1 έως 5 μέρες');
echo '<span class="hikashop_product_stock_count">'.$text.'<br/></span>';
}
if($this->row->product_quantity == -2) {
$text = JText::_('Διαθέσιμο σε 1 έως 15 μέρες');
echo '<span class="hikashop_product_stock_count">'.$text.'<br/></span>';
}
if(($this->row->product_quantity == -1 || $this->row->product_quantity == -2)) {
Thanks for your support
Please Log in or Create an account to join the conversation.
- Poukamisas
-
Topic Author
- Offline
- Posts: 37
- Thank you received: 2
I have made the changes and appears perfect but when a customer try to complete a order with a product that has "quantity == -2" the system doesn't complete the order, because the system thinks that the product it is not available. Can I disable that property or via code or via option of the system. So to can the customer to complete the order without problem?
Thanks in advances
Please Log in or Create an account to join the conversation.
Yes, the value -2 is normally not a valid quantity.
You would have to edit the file administrator/components/com_hikashop/classes/cart.php to change that.
For example, that line:
if($product->product_quantity!=-1 && $product->product_quantity < $product->cart_product_quantity){
should be:
if($product->product_quantity>0 && $product->product_quantity < $product->cart_product_quantity){
Please Log in or Create an account to join the conversation.
- Poukamisas
-
Topic Author
- Offline
- Posts: 37
- Thank you received: 2
as you can see on the image that I have attached the folder "classes" does't exist on "administrator/components/com_hikashop", I have found the file "cart.php" on folder "controllers" but there aren't the line
"if($product->product_quantity!=-1 && $product->product_quantity < $product->cart_product_quantity){"
what is wrong?
Please Log in or Create an account to join the conversation.
You're looking at components/com_hikashop/ and not administrator/components/com_hikashop/
Please Log in or Create an account to join the conversation.
- Poukamisas
-
Topic Author
- Offline
- Posts: 37
- Thank you received: 2
Please Log in or Create an account to join the conversation.