-- HikaShop version -- : 2.3.3.
Hi!
I wanna show a custom field on product listings, but I wanna populate it's dropdown with the addresses the user saved in Shipping addresses.
I'm trying to modify product/add_to_cart_listing.php
as I created a custom item field with id 'szallitasi_cim', I wanna load different options then it has:
<?php
foreach($itemFields as $fieldName => $oneExtraField) {
$itemData = JRequest::getString('item_data_'.$fieldName,$this->row->$fieldName); ?>
<?php if ($oneExtraField->field_namekey=='szallitasi_cim'){ ?>
<div id="hikashop_item_<?php echo $oneExtraField->field_namekey; ?>" class="hikashop_item_<?php echo $oneExtraField->field_namekey;?>_line" style="float: left;
text-align: center; border: 1px solid #eee; padding: 5px; margin: 0 2px 0 2px; width: 200px; min-height:60px;">
<div class="key">
<span id="hikashop_product_custom_item_name_<?php echo $oneExtraField->field_id;?>_for_product_<?php echo $this->row->product_id; ?>" class="hikashop_product_custom_item_name">
<?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
</span>
</div>
<div>
<span id="hikashop_product_custom_item_value_<?php echo $oneExtraField->field_id;?>_for_product_<?php echo $this->row->product_id; ?>" class="hikashop_product_custom_item_value">
<?php
$app = JFactory::getApplication();
$config = hikashop_config();
$addresses = array();
$fields = null;
$user_id = hikashop_loadUser();
if($user_id){
$class = hikashop_get('class.address');
$addresses = $class->loadUserAddresses($user_id);
if(!empty($addresses)){
$addressClass = hikashop_get('class.address');
$addressClass->loadZone($addresses);
$fields =& $addressClass->fields;
}
}
$t = $this->type . '_address';
$current = $this->$t;
$values = array();
if(!empty($this->addresses)) {
$addressClass = hikashop_get('class.address');
foreach($this->addresses as $k => $address) {
$addr = $addressClass->miniFormat($address);
$values[] = JHTML::_('select.option', $k, $addr);
}
}
$values[] = JHTML::_('select.option', 0, JText::_('Choose!'));
echo JHTML::_('select.genericlist', $values, 'hikashop_address_'.$this->type, 'class="hikashop_field_dropdown" onchange="window.localPage.switchAddr(this, \''.$this->type.'\');"', 'value', 'text', $current, 'hikashop_checkout_address_'.$this->type.'_selector');
?>
</span>
</div>
</div>
<?php } else {... ?>
How could get this to work?
Thanks for your help in advance!
PePe