VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: joerggoess on December 09, 2020, 17:05:13 PM

Title: VP Merchant + VirtueMart + Stock display
Post by: joerggoess on December 09, 2020, 17:05:13 PM
Hello community,
I need your help, cause I'm not able to fix my "problem" and couldnt find a solution.

I'm running
joomla 3.9.23
vp merchant 5.5
VirtueMart 3.8.6 10373
the two web spaces are running PHP 7.4
and local I'm running an older version.

I've installed the quick_start_vp_merchant 5.5 package on three servers.
One on my local diskstation and two on two different web spaces.
The local installation is the original version with all its demo items.
One one webspace my offical site is running and a backup of it is running on a second space.

My problem: The stock isnt shown an any istallation. If I switch to protos or beez I can see that traffic light (green, orange, red) but on vp_merchant I can see nothing.
On the produktdetail site, there is a text " In Stock" and I can turn it off and on in the configuration. But no stock quantity is shown.
I have googled and read through a lot of forums and postings tried this and that, some overrides from Jumbo, but nothing will work on none of my installations.

There are no other 3rd party plugins or components isntalled, except akeeba backup and a visitor counter an OPmaps. Thats all I've added.

Can anybody help me to fix that, but I'm not a programmer or scripter or what, so please be calm cause it could take a minute or two for me to understand.
It would be nice if the stock quantity will be shown on the productdetail site, it would be great if it could be shown on the category site too, but for me its important that it will be shown anywhere.

Thank you all for your time,
Joerg.
Title: Re: VP Merchant + VirtueMart + Stock display
Post by: Jörgen on December 09, 2020, 17:12:13 PM
Search forum. There is SQL optimization you can uncheck.

Jörgen
Title: Re: VP Merchant + VirtueMart + Stock display
Post by: GJC Web Design on December 09, 2020, 17:35:31 PM
in the VP template I only see this

<?php $show_stock = VmConfig::get('display_stock', 1); ?>
               <?php if($show_stock && $this->product->orderable) : ?>
                  <div class="product-stock-cont col-sm-6">
                     <?php $stock = VPFrameworkVM::getStockText($this->product); ?>
                     <span class="<?php echo $stock->class ?> hasTooltip" title="<?php echo $stock->tip ?>"><?php echo $stock->text ?></span>
                  </div>
               <?php endif; ?>

so it will only show a text if in stock  -- so u need to change the code if u want stk quantity to show
Title: Re: VP Merchant + VirtueMart + Stock display
Post by: joerggoess on December 09, 2020, 17:54:42 PM
Thank you GJC Web Design,
I was searching the forum, but .....

Please two questentions:
What file ist it and where should I find it?   

Can you please write down the syntax I have to change? I've no glue about that .

Thank you
Joerg.
Title: Re: VP Merchant + VirtueMart + Stock display
Post by: joerggoess on December 09, 2020, 19:02:20 PM
Search forum. There is SQL optimization you can uncheck.

Sorry but I cant find what you said. Do you mean the SQL optimization in the shop configuration (I've unselected them, but no change), or in the template?

Thanks Joerg.

Title: Re: VP Merchant + VirtueMart + Stock display
Post by: joerggoess on December 09, 2020, 20:51:39 PM
Thank you, got it.
Title: Re: VP Merchant + VirtueMart + Stock display
Post by: GJC Web Design on December 09, 2020, 22:19:13 PM
\templates\vp_merchant\layouts\default\html\com_virtuemart\productdetails\default.php

you will need to swap out the stock section with the section from the standard  productdetails\default.php file
Title: Re: VP Merchant + VirtueMart + Stock display
Post by: joerggoess on December 09, 2020, 22:30:07 PM
Quote from: GJC Web Design on December 09, 2020, 22:19:13 PM
\templates\vp_merchant\layouts\default\html\com_virtuemart\productdetails\default.php
got it, but where can I find the variable text?

Thank you
Joerg
Title: Re: VP Merchant + VirtueMart + Stock display
Post by: joerggoess on December 09, 2020, 23:05:28 PM
Quote from: GJC Web Design on December 09, 2020, 22:19:13 PM
\templates\vp_merchant\layouts\default\html\com_virtuemart\productdetails\default.php

as I said, got i for the detail view, is there any possibility to show the stock in the category view too?

I've played aound, if quantity is less than quantity to notify, the stock quantity looks like:

Only 49 in stock 49

Ideas???

thanks
Joerg
Title: Re: VP Merchant + VirtueMart + Stock display
Post by: GJC Web Design on December 10, 2020, 12:18:58 PM
as u can see on the std VM stk is also shown on a cat view

http://demo.virtuemart.net/

so u have to use the code provided by the std VM and graft it into your commercial template....
components\com_virtuemart\sublayouts\products.php

            if ( VmConfig::get ('display_stock', 1)) { ?>
               <span class="vmicon vm2-<?php echo $product->stock->stock_level ?>" title="<?php echo $product->stock->stock_tip ?>"></span>
            <?php }
            echo shopFunctionsF::renderVmSubLayout('stockhandle',array('product'=>$product));
            ?>
Title: Re: VP Merchant + VirtueMart + Stock display
Post by: joerggoess on December 10, 2020, 13:41:37 PM
Thank you I'll try it.

Joerg.