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

Display SKU in all modules of Virtuemart

Started by suffering, March 04, 2016, 11:03:27 AM

Previous topic - Next topic

suffering

Hello

I use VM 3
I want to display in all modules of virtuemart under product_name the product_sku.
What i have to do because all existing tutorials are for old versions of VM.
I managed to add sku and weight in product page but i cannot add sku in
Featured products
Random products
Top sellers etc.

Ghost

If you mean mod_virtuemart_product module, create a template override of /modules/mod_virtuemart_product/tmpl/default.php. If you meant VirtueMart frontpage and/or category pages, create an override of products.php sublayout http://docs.virtuemart.net/tutorials/templating-layouts/199-sublayouts.html

suffering

Thanks for immidiate reply but i will need some step by step help in this matter if you can please.

suffering

Hello

I managed to enter the sku in categories by edditing
templates\YOUR_TEMPLATE\html\com_virtuemart\sublayouts\products.php

adding
<?php // Product Sku
                    if (!empty($product->product_sku)) { ?>

                        <p class="product_sku">
                     <?php echo $product->product_sku; ?>
                     </p>

Now i only need to find where and what i must edit to display sku in
eg Random products module.
eg latest products module.
There it displays only product name and image.
I need to add SKU also.

Ghost

Create a template override of /modules/mod_virtuemart_product/tmpl/default.php. It should be placed in templates\YOUR_TEMPLATE\html\mod_virtuemart_product\default.php.

suffering

hello

Can you please explain how to do this?

Create a template override of /modules/mod_virtuemart_product/tmpl/default.php. It should be placed in templates\YOUR_TEMPLATE\html\mod_virtuemart_product\default.php.

Ghost

Open /modules/mod_virtuemart_product/tmpl/default.php and copy its contents to /templates/YOUR_TEMPLATE/html/mod_virtuemart_product/default.php.

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

suffering

I did this
Open /modules/mod_virtuemart_product/tmpl/default.php and copy its contents to /templates/YOUR_TEMPLATE/html/mod_virtuemart_product/default.php.
I changed in product_name to product_sku in 4 fields and no change happened.

stula

I can confirm this bug... No matter what I add/remove to templates/mytemplate/html/mod_virtuemart_product/default.php file it doesn't work... On the other hand... if I try same thing in original file (not override) it works fine... Its like override for this module doesn't work.

Ghost

This is probably because the override is disabled. Go to your product module settings and change Layout from 'No override' to 'default'.

stula

Quote from: Ghost on March 15, 2016, 10:46:49 AM
This is probably because the override is disabled. Go to your product module settings and change Layout from 'No override' to 'default'.

This helped! Thank you!  ;)

suffering

Hello

I managed to solve this matter by adding

<?php echo $product->product_sku ?>

next to
php echo $product->product_name ?>

in
/public_html/templates/yourtemplate/html/mod_virtuemart_product/default.php

If you use overide then add also in overide php.