This topic contains 2 replies, has 2 voices, and was last updated by poldo 1 week ago.
Country name in store list and info window
The topic ‘Country name in store list and info window’ is closed to new replies.
This topic contains 2 replies, has 2 voices, and was last updated by poldo 1 week ago.
Hi!
I couldn’t find a way to show the store Country in list and info window addresses in plugin settings. How is it possible to show the store Country? In PHP? Or in JS? Or …?
Thank you.
Hi poldo,
You can edit ssf-wp-xml.php and search for the following code:
echo '' .ssfParseToXML(__($row['ssf_wp_address'],SSF_WP_TEXT_DOMAIN)) .$addr2.$city. ' ' .ssfParseToXML(__($row['ssf_wp_state'],SSF_WP_TEXT_DOMAIN)).' ' .ssfParseToXML($row['ssf_wp_zip']).'';
Change it to:
echo '' .ssfParseToXML(__($row['ssf_wp_address'],SSF_WP_TEXT_DOMAIN)) .$addr2.$city. ' ' .ssfParseToXML(__($row['ssf_wp_state'],SSF_WP_TEXT_DOMAIN)).' ' .ssfParseToXML($row['ssf_wp_zip']).' ' .ssfParseToXML($row['ssf_wp_country']).'';
Take note, it will only show country code as only the CC are stored in the database, if you would like to show full country name, you might need to use if condition, for example:
$countryName=""; if(ssfParseToXML($row['ssf_wp_country'])=="US"){ $countryName="United States"; } else if(ssfParseToXML($row['ssf_wp_country'])=="EG"){ $countryName="Egypt"; } echo '' .ssfParseToXML(__($row['ssf_wp_address'],SSF_WP_TEXT_DOMAIN)) .$addr2.$city. ' ' .ssfParseToXML(__($row['ssf_wp_state'],SSF_WP_TEXT_DOMAIN)).' ' .ssfParseToXML($row['ssf_wp_zip']).' ' .$countryName.'';
Take note, the above are just examples, Based on Codecanyon support policy here, the off-the-shelf product features come as it is as per item description and live preview page, customization is not part of the support scope, however can be requested to our devs team via this link if needed.
Cheers,
Alex
Thank you, Alex.
After applying the suggested modifications I ended up with these:
Before the statement
foreach ($query as $row)
I added
$countriesList = ssfCountryList();
and replaced
echo '<address>' .ssfParseToXML(__($row['ssf_wp_address'],SSF_WP_TEXT_DOMAIN)) .$addr2.$city. ' ' .ssfParseToXML(__($row['ssf_wp_state'],SSF_WP_TEXT_DOMAIN)).' ' .ssfParseToXML($row['ssf_wp_zip']).'</address>';
with
$country = array_search(ssfParseToXML($row['ssf_wp_country']), array_column($countriesList, 'value', 'name')); $country = apply_filters('wpml_translate_single_string', $country, 'superstorefinder-wp', $country); echo '<address>' . ssfParseToXML(__($row['ssf_wp_address'],SSF_WP_TEXT_DOMAIN)) . $addr2 . $city . ' ' . ssfParseToXML(__($row['ssf_wp_state'],SSF_WP_TEXT_DOMAIN)) . ' ' . ssfParseToXML($row['ssf_wp_zip']) . ' '; echo $country . ' ' . '</address>';
So it does exaclty what I need, including translating Countries names!
Thank you for your help,
Paolo
The topic ‘Country name in store list and info window’ is closed to new replies.