Author Topic: Availability Field  (Read 11029 times)

Hujub

  • Beginner
  • *
  • Posts: 24
Availability Field
« on: November 15, 2012, 17:58:09 pm »
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

  • Beginner
  • *
  • Posts: 24
Re: Availability Field
« Reply #1 on: November 23, 2012, 13:35:25 pm »
Anyone know how to do this???

bytelord

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
Re: Availability Field
« Reply #2 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
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

  • Beginner
  • *
  • Posts: 24
Re: Availability Field
« Reply #3 on: November 27, 2012, 13:15:57 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

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
Re: Availability Field
« Reply #4 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

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

  • Beginner
  • *
  • Posts: 24
Re: Availability Field
« Reply #5 on: November 27, 2012, 13:37:35 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

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
Re: Availability Field
« Reply #6 on: November 27, 2012, 14:00:39 pm »
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:

Code: [Select]
<?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

  • Beginner
  • *
  • Posts: 24
Re: Availability Field
« Reply #7 on: November 27, 2012, 14:41:44 pm »
Just UPDATED and its working!

Many many thanks

SOLVED!

bytelord

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
Re: Availability Field
« Reply #8 on: November 27, 2012, 15:35:06 pm »
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

Code: [Select]
<?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

  • Beginner
  • *
  • Posts: 7
Re: Availability Field
« Reply #9 on: March 23, 2014, 01:17:44 am »
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

Code: [Select]
<?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

Code: [Select]
<?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

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27674
  • Always on vacation
    • Jenkin Hill Internet
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VM 3.6.11 10292 on Joomla 3.9.16 PHP 7.0.33

winsonstation

  • Beginner
  • *
  • Posts: 7
Re: Availability Field
« Reply #11 on: March 23, 2014, 13:36:14 pm »
@jenkinhill

The link does not work. It shows me the message

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



jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27674
  • Always on vacation
    • Jenkin Hill Internet
Re: Availability Field
« Reply #12 on: March 23, 2014, 13:50:56 pm »
Sry. Try this http://forum.virtuemart.net/index.php?topic=118683.0

That old bug if fixed for current versions.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VM 3.6.11 10292 on Joomla 3.9.16 PHP 7.0.33

winsonstation

  • Beginner
  • *
  • Posts: 7
Re: Availability Field
« Reply #13 on: March 23, 2014, 14:14:01 pm »
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