Neu How to display the contents of a variable $GLOBALS->Preise->cVKLocalized[$fVKBrutto]?

vladislavzp

Neues Mitglied
18. November 2019
4
0
How to display the contents of a variable $GLOBALS->Preise->cVKLocalized[$fVKBrutto]? I try using a var_dump, but return null
Catalog "includes/plugins/myplugin/version/100/frontend/conf.php"
 

Tomas

Sehr aktives Mitglied
8. Januar 2018
330
69
Lübeck
Hey :)

You are using the float $fVKBrutto as an index for the array cVKLocalized. That cannot work ;)

Try dump $GLOBALS->Preise->cVKLocalized first. There should be stored a brutto and a netto value.
 

vladislavzp

Neues Mitglied
18. November 2019
4
0
Hey :)

You are using the float $fVKBrutto as an index for the array cVKLocalized. That cannot work ;)

Try dump $GLOBALS->Preise->cVKLocalized first. There should be stored a brutto and a netto value.
This variable ($GLOBALS->Preise->cVKLocalized) also returns null-value. But if just $GLOBALS return array and have cVKLocalized value.
 
Zuletzt bearbeitet:

MBesancon

Administrator
Mitarbeiter
1. Oktober 2010
2.049
184
Erkelenz
There's no place in the code where a var named $GLOBALS is used. Where did you get that var from? Please explain more detailed what you want to do. This "one sentence" topics are not very target-oriented.
 

Tomas

Sehr aktives Mitglied
8. Januar 2018
330
69
Lübeck
Ok...i see

First things first - you are using the wrong hook to for the product page.
The right hook is '1'.
Source: http://docs.jtl-shop.de/de/latest/shop_plugins/hook_list.html

There you shouldn't work with the $GLOBALS variable but with the data passed to the plugin through the hook.

The data are stored in $args_arr.
Source: https://jtl-devguide.readthedocs.io/projects/jtl-shop/de/latest/shop_plugins/hooks.html

Then you can do something like this to achieve your goal:

Code:
$oArtikel = $args_arr['oArtikel'];
$cVKLocalized = $oArtikel->Preise->cVKLocalized[0];
 
  • Gefällt mir
Reaktionen: vladislavzp