Darstellung der Produktcharakteristik

20.02.2019 15:34
#1
Mino13
Joomshopping forum user no avatar
Name: Julia
15.02.2017
Сообщения: 8
Quote
Darstellung der Produktcharakteristik

Hallo,
ich bin dabei, das Aussehen der Joomshopping-Komponente anzupassen. Ich habe verschiedene Produktcharakteristiken definiert, die ich einzeln gestalten möchte. Im Template steht der folgende Code (die Klasse 'buch-beschr' stammt von mir, der Rest ist Original):

<?php if (is_array($this->product->extra_field)){?>
<div class="extra_fields">
<?php foreach($this->product->extra_field as $extra_field){?>
<?php if ($extra_field['grshow']){?>
<div class='block_efg'>
<p class="buch-beschr">
<div class='extra_fields_group'><?php print $extra_field['groupname']?></div>
</p>
<?php }?>

<div class="extra_fields_el">
<p class="buch-beschr">
<span class="extra_fields_name"><?php print $extra_field['name'];?></span><?php if ($extra_field['description']){?>
<span class="extra_fields_description">
<?php print $extra_field['description'];?>
</span><?php } ?>:
<span class="extra_fields_value">
<?php print $extra_field['value'];?>
</span>
</p>
</div>

Hier werden alle Charakteristiken der Reihe nach ausgegeben. Wenn ich nun auf einzelne Charakteristiken zugreifen möchte, müsste ich einen Code ungefähr wie

<?php print $this->product->extra_field(1)['groupname']; ?>
<?php print $this->product->extra_field(1)['value']; ?>

einfügen?? Ich komme mit dem Array nicht klar. Wer kann mir mit dem korrekten Code helfen?
Vielen Dank schon mal.


Joomla: 3.9.3
JoomShopping: 4.18.2
PHP: 7.3.1
MySQL: 4.8.4
Website Url: lokal
 
20.02.2019 15:38
#2
Mino13
Joomshopping forum user no avatar
Name: Julia
15.02.2017
Сообщения: 8
Quote
Layout of product characteristics

Hello,
I'm adjusting the layout of the joomshopping component. I defined different product characteristics, which I would like to layout separately. The following code was taken from the original template (class 'buch-beschr' is mine, the rest would be the original):

<?php if (is_array($this->product->extra_field)){?>
<div class="extra_fields">
<?php foreach($this->product->extra_field as $extra_field){?>
<?php if ($extra_field['grshow']){?>
<div class='block_efg'>
<p class="buch-beschr">
<div class='extra_fields_group'><?php print $extra_field['groupname']?></div>
</p>
<?php }?>

<div class="extra_fields_el">
<p class="buch-beschr">
<span class="extra_fields_name"><?php print $extra_field['name'];?></span><?php if ($extra_field['description']){?>
<span class="extra_fields_description">
<?php print $extra_field['description'];?>
</span><?php } ?>:
<span class="extra_fields_value">
<?php print $extra_field['value'];?>
</span>
</p>
</div>

All characteristics are processed one after the other. If I just want to process single characteristics, I would have to write some code like:

<?php print $this->product->extra_field(1)['groupname']; ?>
<?php print $this->product->extra_field(1)['value']; ?>

I can't cope with the array. Could someone help me with the right code?
Many thanks in advance.


Joomla: 3.9.3
JoomShopping: 4.18.2
PHP: 7.3.1
MySQL: 4,8.4
Website Url: local

Последнее изменение: 20.02.2019 15:39
 
20.02.2019 18:20
#3
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Сообщения: 25913
Quote
Aw: Darstellung der Produktcharakteristik

$this->product->extra_field[1]

() - function
[] - array

 
20.02.2019 22:10
#4
Mino13
Joomshopping forum user no avatar
Name: Julia
15.02.2017
Сообщения: 8
Quote
Aw: Darstellung der Produktcharakteristik

Danke!
print $this->product->extra_field[1]['name'];
print $this->product->extra_field[1]['value'];
So geht es!

 


Copyrights MAXXmarketing GmbH. Alle Rechte vorbehalten
Durch die Nutzung dieser Website stimme ich zu, dass Cookies zur optimalen Gestaltung der Website sowie zur Analyse der Nutzung der Website verwendet werden. Weiterführende Informationen finden Sie hier. OK, einverstanden.