You are here:  » Include css modal in price.php and fix loop


Include css modal in price.php and fix loop

Submitted by smartprice24 on Fri, 2017-11-03 13:36 in

Hi David.

I hope you can help me.
I want to include in html/price.php, a layer with information inside.

I thought the best choice was to use "foundation modalities".

Unfortunately I do not recognize the loop of each product.
Below is my price.php

{code saved}

and the portion of "modal" code.

{code saved}

The information i need to include, should be on the product.

I have read that you have to assign a unique id to modal class="".

But I could not fix the loop.

Any advice is well accepted.

Many thanks.

Giuseppe

Submitted by support on Sat, 2017-11-04 10:00

Hello Guiseppe,

Your loop already has the $k variable which contains the index into the products array so you can use this to create a unique ID for each modal div, have a go with:

<a href="#" data-reveal-id="myModal<?php print $k?>">Click Me For A Modal</a>
<div id="myModal<?php print $k?>" class="reveal-modal" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
  <h2 id="modalTitle">Awesome. I have it.</h2>
<?php if ($product["deliverytime"]): ?>
<p><span><?php print translate("Delivery Time:"); ?></span> <?php print $product["deliverytime"]; ?></p>
<?php endif; ?>
<?php if ($product["shippingcountry"]): ?>
<p><span><?php print translate("Shipping Country:"); ?></span> <?php print $product["shippingcountry"]; ?></p>
<?php endif; ?>
  <a class="close-reveal-modal" aria-label="Close">×</a>
</div>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by smartprice24 on Sun, 2017-11-05 13:23

Hi David, work fine!

Thanks.

For searchresults.php i have change:

<?php foreach($searchresults["products"] as $product): ?>

in

<?php foreach($searchresults["products"] as $k => $product): ?>

This seems to work.

However, it is correct, or, it can cause problems with pt?

Thanks
Giuseppe

Submitted by support on Mon, 2017-11-06 08:40

Hello Giuseppe,

That's perfect - won't cause any problems at all.

Cheers,
David.
--
PriceTapestry.com