• Priority: 0
  • Status: Closed
  • Theme: Alysum
  • Assigned To: Marek
  • Private: No
  • Open Date: 21.06.18, 12:32
  • Opened by: fernando salas
  • Closed by: Marek
  • Closed on: 26.06.18, 10:29
  • Reason: Closed
  • Comment: Glad to help!

Ticket #12426 - Get html color code in cart page

Hello,

Is possible to get “htlm_color_code” instead of color name in cart page?

I found the code to modify, but don’t know what variable i need to call to show this html color code

Comments

Marek 21 Jun 2018, 20:00

Try this:

<span class="value" style="color:{$value}"></span>
fernando salas 22 Jun 2018, 13:51

Hello,

it doesn’t work because {$value} has the value “Grey”, so we want the html color code of this variable.

http://prntscr.com/jy0oqj

¿How can we do that?

Marek 22 Jun 2018, 14:09

You can use color names, that is no a problem https://www.w3schools.com/Colors/colors_names.asp

fernando salas 22 Jun 2018, 14:41

Hello,

The problem is that the client wants to set the name of the colours different that his html color code, for that reason we need to get this field instead the name to this part.

¿How can we do that?

Marek 22 Jun 2018, 14:43

I have no idea hot to do that fast, it’s require some code customisation.

fernando salas 25 Jun 2018, 09:41

Hello,

If you explain me how to do that i will do it (change controllers or something like that….)

Marek 25 Jun 2018, 11:50

Here is code example

{foreach from=$product.attributes key="attribute" item="value"}
  <div class="product-line-info">
    <span class="label">{$attribute}:</span>
  {foreach from=$product.main_variants item="item"}
  {if ($value == $item.name)}
    <div class="product-line-info">
      <span class="value">{$item.html_color_code}</span>
    </div>
    {/if}
  {/foreach}
  </div>
{/foreach}

If you appreciate my work, I would be glad to get symbolic payment 10 euro for my PayPal promokit.eu@gmail.com

fernando salas 26 Jun 2018, 09:27

Hello,

It worked!

Thank you so much for your work!