Jump to content

[SOLVED] different line color for each feature in "Data Sheet" on the product page wont work?


kingsinnersoul

Recommended Posts

Hello,

I am want to have different colors for even and odd iterations of the product features in the Data-Sheet tab in the product page.

 

I modified the product.tpl file and added after

{foreach from=$features item=feature}
 {if isset($feature.value)}

this IF statement

{if $feature@iteration is odd by 1}

but it only detected the first row as odd, and the rest of the features were given the result of the {else} statement.

 

I even tried add key=i to the foreach statement, and then adding

{if $i%2==1}

 

but it detected one line and the rest were given the results from the {else} statement.

 

How can I currectly force different style/layout which depends on the iteration of the foreach loop?

 

PS. I am using prestashop 1.5.4.1

 

Thanks

Edited by kingsinnersoul (see edit history)
Link to comment
Share on other sites

Now I am facing a different issue/problem.

I chagned the features from a list to a table with each row having different colors and name and value are on different cells.

The table shows on both the More Info tab and the Data Sheet tab.

What am I doing wrong?

 

Thanks

Link to comment
Share on other sites

Well, it was my error. I added display:block, and that removed the display:none. Once I removed the CSS it worked like a charm.

 

Your solution is good if I want to target any specific item in the list.

But will it enable me to check for odd/even ones by doing:

{if ($smarty.foreach.count.index)%2==1}

and why the is even/odd by I tried using originally did not work for me? What was I doing wrong there?

 

Thank you

Edited by kingsinnersoul (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...