Welcome, Guest
Username: Password: Remember me
Use this Category for your support questions about Responsive Joomla Virtuemart Template - LightMart (SKU# FLEX-00012)

TOPIC: Multilingual availiability icons

Multilingual availiability icons 10 years 5 months ago #7311

Hello again,

I know I have been asking a lot of questions but I need to ask one more!

In the tutorial pdf that comes along with the template files you describe how to translate the availability icons. Ok I did this (it was easy) but how can I make different icons appear depending on the selected language in a multilingual site?

A solution would be to use text instead of icons and utilize the help of the language *.ini files but that didn't work either because I've noticed that you have overridden virtuemart's core functionality on this in such a way that whatever is input in the availability form, the system searches for a corresponding *.png file. If my assumption is incorrect disard this.

Anyway my question is how can I make it work in a multilingual manner?

Thanks a lot
Last Edit: 10 years 5 months ago by Alexis Lampsidis.
The administrator has disabled public write access.

Multilingual availiability icons 10 years 5 months ago #7328

Hi,

Currently, not possible. Thanks for addressing this issue.

This is one of the biggest missing part in all of our templates, and it is a critical one. We need to find a way to solve it. We didn't use the original VM cores for showing the availability icons, but instead we have used our own coding scheme to show those icons. (because VM core was coded to use GIF, but we needed to use PNG to increase the icon quality, because no matter what you do, you can't reach the PNG quality with GIF)

After we come up with a solution, we should better publish a tutorial about it though. Because again, we will have our own way.

But for now, you can use the Virtuemart Core functions to show the availability icons though, those will have multi-language support. To eliminate our template's code and get back to official Virtuemart scheme; open this PHP file:

/templates/flexible_lightmart/html/com_virtuemart/productdetails/default.php

and look for these lines and highlight them:
<?php // Availability Image
				/* TO DO add width and height to the image */
				if (!empty($this->product->product_availability)) {
					 $stockhandle = VmConfig::get('stockhandle','none');
						if($stockhandle=='none') {
							$GifToPNG = substr($this->product->product_availability, 0, -3); 
							?>
                            <div class="availability">
                         <img src="<?php echo JURI::root().'templates/'.$template.'/html/com_virtuemart/assets/images/availability/'.$GifToPNG; ?>png" class="FlexibleavailabilityIMG" alt="" />    					
                         </div>
						<?php } 
						if($stockhandle=='risetime' and ($this->product->product_in_stock - $this->product->product_ordered)<1){
				 			$GifToPNG = substr(VmConfig::get('rised_availability'), 0, -3);
							?>	
                        	<div class="availability">
                        <img src="<?php echo JURI::root().'templates/'.$template.'/html/com_virtuemart/assets/images/availability/'.$GifToPNG; ?>png" class="FlexibleavailabilityIMG" alt="" />
						</div>
						<?php	} 
						if($stockhandle=='disableadd' and ($this->product->product_in_stock - $this->product->product_ordered)>=1){
				 			$GifToPNG = substr($this->product->product_availability, 0, -3);
							?>	
                        	<div class="availability">
                        <img src="<?php echo JURI::root().'templates/'.$template.'/html/com_virtuemart/assets/images/availability/'.$GifToPNG; ?>png" class="FlexibleavailabilityIMG" alt="" />
						</div>
						<?php	} 
						if($stockhandle=='risetime' and ($this->product->product_in_stock - $this->product->product_ordered)>=1){
				 			$GifToPNG = substr($this->product->product_availability, 0, -3);
							?>	
                        	<div class="availability">
                        <img src="<?php echo JURI::root().'templates/'.$template.'/html/com_virtuemart/assets/images/availability/'.$GifToPNG; ?>png" class="FlexibleavailabilityIMG" alt="" />
						</div>
						<?php	} 
 
				}
				?>

replace them all with these below:
<?php
		// Availability
		$stockhandle = VmConfig::get('stockhandle', 'none');
		$product_available_date = substr($this->product->product_available_date,0,10);
		$current_date = date("Y-m-d");
		if (($this->product->product_in_stock - $this->product->product_ordered) > 1) {
			if ($product_available_date != '0000-00-00' and $current_date < $product_available_date) {
			?>	<div class="availability">
					<?php echo JText::_('COM_VIRTUEMART_PRODUCT_AVAILABLE_DATE') .': '. JHTML::_('date', $this->product->product_available_date, JText::_('DATE_FORMAT_LC4')); ?>
				</div>
		    <?php
			} else if ($stockhandle == 'risetime' and VmConfig::get('rised_availability') and empty($this->product->product_availability)) {
			?>	<div class="availability">
			    <?php echo (file_exists(JPATH_BASE . DS . VmConfig::get('assets_general_path') . 'images/availability/' . VmConfig::get('rised_availability'))) ? JHTML::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' . VmConfig::get('rised_availability', '7d.gif'), VmConfig::get('rised_availability', '7d.gif'), array('class' => 'availabilityImage')) : JText::_(VmConfig::get('rised_availability')); ?>
			</div>
		    <?php
			} else if (!empty($this->product->product_availability)) {
			?>
			<div class="availability">
			<?php echo (file_exists(JPATH_BASE . DS . VmConfig::get('assets_general_path') . 'images/availability/' . $this->product->product_availability)) ? JHTML::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' . $this->product->product_availability, $this->product->product_availability, array('class' => 'availabilityImage')) : JText::_($this->product->product_availability); ?>
			</div>
			<?php
			}
		}
		else if ($product_available_date != '0000-00-00' and $current_date < $product_available_date) {
		?>	<div class="availability">
				<?php echo JText::_('COM_VIRTUEMART_PRODUCT_AVAILABLE_DATE') .': '. JHTML::_('date', $this->product->product_available_date, JText::_('DATE_FORMAT_LC4')); ?>
			</div>
		<?php
		}
		?>

With these change, you will start showing icons in this path;
/components/com_virtuemart/assets/images/availability/

But be aware, you will start using the GIF-format icons, not PNG.

Regards.
Support & Development
The administrator has disabled public write access.
Time to create page: 0.124 seconds

MaterialMart

for Virtuemart 3

Google's Material Design has finally arrived to Virtuemart

Virtumart Template - MaterialMart Virtumart Template - CleanMart Virtumart Template - CleanMart Virtumart Template - CleanMart

Fully responsive!

Buy Now   |   Live Demo