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 Qty Instead of colored boxes

Started by mikidudle, June 13, 2017, 02:09:53 AM

Previous topic - Next topic

mikidudle

Hello,
I am running VM 3.7.1 using win 7 64-bit machine.  Joomla is 3.7.2 and Protostar template. Using Firefox. I have overrides but none that should affect this. They are:

COM_CONTENT_ARTICLE_INFO en-GB Site    COM_CONTENT_MODIFIED_DATE Last Updated: en-GB Site    COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT  Choose Options! en-GB Site    COM_VIRTUEMART_PRODUCT_SALESPRICE  Sale Price: en-GB  Site    COM_VIRTUEMART_SEARCH  Search en-GB Site    COM_VM_SEARCH_DESC en-GB Site    DATE_FORMAT_LC3    F d, Y  en-GB Site    TPL_PROTOSTAR_BACKTOTOP

I want to remove the colored quantity in stock indicator for each product and add a simple number for quantity in stock with a label that says Qty In Stock: xx where xx is the stock quantity.
If you have a complete answer to what file this code is in, what code to remove and what code I should replace it with I would be very grateful.  I cannot find it after looking for many days.  I find pieces of this answer but no code changes I've made cause any progress.

Help.  Thank you in advance.

Yes I am a novice - yes I know enough to get into trouble - Yes I must ask for help before I blow it up!

Mike

jenkinhill

Assuming that you have no template overrides yet.

Add a new language variable as an override.  Here I used COM_VIRTUEMART_STOCK  which is configured as Qty in stock:

In components/com_virtuemart/sublayouts/products.php

Find

<div class="vm-product-rating-container">
<?php echo shopFunctionsF::renderVmSubLayout('rating',array('showRating'=>$showRating'product'=>$product));
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));
?>

</div>


Replace with

<div class="vm-product-rating-container">
<?php echo shopFunctionsF::renderVmSubLayout('rating',array('showRating'=>$showRating'product'=>$product)); ?>

<?php echo vmText::_('COM_VIRTUEMART_STOCK' ) . $product->product_in_stock ?>

</div>


Use the edited file as a template override - ie put the file in templates/protostar/html/com_virtuemart/sublayouts/

You may need to add some css or other edit to get the layout right for you.

And your VM version will not be 3.7.1 - we have not got past 3.2.3 yet...........
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

mikidudle

 ;D !!!
Thank you jenkinhill!  That's awesome - works very well.  I really appreciate it - and I learned that I needed to create the folders you called out for templates/protostar/html/com_virtuemart/sublayouts/.  That's just part of creating these overrides in VM.  Good to know.  Can you steer me in the direction of the CSS file(s) that control the product page layout?  You are correct that I need to adjust a bit of css to make this look right.

Thank you again!
M

jenkinhill

I had that code available because a client previously paid me to develop it for his site.....

VM main css file is vm-ltr-site.css  - in components/com_virtuemart/assets/css   Override docs here, although the css file changed names since then, the principle is the same. https://docs.virtuemart.net/tutorials/templating-layouts/106-override-vmsite-ltr-css.html

With Protostar I prefer to create a user.css file to use for all template & VM style  overrides  https://extensions.joomla.org/blog/item/load-custom-css-in-protostar-the-default-joomla-template/
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

mikidudle

Thank you for your time and generosity.  The code works perfectly and your direction of using overrides ... even for the css ... is really valuable. Enjoy!
M

mfarooqi

Quote from: mikidudle on June 13, 2017, 02:09:53 AM
Hello,
I am running VM 3.7.1 using win 7 64-bit machine.  Joomla is 3.7.2 and Protostar template. Using Firefox. I have overrides but none that should affect this. They are:

COM_CONTENT_ARTICLE_INFO en-GB Site    COM_CONTENT_MODIFIED_DATE Last Updated: en-GB Site    COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT  Choose Options! en-GB Site    COM_VIRTUEMART_PRODUCT_SALESPRICE  Sale Price: en-GB  Site    COM_VIRTUEMART_SEARCH  Search en-GB Site    COM_VM_SEARCH_DESC en-GB Site    DATE_FORMAT_LC3    F d, Y  en-GB Site    TPL_PROTOSTAR_BACKTOTOP

I want to remove the colored quantity in stock indicator for each product and add a simple number for quantity in stock with a label that says Qty In Stock: xx where xx is the stock quantity.
If you have a complete answer to what file this code is in, what code to remove and what code I should replace it with I would be very grateful.  I cannot find it after looking for many days.  I find pieces of this answer but no code changes I've made cause any progress.

Help.  Thank you in advance.

Yes I am a novice - yes I know enough to get into trouble - Yes I must ask for help before I blow it up!

Mike

Although you've been answered.. but they way you asked question is really appreciated. very polite and it made me to indulge into too...



Quote from: jenkinhill on June 13, 2017, 17:06:25 PM
I had that code available because a client previously paid me to develop it for his site.....

VM main css file is vm-ltr-site.css  - in components/com_virtuemart/assets/css   Override docs here, although the css file changed names since then, the principle is the same. https://docs.virtuemart.net/tutorials/templating-layouts/106-override-vmsite-ltr-css.html

With Protostar I prefer to create a user.css file to use for all template & VM style  overrides  https://extensions.joomla.org/blog/item/load-custom-css-in-protostar-the-default-joomla-template/

Thank you.. I was also about override the same. :)