norbertlaza Posted January 26, 2022 Share Posted January 26, 2022 Hello, I want to add a block to the product.tpl with contact details from "our stores" section and is not working. This is the code I want to add to product.tpl. {foreach $stores as $store} <article id="store-{$store.id}" class="store-item card"> <div class="store-item-container clearfix"> <div class="col-md-3 store-picture hidden-sm-down"> <img src="{$store.image.bySize.stores_default.url}" {if !empty($store.image.legend)} alt="{$store.image.legend}" title="{$store.image.legend}" {else} alt="{$store.name}" {/if} > </div> <div class="col-md-5 col-sm-7 col-xs-12 store-description"> <p class="h3 card-title">{$store.name}</p> <address>{$store.address.formatted nofilter}</address> {if $store.note || $store.phone || $store.fax || $store.email} <a data-toggle="collapse" href="#about-{$store.id}" aria-expanded="false" aria-controls="about-{$store.id}"><strong>{l s='About and Contact' d='Shop.Theme.Global'}</strong><i class="material-icons"></i></a> {/if} </div> <div class="col-md-4 col-sm-5 col-xs-12 divide-left"> <table> {foreach $store.business_hours as $day} <tr> <th>{$day.day|truncate:4:'.'}</th> <td> <ul> {foreach $day.hours as $h} <li>{$h}</li> {/foreach} </ul> </td> </tr> {/foreach} </table> </div> </div> <footer id="about-{$store.id}" class="collapse"> <div class="store-item-footer divide-top"> {if $store.note} <div class="card-block"> <p class="text-justify">{$store.note}</p> </div> {/if} <ul class="card-block"> {if $store.phone} <li><i class="material-icons"></i>{$store.phone}</li> {/if} {if $store.fax} <li><i class="material-icons"></i>{$store.fax}</li> {/if} {if $store.email} <li><i class="material-icons"></i>{$store.email}</li> {/if} </ul> </div> </footer> </article> {/foreach} Can someone help me out? Link to comment Share on other sites More sharing options...
Waseya Posted January 27, 2022 Share Posted January 27, 2022 If you're trying to add this code directly to an existing .tpl file, it's not how it works. Tpl files are 'powered' by .php files fetching data from database tables and assigning it to smarty variables (those in {}). If php file(s), providing this .tpl functionality doesn't have these particular variables set, there is no way you can add them simply editing .tpl file itself. To show/teach you how to do it properly - is to write an entire module for you. There are simple tutorials covering this topic on Youtube though. Link to comment Share on other sites More sharing options...
Terracom_Progr Posted December 29, 2022 Share Posted December 29, 2022 Watching this becomes to my mind a question. How many alternatives are in $store.image.bySize.stores_default.url? I suposse that we can choice another image bigger. Link to comment Share on other sites More sharing options...
ventura Posted December 29, 2022 Share Posted December 29, 2022 try with {foreach Store::getStores($language.id) as $store} Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now