Author Topic: Display an HTML link in short description  (Read 482 times)

divined

  • Beginner
  • *
  • Posts: 35
  • A beginner
  • Skype Name: George
Display an HTML link in short description
« on: June 27, 2017, 07:37:32 am »
Hello everybody

Is it possible to enter a link into the product short description using HTML code and an image. I would like for example to add <a href="url"><img src="images\apic.png"></a>.

I tried to do that but nothing appeared in the category layout of the products. Am I missing something here?

hellorain

  • Jr. Member
  • **
  • Posts: 69
    • Raincreatives - Virtuemart & Mobile Commerce Experts
  • Skype Name: support.raincreatives
Re: Display an HTML link in short description
« Reply #1 on: June 27, 2017, 13:10:10 pm »
Hello,

Below is syntax.

<a href="url"><img src="images/apic.png"></a>.

Best Regards,
hellorain.
Raincreatives - Virtuemart & Mobile Commerce Experts

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10272
  • VirtueMart Version: 3+
Re: Display an HTML link in short description
« Reply #2 on: June 27, 2017, 17:47:15 pm »
you can easily use a custom field type "editor"

I do NOT do development work for hire.

divined

  • Beginner
  • *
  • Posts: 35
  • A beginner
  • Skype Name: George
Re: Display an HTML link in short description
« Reply #3 on: June 27, 2017, 20:31:27 pm »
Thank you both for the reply!

As to embedding HTML into the short description, I've already tried that. Unfortunately, it simply doesn't appear. Maybe it has something to do with the CSS category product layout?

As for the custom fields editor, is there some recommendation you can make? I've experimented with custom fields but they require some php tinkering and I'm not exactly sure what to change.

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1097
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.5
Re: Display an HTML link in short description
« Reply #4 on: June 27, 2017, 21:30:44 pm »
Hello
Have You noticed that hellorain corrected your link ? If the file exists at that URL you will see it in the description. Check and see if you have strip_tags or something similar that is used when displaying. With protostar this should work. What do You get? A broken link image?

regards

Jörgen @ Kreativ Fotografi
Joomla 3.8.1
Virtuemart 3.2.5
Olympiantheme Hera (customized)

amedesign

  • Beginner
  • *
  • Posts: 3
  • A beginner
Re: Display an HTML link in short description
« Reply #5 on: June 27, 2017, 22:28:06 pm »
Hello everybody

Is it possible to enter a link into the product short description using HTML code and an image. I would like for example to add <a href="url"><img src="images\apic.png"></a>.

I tried to do that but nothing appeared in the category layout of the products. Am I missing something here?


You have the corrected syntax by hellorain. It should work.

As a general advice, I am using a dedicated article (not published) for editing content, for putting in different places (description for products, categories, even in plugins description text) and apply style as I wish on the text. Then go to code tab and copy the html syntax, then paste where it need. In this way I have in the same place all the text, view instant the results and I am sure that the syntax is correct every time.

divined

  • Beginner
  • *
  • Posts: 35
  • A beginner
  • Skype Name: George
Re: Display an HTML link in short description
« Reply #6 on: June 27, 2017, 23:06:00 pm »
I checked my site's code using Firebug and didn't find the link anywhere in the <product_sdesc> division of the specific product. This is the URL of my site: http://www.gpb.gr/index.php/2017-05-07-15-17-06/photocopiers/b-w-photocopiers

I've added the code given by hellorain to the last product of the page given above. In the backend I have the product_sdesc: <a href="url"><img src="images/other/adobe_s.png"></a><br>Αύτόματη διπλή όψη<br>Ταχύτητα 20 άντ/λεπτό<br>Μέγεθος χαρτιού Α4<br>Διαστάσεις Φ518xB445xH298 mm<br>ΦΑΞ προαιρετικό<br>

On the division of relevant product I only get the code:  Αύτόματη διπλή όψη<br>Ταχύτητα 20 άντ/λεπτό<br>Μέγεθος χαρτιού Α4<br>Διαστάσεις Φ518xB445xH298 mm<br>ΦΑΞ προαιρετικό                                 

which means that the HTML anchor code is being filtered somewhere along the way.

Sorry for the Greek!

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1097
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.5
Re: Display an HTML link in short description
« Reply #7 on: June 28, 2017, 00:31:45 am »
Have You tested with another template? Check the sublayout products.php to see what gives, around line 109 you should find the output. I use Hera from Olympian themes and it works with the link.

Jörgen @ Kreativ Fotografi
Joomla 3.8.1
Virtuemart 3.2.5
Olympiantheme Hera (customized)

divined

  • Beginner
  • *
  • Posts: 35
  • A beginner
  • Skype Name: George
Re: Display an HTML link in short description
« Reply #8 on: June 30, 2017, 07:29:23 am »
I'm still using the vmbeez3 template. Theoretically it should be able to render the HTML code. This is the code of the sublayout products.php:

<p class="product_s_desc">
      <?php // Product Short Description
      if (!empty($product->product_s_desc)) {
         echo shopFunctionsF::limitStringByWord ($product->product_s_desc, 400, ' ...') ?>
      <?php } ?>
</p>


Might the limitStringByWord function be omitting the relevant HTML code?

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1097
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.5
Re: Display an HTML link in short description
« Reply #9 on: June 30, 2017, 07:49:47 am »
Hello in my case this works. But I have an older VM version 3.0.19

Try this:
Code: [Select]
<p class="product_s_desc">
      <?php // Product Short Description
      
if (!empty($product->product_s_desc)) {
         
//echo shopFunctionsF::limitStringByWord ($product->product_s_desc, 400, ' ...')?>

         echo $product->product_s_desc; ?>
      <?php ?>
</p>
This will show if shopFunctionsF::limitStringByWord() strips the output  ;)

Jörgen @ Kreativ Fotografi
Joomla 3.8.1
Virtuemart 3.2.5
Olympiantheme Hera (customized)

divined

  • Beginner
  • *
  • Posts: 35
  • A beginner
  • Skype Name: George
Re: Display an HTML link in short description
« Reply #10 on: June 30, 2017, 23:15:26 pm »
Thank you for the reply

I found the cause of the problem. Once again it had to do with not setting up the multilingual properties correctly. After setting up my virtuemart according to the instructions given in this page: https://docs.virtuemart.net/tutorials/multilingual-store/99-multilanguage-setup.html everything worked correctly.