VirtueMart Forum

VirtueMart 2 + 3 => Product creation => Topic started by: AnSit on October 17, 2018, 18:20:10 pm

Title: Problem with using text in the Availability field instead of an image.
Post by: AnSit on October 17, 2018, 18:20:10 pm
Please tell me how to solve the problem.

In the Availability field, I enter the text I need (without selecting an image!).

And when I save or update the product editing page, this page takes a very long time to load - at least 30 seconds. I found by the browser means that all this time there is a search for an image that does not exist, since I manually filled the field with the text I needed.

Tell me how to remove such a long search for images so that the page does not load for so long? Or can you fix it in the next version of VM? If you can choose an image or enter text.
Title: Re: Problem with using text in the Availability field instead of an image.
Post by: GJC Web Design on October 17, 2018, 18:38:42 pm
live url?
standard templates?
Title: Re: Problem with using text in the Availability field instead of an image.
Post by: AnSit on October 17, 2018, 19:35:09 pm
Thank you for your participation!

Yes, the control panel template is standard: isis - Default

Do you want me to give you a link to the site?
But you will not see anything from the frontend. It needs to enter edit mode through the control panel.
Title: Re: Problem with using text in the Availability field instead of an image.
Post by: GJC Web Design on October 17, 2018, 19:51:03 pm
you mean the delay is in the admin if u add a text as in screen?

Is that even the intention of that field?

Title: Re: Problem with using text in the Availability field instead of an image.
Post by: AnSit on October 17, 2018, 20:58:33 pm
Yes, all right understood and shown!

When I add just my text there and save or refresh the page, the browser refreshes the page for a very long time. And if you look at the chronology of loading elements of the page, then the problem is precisely in the loading of this element. Over 30 sec.

I tried it in Firefox and Chrome
Title: Re: Problem with using text in the Availability field instead of an image.
Post by: GJC Web Design on October 17, 2018, 23:33:19 pm
but as I say .. it would appear u are supposed to ( or maybe the code is wrong) just add the file name of an image that exists in the folder ( although don't know why it would be intended that way as I assume the dropdown finds all images)

If u add a txt there does it appear as the availability text on the front end?

Don't know why your server spends 30 sec gagging on a 404 image tho -- mine 404's but this uses a few milli secs
Title: Re: Problem with using text in the Availability field instead of an image.
Post by: AnSit on October 18, 2018, 02:20:13 am
Yes, on the front side it is displayed as text, what I wrote in the field.
And it is very convenient when you just need the text, not the image.

I noticed even if you change the version of PHP from 7.2 to 5.6, then the page loads 6-8 seconds.
Title: Re: Problem with using text in the Availability field instead of an image.
Post by: GJC Web Design on October 18, 2018, 10:32:37 am
in file ( you can over ride these in your admin template/html/com_virtuemart/products )

administrator\components\com_virtuemart\views\product\tmpl\product_edit_status.php

~ line 123

replace
Code: [Select]
<td><img border="0" id="imagelib" alt="<?php echo vmText::_('COM_VIRTUEMART_PREVIEW'); ?>" name="imagelib" src="<?php if ($this->product->product_availability) echo JURI::root(true).$this->imagePath.$this->product->product_availability;?>"/></td>
with

Code: [Select]
<td>
<?php 
if(file_exists(JPATH_ROOT '/' VmConfig::get('assets_general_path') . 'images/availability/' $this->product->product_availability)){ ?>

<img border="0" id="imagelib" alt="<?php echo vmText::_('COM_VIRTUEMART_PREVIEW'); ?>" name="imagelib" src="<?php if ($this->product->product_availability) echo JURI::root(true).$this->imagePath.$this->product->product_availability;?>"/>
<?php } ?>
</td>

and in administrator\components\com_virtuemart\views\config\tmpl\default_shopfront.php ~ line 141 perhaps better/cleaner to replace

Code: [Select]
<img id="imagelib" alt="<?php echo vmText::_('COM_VIRTUEMART_PREVIEW'); ?>" name="imagelib" src="<?php if (VmConfig::get('rised_availability')) {
echo JURI::root(true) . $this->imagePath VmConfig::get('rised_availability');
}?>
"/>

with

Code: [Select]
<?php if(VmConfig::get('rised_availability')){ ?>
<img id="imagelib" alt="<?php echo vmText::_('COM_VIRTUEMART_PREVIEW'); ?>" name="imagelib" src="<?php if (VmConfig::get('rised_availability')) {
echo JURI::root(true) . $this->imagePath VmConfig::get('rised_availability');
}?>
"/>
<?php } ?

hopefully done in the core next release
Title: Re: Problem with using text in the Availability field instead of an image.
Post by: AnSit on October 18, 2018, 13:06:44 pm
Thank you very much for your help!
Your decision definitely helped.
Now, instead of 30 seconds, the page is updated 3 seconds.
Title: Re: Problem with using text in the Availability field instead of an image.
Post by: Milbo on October 21, 2018, 19:30:18 pm
added, but different.

Code: [Select]
<img border="0" id="imagelib" alt="<?php echo vmText::_('COM_VIRTUEMART_PREVIEW'); ?>" name="imagelib" src="<?php if ($this->product->product_availability and file_exists(JPATH_ROOT '/' $this->imagePath.$this->product->product_availability)) echo JURI::root(true).$this->imagePath.$this->product->product_availability;?>"/>

Code: [Select]
<img id="imagelib" alt="<?php echo vmText::_('COM_VIRTUEMART_PREVIEW'); ?>" name="imagelib" src="<?php if (VmConfig::get('rised_availability') and file_exists(JPATH_ROOT '/' $this->imagePath.VmConfig::get('rised_availability'))) {
echo JURI::root(true) . $this->imagePath VmConfig::get('rised_availability');
}?>
"/>