Last active
October 12, 2015 19:54
-
-
Save groggu/eb000d7bc00bca3cbfe9 to your computer and use it in GitHub Desktop.
Lookup NetSuite promotion by coupon code (from custom Magento module)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//assumes you are using the PHPToolKit and have already | |
// require_once 'lib/NetSuite/NetSuiteService.php'; | |
private function _getNsPromoCode($magePromoCode){ | |
$service = new NetSuiteService(); | |
//get the ID of the coupon by code | |
$searchData = new SearchStringField(); | |
$searchData->operator = "is"; | |
$searchData->searchValue = $magePromoCode; | |
$search = new CouponCodeSearchBasic(); | |
$search->code = $searchData; | |
$request = new SearchRequest(); | |
$request->searchRecord = $search; | |
$searchResponse = $service->search($request); | |
if ($searchResponse->searchResult->status->isSuccess) { | |
$result = $searchResponse->searchResult->recordList->record; | |
$promoId = $result[0]->promotion->internalId; | |
return $promoId; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment