News:

Looking for documentation? Take a look on our wiki

Main Menu

Availability Field

Started by Hujub, November 15, 2012, 17:58:09 PM

Previous topic - Next topic

Hujub

VM2 JOOMLA 2.5

How do you get the availability to show on a product?
When i select in in the back end, no show in the front end?

Many thanks,

Hujub

Anyone know how to do this???

bytelord

Hello,

You forgot to mention your VM2 version you are using, just vm 2 is too general, which version? Do you use custom template overrides?

For the availability text/image to work you have to enable the availability and also for each product to select the availability you have. Please make sure you have updated your custom templates if you are using them.

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

Hujub

Quote from: bytelord on November 23, 2012, 14:34:36 PM
Hello,

You forgot to mention your VM2 version you are using, just vm 2 is too general, which version? Do you use custom template overrides?

For the availability text/image to work you have to enable the availability and also for each product to select the availability you have. Please make sure you have updated your custom templates if you are using them.

Regards

Hello Bytelord, thanks for getting back to me,

im using Version 2.0.14
I am using the default template
I have very new to this and am learning as im going...
My site is www.hubjub.co.uk/store

As an example I have Added the below product
(http://www.hubjub.co.uk/store/index.php/pedals/all-city-cecil-pro-detail)

i have changed the availability in the back end but it doesn't show in the product listing

Would really appreciate any help

bytelord

Hello,

You are using the default template as i see but do you use template overrides?

The default code for availability is there, to work is depends what you have select from the backend.
Edit your product, go to Product Status, fix the availability & products in Stock.
Also please configure your stock handle under Configuration-> Shopfront, at the top right Action when a Product is Out of Stock, select an option to handle stock ... for example Products Out of Stock are orderable, and the field 'Availability' below is displayed ...

Regards

Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

Hujub

Quote from: bytelord on November 27, 2012, 13:30:57 PM
Hello,

You are using the default template as i see but do you use template overrides?

The default code for availability is there, to work is depends what you have select from the backend.
Edit your product, go to Product Status, fix the availability & products in Stock.
Also please configure your stock handle under Configuration-> Shopfront, at the top right Action when a Product is Out of Stock, select an option to handle stock ... for example Products Out of Stock are orderable, and the field 'Availability' below is displayed ...

Regards

Hi,
I havnt dont any template overrides just changed colours fonts positions...

I have Changed Product out of stock to show availability field, this does work when the product is out of stock.
Is there any way to show an availability field when the product is in stock?

bytelord

Hello,

You will need to create a template override for the file file for product details view that located under joomla_folder\components\com_virtuemart\views\productdetails\tmpl\default.php. To create a template override just copy that file inside your_joomla_folder\templates\your_joomla_template\html\com_virtuemart\productdetails\default.php

Edit the new overrrided file default.php and make your changes under line 208 you will find the following code:

<?php
// Availability Image
$stockhandle VmConfig::get('stockhandle''none');
if (($this->product->product_in_stock $this->product->product_ordered) < 1) {
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' => 'availability')) : 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' => 'availability')) : $this->product->product_availability?>
</div>
<?php
}
}
?>


Change the line 211 to

      if (($this->product->product_in_stock - $this->product->product_ordered) > 0) {

Try that, i have to test it further something going wrong there ... but this will work for you.

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

Hujub

Just UPDATED and its working!

Many many thanks

SOLVED!

bytelord

Ok,

i think the right code should as showed below...

So, if product availability have been selected for the product then if available stock < 1 and rised is enabled then place rised else place the availability of the product. I don't know why this have been changed ... Could be done with other way also if we correct the original one but need more code and executions... Please test the follow

<?php 
// Availability Image            
               
if (!empty($this->product->product_availability)) { 
$stockhandle VmConfig::get('stockhandle''none');
                if(
$stockhandle=='risetime' and VmConfig::get('rised_availability') and ($this->product->product_in_stock $this->product->product_ordered)<1){
                    
?>

                      <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' => 'availability')) : VmConfig::get('rised_availability'); ?>
</div> 
                <?php } else { ?>
                       
                    <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' => 'availability')) : $this->product->product_availability?>
                    </div>
                        <?php 
                      
}  
                        
                 } 
?>
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

winsonstation

Hello to all...

VM2.0.8 - Joomla 2.5.6

I have chosen the "Products Out of Stock are orderable, and the field 'Availability' below is displayed"

I face the same problem and i cannot fixed it, although i tried what you have said at the previous posts

First code from  /components/com_virtuemart/views/productdetails/tmpl/default.php

<?php
// Availability Image
$stockhandle VmConfig::get('stockhandle''none');
if (($this->product->product_in_stock $this->product->product_ordered) < 1) {
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' => 'availability')) : 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' => 'availability')) : $this->product->product_availability?>
</div>
<?php
}
}
?>



Second code from  /templates/theme310/html/com_virtuemart/productdetails/default.php

<?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 == 'risetime' and ($this->product->product_in_stock $this->product->product_ordered) < 1) {
?>
<div class="availability">
<?php echo 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' => 'availability')); ?>
</div>
<?php } else {
?>

<div class="availability">
<?php echo JHTML::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' $this->product->product_availability$this->product->product_availability, array('class' => 'availability')); ?>
</div>
<?php
}
}
?>


If i copy/paste/overwrite the first code at the second one, then with some changes at < 1, > 1, > 0 and the number at the product status 0 or 100, then the 24h.gif it appears, but the whole product layout is being "damaged"

If i change at the second code the < 1, > 1, > 0 and the number at the product status 0 or 100, then no *.gif appears ever, and have no changes at the product layout.

Any help pls??? Thx

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

winsonstation

@jenkinhill

The link does not work. It shows me the message

An Error Has Occurred!
The board you specified doesn't exist



jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

winsonstation

#13
Thank you jenkinhill.

I have thought several times to upgrade to newest versions of joomla and virtuemart, since i had also problems with products pagination but my template is compatible with these versions ( j2.5.6 and vm 2.0.8 ) and cannot run at other versions.

So untill i change the template, i have to fix some bugs.

How can i fix this problem now?

Thank you in advance