Skip to main content

How to change the text of availability of product

More
10 years 4 months ago #239852 by Poukamisas
-- url of the page with the problem -- : kosmima-gkiotli.gr
-- 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.

More
10 years 4 months ago #239858 by nicolas
Hi,

It's quite similar:
Code:
if($this->row->product_quantity == -1) { $text = JText::_('Παράδοση σε 3 με 5 μέρες'); echo '<span class="hikashop_product_stock_count">'.$text.'<br/></span>'; } if($this->row->product_quantity == -2) { $text = JText::_('Παράδοση σε 5 με 15 μέρες'); echo '<span class="hikashop_product_stock_count">'.$text.'<br/></span>'; }

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

More
10 years 4 months ago #239895 by Poukamisas
I try it, but the page is like the photo that I have attached and named "with changed code", you can see the photo named "with normal code" to see the difference. Also I have attached the "normal quantity.php.txt" and the "changed quantity.php.txt" to see the differece, I believe that it will help.

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

More
10 years 4 months ago #239899 by nicolas
Hi,

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.

More
10 years 4 months ago #240241 by Poukamisas
Hi,
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.

More
10 years 4 months ago #240248 by nicolas
Hi,

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.

More
10 years 4 months ago #240623 by Poukamisas
Hi,
I have attached the full file content .

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

More
10 years 4 months ago #240627 by nicolas
Hi,

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.

More
10 years 4 months ago #240720 by Poukamisas
Hi,
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.

More
9 years 11 months ago #251584 by Poukamisas
Hi,
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.

More
9 years 11 months ago #251585 by nicolas
Hi,

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.

More
9 years 11 months ago #251697 by Poukamisas
Hi,
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.

More
9 years 11 months ago #251770 by nicolas
Hi,

You're looking at components/com_hikashop/ and not administrator/components/com_hikashop/
The following user(s) said Thank You: Poukamisas

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

More
9 years 11 months ago #251780 by Poukamisas
It works! thank you!

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

Time to create page: 0.343 seconds
Powered by Kunena Forum