Author Topic: Add field in Category  (Read 950 times)

marvays

  • Jr. Member
  • **
  • Posts: 441
    • richta.cz
  • Skype Name: marvays
Add field in Category
« on: February 17, 2022, 13:23:52 pm »
Good day everyone.
I would like to see one extra column on /index.php?option=com_virtuemart&view=product. Can you tell me how I can program it?

For example, instead of the "Shopper Reviews" column, I want to see the number of pieces in stock. Or I want to add another column that shows the name of the tempalte used for "Product Details Page".

I'd love for someone to explain. It may come in handy for others.
Thank you and have a nice day.


pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1542
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Add field in Category
« Reply #1 on: February 17, 2022, 14:21:50 pm »
Quote
For example, instead of the "Shopper Reviews" column, I want to see the number of pieces in stock.

We developed for our clients self
It is no perfect, because we created override view in admin template (not new plugin), but is ok for client
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1542
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Add field in Category
« Reply #2 on: February 17, 2022, 14:29:52 pm »
Martine,

základ je se naučit pracovat a debugovat v PHP.

Code: [Select]
//debug
//echo '<pre style="display:none;">';
//echo 'Položka: '.print_r($item).'<br>';
//echo '</pre>';

kde místo $item vložíte aktuální object na daném view.
například zde ve view seznam produktů uvidíte že máte všechny informace, které pak můžete použít pro úpravu view a zobrazení skladovosti i na seznamu produktů.

Pokud je mít nebude, musíte ve view.html.php vložit volání dalšího modelu, který data bude obsahovat.

Přesný postup hledejte zde nebo na google.

---

Martin,

the basis is to learn to work and debug in PHP.

Code: [Select]
// debug
// echo '<pre style="display: none;">';
// echo 'Item:' .print_r ($item). '<br>';
// echo '</pre>';

where instead of $item you enter the current object in the given view.
for example, you will see there in list of product's that you have all the information, which you can then use to edit the view and display the stock in the product list.

If it does not have them, you must enter a call to another model that will contain the data in view.html.php.

Find the exact procedure there on forum or on google.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

marvays

  • Jr. Member
  • **
  • Posts: 441
    • richta.cz
  • Skype Name: marvays
Re: Add field in Category
« Reply #3 on: February 17, 2022, 14:50:52 pm »
pinochico, thank you for your time.
What you write to me is very professional for me. I can't learn php. I'm full of other things.

I did it like a pig. I found the necessary file, searched for the correct field in the table. Changing the column name was easy depending on the language file. Listing the number of items in stock was a matter of three options. I hit the first time.

Of course, if I want to add a new column, it will be difficult for me.

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1542
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Add field in Category
« Reply #4 on: February 17, 2022, 18:29:43 pm »
object is $product
from echo print_r - stock in foreach is the same as name from DB table #__virtuemart_products DB column == product_in_stock

Then in foreach in php must be echo $product->product_in_stock

Others - new table column in admin view or change existing - is very easy.
Ofcourse you can add solutions for sorting look to others column in admin table view
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products