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

custom fields in category view!?

Started by Naturt, June 04, 2015, 14:30:16 PM

Previous topic - Next topic

Naturt

Hi there! This is an old and big problem for me. At VM2 this works perfectly, but now (Joomla! 3.4.1 & VirtueMart 3.0.9) many things are changed.

So I have a category, and an unique Category Browse Page at here: components\com_virtuemart\views\category\tmpl\UNIQUEBRPAGE.php

I want to display the products custom fields (titles and values) on this page, but it is not working.

The old and working code (at VM2) was:

if (!empty($product->customfieldsCart)

if the product has custom field

foreach ($product->customfieldsCart as $field)
{
echo $field->custom_title."<br>".$field->custom_field_desc;
}


This is just a short extract from the code. All of my custom variables are gone now. I search all of the forums but I lost..

1. Dumped out the $product variable
(after this:
foreach ($this->products as $product)
)

I see many of arrays, and I reach the most of them, for example the ["virtuemart_product_id"], ["product_name"] etc.
There is an array, named ["customfieldsSorted"].
When I try to dump it
var_dump($product["customfieldsSorted"]); >> Fatal error:  Cannot use object of type TableProducts as array
I tried an other way:
var_dump($product->customfieldsSorted); >> working, so this is an object

There are more arrays and objects in here. I find one of my custom title:
array(1) {
  ["normal"]=>
  array(4) {
    [0]=>
    object(stdClass)#5327 (33) {
      ["virtuemart_custom_id"]=>
      string(3) "108"
      ["custom_parent_id"]=>
      string(1) "0"
      ["virtuemart_vendor_id"]=>
      string(1) "1"
      ["custom_jplugin_id"]=>
      string(1) "0"
      ["custom_element"]=>
      string(1) "0"
      ["admin_only"]=>
      string(1) "0"
      ["custom_title"]=>
      string(21) "[b]MY CUSTOM TITLE[/b]"


My question is, how can I reach it?! It is drive me crazy -.- I want the custom parameters as hell -.-


Naturt

Thank you for the nothing. I solved it myself  >:(

AH

Well done - and it cost you nothing to learn  :)

Regards
A

Joomla 4.4.5
php 8.1

David Kan

Hi Naturt,

This is an interesting topic.

If you are not very angry, can you please share the solution?

We need to learn from you  8)