VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: marvays on February 17, 2022, 13:23:52 PM

Title: Add field in Category
Post by: marvays 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.

Title: Re: Add field in Category
Post by: pinochico on February 17, 2022, 14:21:50 PM
QuoteFor 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
Title: Re: Add field in Category
Post by: pinochico on February 17, 2022, 14:29:52 PM
Martine,

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


//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.


// 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.
Title: Re: Add field in Category
Post by: marvays 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.
Title: Re: Add field in Category
Post by: pinochico 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