Author Topic: How to show SKU and GTIN in product and category layout?  (Read 7748 times)

lukab

  • Beginner
  • *
  • Posts: 5
  • A beginner
How to show SKU and GTIN in product and category layout?
« 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.

Ghost

  • Jr. Member
  • **
  • Posts: 419
Re: How to show SKU and GTIN in product and category layout?
« Reply #1 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.

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8948
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.4.2
Re: How to show SKU and GTIN in product and category layout?
« Reply #2 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
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

AH

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2928
  • VirtueMart Version: 3.6.0
Re: How to show SKU and GTIN in product and category layout?
« Reply #3 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

Code: [Select]


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

Joomla 3.9.8
php 7.1

StefanSTS

  • Global Moderator
  • Jr. Member
  • *
  • Posts: 388
  • VirtueMart Version: VM 4.2 on Joomla 4.5
Re: How to show SKU and GTIN in product and category layout?
« Reply #4 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
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your life shop! Use Alpha versions only if you know what risk you are taking.