Support Forums

Replace Country name by Country Code

This is a discussion on Replace Country name by Country Code within the Modules / Plugins / Modifications forums, part of the Developer Forums category; Do you know how to replace the Country name by the Country code in the showlisting template?...


Go Back   68 Classifieds Forums > Developer Forums > Modules / Plugins / Modifications

Reply
 
Thread Tools Display Modes
Old 09-09-2008, 08:59 PM   #1
Customer
 
hel68c's Avatar
 
Join Date: Jun 2008
Location: Canada, Quebec
Posts: 293
Rep Power: 23
hel68c is just really nice hel68c is just really nice
Default Replace Country name by Country Code

Do you know how to replace the Country name by the Country code in the showlisting template?
__________________
Serge
HobbyClassified.com
V4.08 Developper, Module installed (CIV Scam Filter, Maffo Location System, Maffo News,Youtube, Seller Store)
hel68c is offline   Reply With Quote
Old 09-10-2008, 08:37 AM   #2
Customer
 
hel68c's Avatar
 
Join Date: Jun 2008
Location: Canada, Quebec
Posts: 293
Rep Power: 23
hel68c is just really nice hel68c is just really nice
Default

Like this:

Photos | ------ Title ----- | Price | - Expiration -| Country
?????? | ????????????????? | 9.00$ | 2008-12-15 | US
__________________
Serge
HobbyClassified.com
V4.08 Developper, Module installed (CIV Scam Filter, Maffo Location System, Maffo News,Youtube, Seller Store)
hel68c is offline   Reply With Quote
Old 09-10-2008, 09:59 AM   #3
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,489
Rep Power: 136
Eric Barnes is just really nice Eric Barnes is just really nice
Default

I think the only way possible would be to edit the registration form and use the code instead of the country name. Of course this would affect new customers.
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline   Reply With Quote
Old 09-10-2008, 07:21 PM   #4
Customer
 
hel68c's Avatar
 
Join Date: Jun 2008
Location: Canada, Quebec
Posts: 293
Rep Power: 23
hel68c is just really nice hel68c is just really nice
Default

If we join the table countries with this queries (listings.php line 209). Do you think it's possible?

Quote:
$sSQL = "SELECT p.id, p.owner, p.title, p.featured, p.section, p.shortDescription, p.description, p.price, p.dateadded, p.expiration, p.display, p.pHighlighted, p.pBold, p.hitcount, p.url, u.username, u.state, u.city, u.country ". $select ." FROM ".PREFIX."listings AS p LEFT JOIN ".PREFIX."users AS u ON p.owner = u.id" . $joins;
__________________
Serge
HobbyClassified.com
V4.08 Developper, Module installed (CIV Scam Filter, Maffo Location System, Maffo News,Youtube, Seller Store)
hel68c is offline   Reply With Quote
Old 09-10-2008, 07:23 PM   #5
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,489
Rep Power: 136
Eric Barnes is just really nice Eric Barnes is just really nice
Default

Yes that might work however that query is very complex. I think it already has about three joins on it.

A better option maybe to create a Smarty plugin or use Smarty's str_replace. Of course you may not want to go that route if you have users from lots and lots of countries.
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline   Reply With Quote
Old 09-10-2008, 07:46 PM   #6
Customer
 
hel68c's Avatar
 
Join Date: Jun 2008
Location: Canada, Quebec
Posts: 293
Rep Power: 23
hel68c is just really nice hel68c is just really nice
Default

Hmm... a bit to far for me.

Thanks anyway!
__________________
Serge
HobbyClassified.com
V4.08 Developper, Module installed (CIV Scam Filter, Maffo Location System, Maffo News,Youtube, Seller Store)
hel68c is offline   Reply With Quote
Old 09-10-2008, 08:23 PM   #7
The Master
 
Maffo's Avatar
 
Join Date: Mar 2006
Location: British in Argentina
Posts: 1,342
Rep Power: 53
Maffo is just really nice Maffo is just really nice
Default

Try this, havent tested this so it may not work.

Find this code at around line 377 on Listings.php

PHP Code:
while ($row=$result->fetch()) 
            {
                
$row['id']=$row['id']; 
Now just before the $row['id'] line paste this

PHP Code:
if($row['country']){
                        
$maf_sSQL="SELECT countryCode FROM ".PREFIX."countries WHERE countryName='".$row['country']."'";
                        
$maf_result=$db->query($maf_sSQL);
                        
$maf_rs=$maf_result->fetch();
                        
$row['countryCode']=$maf_rs['countryCode'];
                } 
You should then be able to use 'countryCode' from within your template.

Let me know if it doesnt work
__________________
**Bulk Upload System** has been upgraded. Works on all v4 versions with new functionality. Free upgrade for existing customers.
Maffo is offline   Reply With Quote
Old 09-10-2008, 09:56 PM   #8
Customer
 
hel68c's Avatar
 
Join Date: Jun 2008
Location: Canada, Quebec
Posts: 293
Rep Power: 23
hel68c is just really nice hel68c is just really nice
Default

Hey Maffo! you are very fast and effective.

It work fine.
Thank you!
__________________
Serge
HobbyClassified.com
V4.08 Developper, Module installed (CIV Scam Filter, Maffo Location System, Maffo News,Youtube, Seller Store)
hel68c is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does Maffo's Location mod work with the US zip code module from 68 classifieds? fendter Technical Support 1 07-23-2008 07:32 AM


All times are GMT -4. The time now is 10:38 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0