cancel
Showing results for 
Search instead for 
Did you mean: 

Location Specific Sell

Location Specific Sell

I would not like to sell my product in below states of USA.

Alaska Hawaii, Porto Rico, po box, Military bases, APO.

 

How can I do that ??

 

Thanks

Tags (1)
1 REPLY

Re: Location Specific Sell

Hello,

 

You need to follow below steps:

Override _getRegions($storeId) method of Mage_Directory_Helper_Data class.
Assign the Region Codes which you want to exclude into an array i.e $excludeRegions variable.
Add logic for skip above region codes from available list
So the final code looks like as below:

$excludeRegions = array('AK','HI'); // sorry I don't know Porto Rico, po box, Military bases, APO region codes.
foreach ($collection as $region) {
if (!$region->getRegionId()) {
continue;
}
//BOF Custom Logic Here
$regionCode = $region->getCode();
if (in_array($regionCode, $excludeRegions)) {
continue;
}
//EOF Custom Logic Here
$regions[$region->getCountryId()][$region->getRegionId()] = array(
'code' => $region->getCode(),
'name' => $this->__($region->getName())
);
}

 

Regards,