VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: lukab on February 25, 2016, 15:58:58 PM

Title: How to show SKU and GTIN in product and category layout?
Post by: lukab on February 25, 2016, 15:58:58 PM
Joomla 2.5.28
VM 3.0.9
PHP 5.4

I'll update later to newer version but right now I need to make it to SKU and GTIN show in product and category layout..any help?
I tried a lot of thing but it didn't work.
Title: Re: How to show SKU and GTIN in product and category layout?
Post by: Ghost on February 27, 2016, 23:11:24 PM
Copy /components/com_virtuemart/sublayouts/products.php to /templates/yourtemplate/html/com_virtuemart/sublayouts. Create the folder if it doesn't exist. Edit this new products.php file (which is now placed in your template folder). Put the shown code wherever you want SKU/GTIN to show up.
Title: Re: How to show SKU and GTIN in product and category layout?
Post by: GJC Web Design on February 27, 2016, 23:52:09 PM
also for details Copy /components/com_virtuemart/views/productdetails/default.php to /templates/yourtemplate/html/com_virtuemart/productdetails and add the code
Title: Re: How to show SKU and GTIN in product and category layout?
Post by: AH on March 01, 2016, 10:51:13 AM

IMHO - adding a few lines to a template override, is far easier and more manageable than using customfields

e.g. for the category view:-

\templates\yourtemplate\html\com_virtuemart\sublayouts\products.php



//GTIN may be empty for a product
if(!empty($product->product_gtin){
echo $product->product_gtin;
}
echo $product->product_sku;



You can then forget about customfields and the data will be shown if entered on the product record
Title: Re: How to show SKU and GTIN in product and category layout?
Post by: StefanSTS on July 29, 2019, 17:03:04 PM
Yes, EvanGR, as AH mentioned earlier.
A moderator should just delete all the misinformation about custom fields to get a clear path here.
A template override is the only viable solution.

Stefan