- Posts: 10
- Thank you received: 0
Linkable custom field
14 years 4 weeks ago #68643
by lucky93
Linkable custom field was created by lucky93
I like to create a custom field for example "More info"
"More info" will listing on backend products information and I can key-in an external link address for example www.google.com
Visitor will be link to www.google.com when click "More info"
May I know how to do this ?
"More info" will listing on backend products information and I can key-in an external link address for example www.google.com
Visitor will be link to www.google.com when click "More info"
May I know how to do this ?
Please Log in or Create an account to join the conversation.
14 years 4 weeks ago #68809
by nicolas
Replied by nicolas on topic Re: Linkable custom field
Hi,
In your custom field, you can enter your link like that:
<a href=' www.google.com '>More info</a>
In your custom field, you can enter your link like that:
<a href=' www.google.com '>More info</a>
Please Log in or Create an account to join the conversation.
14 years 4 weeks ago #68827
by shiva
Replied by shiva on topic Re: Linkable custom field
Thank you, I's working.
How to do if I want to open NEW windows to display link page ?
How to do if I want to open NEW windows to display link page ?
Please Log in or Create an account to join the conversation.
14 years 4 weeks ago #68833
by nicolas
Replied by nicolas on topic Re: Linkable custom field
Like that:
<a href=' www.google.com ' target='_blank'>More info</a>
<a href=' www.google.com ' target='_blank'>More info</a>
The following user(s) said Thank You: shiva
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 6
- Thank you received: 1
13 years 11 months ago #76950
by idemsisvoje
Replied by idemsisvoje on topic Re: Linkable custom field
Hi,
thanks, this topic was helpful.
However, I wonder if it would be possible to create this extra field in such way, that it won't be necessary to write HTML all the time, just to insert external URL when creating a product. I tried to play with field's default value, but it didn't work.
thanks, this topic was helpful.
However, I wonder if it would be possible to create this extra field in such way, that it won't be necessary to write HTML all the time, just to insert external URL when creating a product. I tried to play with field's default value, but it didn't work.
Please Log in or Create an account to join the conversation.
13 years 11 months ago #76994
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Linkable custom field
Hi,
You can use view override to do such thing.
The view "shop_block_custom_main" display product custom fields for the product page.
The PHP code loop on all product custom field and display them.
You can modify the view and add some specific code in order to have specific display.
Like:
And replace the "customlink" but the name of your custom field.
Regards,
You can use view override to do such thing.
The view "shop_block_custom_main" display product custom fields for the product page.
The PHP code loop on all product custom field and display them.
You can modify the view and add some specific code in order to have specific display.
Like:
Code:
foreach ($this->fields as $fieldName => $oneExtraField) {
$value = '';
if(empty($this->element->$fieldName) && !empty($this->element->main->$fieldName))$this->element->$fieldName = $this->element->main->$fieldName;
if(isset($this->element->$fieldName))
$value = trim($this->element->$fieldName);
if (!empty ($value)) {
/* Begin of code to insert */
if($fieldName == 'customlink') {
echo '<tr class="hikashop_product_custom_'.$oneExtraField->field_namekey.'>_line"><td colspan="2"><a href="'.$value.'" target="_blank">More info</a></td></tr>';
continue;
}
/* End of code to insert - Do not touch the rest */
?>
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
The following user(s) said Thank You: idemsisvoje
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 6
- Thank you received: 1
13 years 11 months ago #77226
by idemsisvoje
Replied by idemsisvoje on topic Linkable custom field
Super, i managed to make it work in less than 3 minutes. Thanks a lot!
Please Log in or Create an account to join the conversation.
Time to create page: 0.116 seconds