News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Show stock when stockable variants

Started by andreas.hallberg, February 24, 2013, 22:46:05 PM

Previous topic - Next topic

andreas.hallberg

Hi,


I have never programmed php so if someone could give me at tip I would be very thankful.


I use custom fields "Stockable variants" and I would like to display the stock for the choosen variant if stock > 0 at the same place where the availability text/image are shown when stock is empty.

I have found these lines in "default.php" under "/components/com_virtuemart/views/productdetails/tmpl" that seems to handle the availability field/image.

// 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

}


Do these lines handle just parent availability or both parent and child (stockable variant)?

If not, where can I find the code that handles the stockable variant/child product?


BR

Andreas

[attachment cleanup by admin]